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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class SkOpCoincidence; | 25 class SkOpCoincidence; |
26 class SkOpContour; | 26 class SkOpContour; |
27 class SkOpContourHead; | 27 class SkOpContourHead; |
28 | 28 |
29 class SkOpGlobalState { | 29 class SkOpGlobalState { |
30 public: | 30 public: |
31 SkOpGlobalState(SkOpCoincidence* coincidence, SkOpContourHead* head) | 31 SkOpGlobalState(SkOpCoincidence* coincidence, SkOpContourHead* head) |
32 : fCoincidence(coincidence) | 32 : fCoincidence(coincidence) |
33 , fContourHead(head) | 33 , fContourHead(head) |
| 34 , fNested(0) |
34 , fWindingFailed(false) | 35 , fWindingFailed(false) |
35 , fAngleCoincidence(false) | 36 , fAngleCoincidence(false) |
36 , fPhase(kIntersecting) | 37 , fPhase(kIntersecting) |
37 SkDEBUGPARAMS(fAngleID(0)) | 38 SkDEBUGPARAMS(fAngleID(0)) |
38 SkDEBUGPARAMS(fContourID(0)) | 39 SkDEBUGPARAMS(fContourID(0)) |
39 SkDEBUGPARAMS(fPtTID(0)) | 40 SkDEBUGPARAMS(fPtTID(0)) |
40 SkDEBUGPARAMS(fSegmentID(0)) | 41 SkDEBUGPARAMS(fSegmentID(0)) |
41 SkDEBUGPARAMS(fSpanID(0)) { | 42 SkDEBUGPARAMS(fSpanID(0)) { |
42 } | 43 } |
43 | 44 |
44 enum Phase { | 45 enum Phase { |
45 kIntersecting, | 46 kIntersecting, |
46 kWalking, | 47 kWalking, |
47 kFixWinding, | 48 kFixWinding, |
48 }; | 49 }; |
49 | 50 |
50 enum { | 51 enum { |
51 kMaxWindingTries = 10 | 52 kMaxWindingTries = 10 |
52 }; | 53 }; |
53 | 54 |
54 bool angleCoincidence() { | 55 bool angleCoincidence() { |
55 return fAngleCoincidence; | 56 return fAngleCoincidence; |
56 } | 57 } |
57 | 58 |
| 59 void bumpNested() { |
| 60 ++fNested; |
| 61 } |
| 62 |
| 63 void clearNested() { |
| 64 fNested = 0; |
| 65 } |
| 66 |
58 SkOpCoincidence* coincidence() { | 67 SkOpCoincidence* coincidence() { |
59 return fCoincidence; | 68 return fCoincidence; |
60 } | 69 } |
61 | 70 |
62 SkOpContourHead* contourHead() { | 71 SkOpContourHead* contourHead() { |
63 return fContourHead; | 72 return fContourHead; |
64 } | 73 } |
65 | 74 |
66 #ifdef SK_DEBUG | 75 #ifdef SK_DEBUG |
67 const struct SkOpAngle* debugAngle(int id) const; | 76 const struct SkOpAngle* debugAngle(int id) const; |
68 SkOpContour* debugContour(int id); | 77 SkOpContour* debugContour(int id); |
69 const class SkOpPtT* debugPtT(int id) const; | 78 const class SkOpPtT* debugPtT(int id) const; |
70 const class SkOpSegment* debugSegment(int id) const; | 79 const class SkOpSegment* debugSegment(int id) const; |
71 const class SkOpSpanBase* debugSpan(int id) const; | 80 const class SkOpSpanBase* debugSpan(int id) const; |
| 81 #endif |
72 | 82 |
| 83 int nested() const { |
| 84 return fNested; |
| 85 } |
| 86 |
| 87 #ifdef SK_DEBUG |
73 int nextAngleID() { | 88 int nextAngleID() { |
74 return ++fAngleID; | 89 return ++fAngleID; |
75 } | 90 } |
76 | 91 |
77 int nextContourID() { | 92 int nextContourID() { |
78 return ++fContourID; | 93 return ++fContourID; |
79 } | 94 } |
80 int nextPtTID() { | 95 int nextPtTID() { |
81 return ++fPtTID; | 96 return ++fPtTID; |
82 } | 97 } |
(...skipping 29 matching lines...) Expand all Loading... |
112 fWindingFailed = true; | 127 fWindingFailed = true; |
113 } | 128 } |
114 | 129 |
115 bool windingFailed() const { | 130 bool windingFailed() const { |
116 return fWindingFailed; | 131 return fWindingFailed; |
117 } | 132 } |
118 | 133 |
119 private: | 134 private: |
120 SkOpCoincidence* fCoincidence; | 135 SkOpCoincidence* fCoincidence; |
121 SkOpContourHead* fContourHead; | 136 SkOpContourHead* fContourHead; |
| 137 int fNested; |
122 bool fWindingFailed; | 138 bool fWindingFailed; |
123 bool fAngleCoincidence; | 139 bool fAngleCoincidence; |
124 Phase fPhase; | 140 Phase fPhase; |
125 #ifdef SK_DEBUG | 141 #ifdef SK_DEBUG |
126 int fAngleID; | 142 int fAngleID; |
127 int fContourID; | 143 int fContourID; |
128 int fPtTID; | 144 int fPtTID; |
129 int fSegmentID; | 145 int fSegmentID; |
130 int fSpanID; | 146 int fSpanID; |
131 #endif | 147 #endif |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 */ | 512 */ |
497 inline int SkDSideBit(double x) { | 513 inline int SkDSideBit(double x) { |
498 return 1 << SKDSide(x); | 514 return 1 << SKDSide(x); |
499 } | 515 } |
500 | 516 |
501 inline double SkPinT(double t) { | 517 inline double SkPinT(double t) { |
502 return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 :
t; | 518 return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 :
t; |
503 } | 519 } |
504 | 520 |
505 #endif | 521 #endif |
OLD | NEW |