Index: src/pathops/SkPathOpsTypes.cpp |
diff --git a/src/pathops/SkPathOpsTypes.cpp b/src/pathops/SkPathOpsTypes.cpp |
index df73d11ce44e0122abf84f86318ef8011444f0b3..dbed086fbd94d868d224eb97943f063599e0f562 100644 |
--- a/src/pathops/SkPathOpsTypes.cpp |
+++ b/src/pathops/SkPathOpsTypes.cpp |
@@ -8,17 +8,17 @@ |
#include "SkPathOpsTypes.h" |
static bool arguments_denormalized(float a, float b, int epsilon) { |
- float denomalizedCheck = FLT_EPSILON * epsilon / 2; |
- return fabsf(a) <= denomalizedCheck && fabsf(b) <= denomalizedCheck; |
+ float denormalizedCheck = FLT_EPSILON * epsilon / 2; |
+ return fabsf(a) <= denormalizedCheck && fabsf(b) <= denormalizedCheck; |
} |
// from http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ |
// FIXME: move to SkFloatBits.h |
-static bool equal_ulps(float a, float b, int epsilon) { |
+static bool equal_ulps(float a, float b, int epsilon, int depsilon) { |
if (!SkScalarIsFinite(a) || !SkScalarIsFinite(b)) { |
return false; |
} |
- if (arguments_denormalized(a, b, epsilon)) { |
+ if (arguments_denormalized(a, b, depsilon)) { |
return true; |
} |
int aBits = SkFloatAs2sCompliment(a); |
@@ -89,7 +89,12 @@ static bool less_or_equal_ulps(float a, float b, int epsilon) { |
// equality using the same error term as between |
bool AlmostBequalUlps(float a, float b) { |
const int UlpsEpsilon = 2; |
- return equal_ulps(a, b, UlpsEpsilon); |
+ return equal_ulps(a, b, UlpsEpsilon, UlpsEpsilon); |
+} |
+ |
+bool AlmostPequalUlps(float a, float b) { |
+ const int UlpsEpsilon = 8; |
+ return equal_ulps(a, b, UlpsEpsilon, UlpsEpsilon); |
} |
bool AlmostDequalUlps(float a, float b) { |
@@ -99,7 +104,7 @@ bool AlmostDequalUlps(float a, float b) { |
bool AlmostEqualUlps(float a, float b) { |
const int UlpsEpsilon = 16; |
- return equal_ulps(a, b, UlpsEpsilon); |
+ return equal_ulps(a, b, UlpsEpsilon, UlpsEpsilon); |
} |
bool NotAlmostEqualUlps(float a, float b) { |
@@ -114,7 +119,8 @@ bool NotAlmostDequalUlps(float a, float b) { |
bool RoughlyEqualUlps(float a, float b) { |
const int UlpsEpsilon = 256; |
- return equal_ulps(a, b, UlpsEpsilon); |
+ const int DUlpsEpsilon = 1024; |
+ return equal_ulps(a, b, UlpsEpsilon, DUlpsEpsilon); |
} |
bool AlmostBetweenUlps(float a, float b, float c) { |