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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return fCoincidence; | 69 return fCoincidence; |
70 } | 70 } |
71 | 71 |
72 SkOpContourHead* contourHead() { | 72 SkOpContourHead* contourHead() { |
73 return fContourHead; | 73 return fContourHead; |
74 } | 74 } |
75 | 75 |
76 #ifdef SK_DEBUG | 76 #ifdef SK_DEBUG |
77 const class SkOpAngle* debugAngle(int id) const; | 77 const class SkOpAngle* debugAngle(int id) const; |
78 const SkOpCoincidence* debugCoincidence() const; | 78 const SkOpCoincidence* debugCoincidence() const; |
79 SkOpContour* debugContour(int id); | 79 SkOpContour* debugContour(int id) const; |
80 const class SkOpPtT* debugPtT(int id) const; | 80 const class SkOpPtT* debugPtT(int id) const; |
81 bool debugRunFail() const; | 81 bool debugRunFail() const; |
82 const class SkOpSegment* debugSegment(int id) const; | 82 const class SkOpSegment* debugSegment(int id) const; |
83 bool debugSkipAssert() const { return fDebugSkipAssert; } | 83 bool debugSkipAssert() const { return fDebugSkipAssert; } |
84 const class SkOpSpanBase* debugSpan(int id) const; | 84 const class SkOpSpanBase* debugSpan(int id) const; |
85 const char* debugTestName() const { return fDebugTestName; } | 85 const char* debugTestName() const { return fDebugTestName; } |
86 #endif | 86 #endif |
87 | 87 |
88 #if DEBUG_T_SECT_LOOP_COUNT | 88 #if DEBUG_T_SECT_LOOP_COUNT |
89 void debugAddLoopCount(SkIntersections* , const SkIntersectionHelper& , | 89 void debugAddLoopCount(SkIntersections* , const SkIntersectionHelper& , |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 SkPath::Verb fDebugWorstVerb[6]; | 190 SkPath::Verb fDebugWorstVerb[6]; |
191 SkPoint fDebugWorstPts[24]; | 191 SkPoint fDebugWorstPts[24]; |
192 float fDebugWorstWeight[6]; | 192 float fDebugWorstWeight[6]; |
193 #endif | 193 #endif |
194 #if DEBUG_COINCIDENCE | 194 #if DEBUG_COINCIDENCE |
195 bool fDebugCheckHealth; | 195 bool fDebugCheckHealth; |
196 #endif | 196 #endif |
197 }; | 197 }; |
198 | 198 |
199 #ifdef SK_DEBUG | 199 #ifdef SK_DEBUG |
| 200 #if DEBUG_COINCIDENCE |
200 #define SkOPASSERT(cond) SkASSERT((this->globalState() && \ | 201 #define SkOPASSERT(cond) SkASSERT((this->globalState() && \ |
201 this->globalState()->debugSkipAssert()) || cond) | 202 (this->globalState()->debugCheckHealth() || \ |
| 203 this->globalState()->debugSkipAssert())) || (cond)) |
| 204 #else |
| 205 #define SkOPASSERT(cond) SkASSERT((this->globalState() && \ |
| 206 this->globalState()->debugSkipAssert()) || (cond)) |
| 207 #endif |
202 #define SkOPOBJASSERT(obj, cond) SkASSERT((obj->debugGlobalState() && \ | 208 #define SkOPOBJASSERT(obj, cond) SkASSERT((obj->debugGlobalState() && \ |
203 obj->debugGlobalState()->debugSkipAssert()) || cond) | 209 obj->debugGlobalState()->debugSkipAssert()) || (cond)) |
204 #else | 210 #else |
205 #define SkOPASSERT(cond) | 211 #define SkOPASSERT(cond) |
206 #define SkOPOBJASSERT(obj, cond) | 212 #define SkOPOBJASSERT(obj, cond) |
207 #endif | 213 #endif |
208 | 214 |
209 // Use Almost Equal when comparing coordinates. Use epsilon to compare T values. | 215 // Use Almost Equal when comparing coordinates. Use epsilon to compare T values. |
210 bool AlmostEqualUlps(float a, float b); | 216 bool AlmostEqualUlps(float a, float b); |
211 inline bool AlmostEqualUlps(double a, double b) { | 217 inline bool AlmostEqualUlps(double a, double b) { |
212 return AlmostEqualUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); | 218 return AlmostEqualUlps(SkDoubleToScalar(a), SkDoubleToScalar(b)); |
213 } | 219 } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 528 |
523 inline bool roughly_between(double a, double b, double c) { | 529 inline bool roughly_between(double a, double b, double c) { |
524 return a <= c ? roughly_negative(a - b) && roughly_negative(b - c) | 530 return a <= c ? roughly_negative(a - b) && roughly_negative(b - c) |
525 : roughly_negative(b - a) && roughly_negative(c - b); | 531 : roughly_negative(b - a) && roughly_negative(c - b); |
526 } | 532 } |
527 | 533 |
528 inline bool more_roughly_equal(double x, double y) { | 534 inline bool more_roughly_equal(double x, double y) { |
529 return fabs(x - y) < MORE_ROUGH_EPSILON; | 535 return fabs(x - y) < MORE_ROUGH_EPSILON; |
530 } | 536 } |
531 | 537 |
532 inline bool way_roughly_equal(double x, double y) { | |
533 return fabs(x - y) < WAY_ROUGH_EPSILON; | |
534 } | |
535 | |
536 struct SkDPoint; | 538 struct SkDPoint; |
537 struct SkDVector; | 539 struct SkDVector; |
538 struct SkDLine; | 540 struct SkDLine; |
539 struct SkDQuad; | 541 struct SkDQuad; |
540 struct SkDConic; | 542 struct SkDConic; |
541 struct SkDCubic; | 543 struct SkDCubic; |
542 struct SkDRect; | 544 struct SkDRect; |
543 | 545 |
544 inline SkPath::Verb SkPathOpsPointsToVerb(int points) { | 546 inline SkPath::Verb SkPathOpsPointsToVerb(int points) { |
545 int verb = (1 << points) >> 1; | 547 int verb = (1 << points) >> 1; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 */ | 593 */ |
592 inline int SkDSideBit(double x) { | 594 inline int SkDSideBit(double x) { |
593 return 1 << SKDSide(x); | 595 return 1 << SKDSide(x); |
594 } | 596 } |
595 | 597 |
596 inline double SkPinT(double t) { | 598 inline double SkPinT(double t) { |
597 return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 :
t; | 599 return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 :
t; |
598 } | 600 } |
599 | 601 |
600 #endif | 602 #endif |
OLD | NEW |