OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #ifndef SkPathOpsTypes_DEFINED | 7 #ifndef SkPathOpsTypes_DEFINED |
8 #define SkPathOpsTypes_DEFINED | 8 #define SkPathOpsTypes_DEFINED |
9 | 9 |
10 #include <float.h> // for FLT_EPSILON | 10 #include <float.h> // for FLT_EPSILON |
(...skipping 10 matching lines...) Expand all Loading... |
21 kNo_PathOpsMask = 0, | 21 kNo_PathOpsMask = 0, |
22 kEvenOdd_PathOpsMask = 1 | 22 kEvenOdd_PathOpsMask = 1 |
23 }; | 23 }; |
24 | 24 |
25 // Use Almost Equal when comparing coordinates. Use epsilon to compare T values. | 25 // Use Almost Equal when comparing coordinates. Use epsilon to compare T values. |
26 bool AlmostEqualUlps(float a, float b); | 26 bool AlmostEqualUlps(float a, float b); |
27 inline bool AlmostEqualUlps(double a, double b) { | 27 inline bool AlmostEqualUlps(double a, double b) { |
28 return AlmostEqualUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); | 28 return AlmostEqualUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); |
29 } | 29 } |
30 | 30 |
| 31 // Use Almost Dequal when comparing should not special case denormalized values. |
| 32 bool AlmostDequalUlps(float a, float b); |
| 33 inline bool AlmostDequalUlps(double a, double b) { |
| 34 return AlmostDequalUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); |
| 35 } |
| 36 |
31 bool NotAlmostEqualUlps(float a, float b); | 37 bool NotAlmostEqualUlps(float a, float b); |
32 inline bool NotAlmostEqualUlps(double a, double b) { | 38 inline bool NotAlmostEqualUlps(double a, double b) { |
33 return NotAlmostEqualUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); | 39 return NotAlmostEqualUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); |
34 } | 40 } |
35 | 41 |
| 42 bool NotAlmostDequalUlps(float a, float b); |
| 43 inline bool NotAlmostDequalUlps(double a, double b) { |
| 44 return NotAlmostDequalUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); |
| 45 } |
| 46 |
36 // Use Almost Bequal when comparing coordinates in conjunction with between. | 47 // Use Almost Bequal when comparing coordinates in conjunction with between. |
37 bool AlmostBequalUlps(float a, float b); | 48 bool AlmostBequalUlps(float a, float b); |
38 inline bool AlmostBequalUlps(double a, double b) { | 49 inline bool AlmostBequalUlps(double a, double b) { |
39 return AlmostBequalUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); | 50 return AlmostBequalUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); |
40 } | 51 } |
41 | 52 |
42 bool RoughlyEqualUlps(float a, float b); | 53 bool RoughlyEqualUlps(float a, float b); |
43 inline bool RoughlyEqualUlps(double a, double b) { | 54 inline bool RoughlyEqualUlps(double a, double b) { |
44 return RoughlyEqualUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); | 55 return RoughlyEqualUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); |
45 } | 56 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 inline void DebugDumpFloat(float x) { | 318 inline void DebugDumpFloat(float x) { |
308 if (x == floorf(x)) { | 319 if (x == floorf(x)) { |
309 SkDebugf("%.0f", x); | 320 SkDebugf("%.0f", x); |
310 } else { | 321 } else { |
311 SkDebugf("%1.9gf", x); | 322 SkDebugf("%1.9gf", x); |
312 } | 323 } |
313 } | 324 } |
314 #endif | 325 #endif |
315 | 326 |
316 #endif | 327 #endif |
OLD | NEW |