зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1164557 - Use COORDINATE_EPSILON in IsZero(). r=kats
--HG-- extra : source : fe7548a3554a7d6033147f616612005a8242f7a0
This commit is contained in:
Родитель
441122c472
Коммит
9c6dd7f1ef
|
@ -38,11 +38,19 @@ enum class ScrollSource {
|
|||
|
||||
typedef uint32_t TouchBehaviorFlags;
|
||||
|
||||
// Epsilon to be used when comparing 'float' coordinate values
|
||||
// with FuzzyEqualsAdditive. The rationale is that 'float' has 7 decimal
|
||||
// digits of precision, and coordinate values should be no larger than in the
|
||||
// ten thousands. Note also that the smallest legitimate difference in page
|
||||
// coordinates is 1 app unit, which is 1/60 of a (CSS pixel), so this epsilon
|
||||
// isn't too large.
|
||||
const float COORDINATE_EPSILON = 0.01f;
|
||||
|
||||
template <typename Units>
|
||||
static bool IsZero(const gfx::PointTyped<Units>& aPoint)
|
||||
{
|
||||
return FuzzyEqualsAdditive(aPoint.x, 0.0f)
|
||||
&& FuzzyEqualsAdditive(aPoint.y, 0.0f);
|
||||
return FuzzyEqualsAdditive(aPoint.x, 0.0f, COORDINATE_EPSILON)
|
||||
&& FuzzyEqualsAdditive(aPoint.y, 0.0f, COORDINATE_EPSILON);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define mozilla_layers_Axis_h
|
||||
|
||||
#include <sys/types.h> // for int32_t
|
||||
#include "APZUtils.h"
|
||||
#include "Units.h"
|
||||
#include "mozilla/TimeStamp.h" // for TimeDuration
|
||||
#include "nsTArray.h" // for nsTArray
|
||||
|
@ -17,14 +18,6 @@ namespace layers {
|
|||
|
||||
const float EPSILON = 0.0001f;
|
||||
|
||||
// Epsilon to be used when comparing 'float' coordinate values
|
||||
// with FuzzyEqualsAdditive. The rationale is that 'float' has 7 decimal
|
||||
// digits of precision, and coordinate values should be no larger than in the
|
||||
// ten thousands. Note also that the smallest legitimate difference in page
|
||||
// coordinates is 1 app unit, which is 1/60 of a (CSS pixel), so this epsilon
|
||||
// isn't too large.
|
||||
const float COORDINATE_EPSILON = 0.01f;
|
||||
|
||||
/**
|
||||
* Compare two coordinates for equality, accounting for rounding error.
|
||||
* Use both FuzzyEqualsAdditive() with COORDINATE_EPISLON, which accounts for
|
||||
|
|
Загрузка…
Ссылка в новой задаче