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 SkOpSpan_DEFINED | 7 #ifndef SkOpSpan_DEFINED |
8 #define SkOpSpan_DEFINED | 8 #define SkOpSpan_DEFINED |
9 | 9 |
10 #include "SkPathOpsDebug.h" | 10 #include "SkPathOpsDebug.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return fNext; | 98 return fNext; |
99 } | 99 } |
100 | 100 |
101 bool onEnd() const; | 101 bool onEnd() const; |
102 | 102 |
103 static bool Overlaps(SkOpPtT* s1, SkOpPtT* e1, SkOpPtT* s2, SkOpPtT* e2, | 103 static bool Overlaps(SkOpPtT* s1, SkOpPtT* e1, SkOpPtT* s2, SkOpPtT* e2, |
104 SkOpPtT** sOut, SkOpPtT** eOut) { | 104 SkOpPtT** sOut, SkOpPtT** eOut) { |
105 SkOpPtT* start1 = s1->fT < e1->fT ? s1 : e1; | 105 SkOpPtT* start1 = s1->fT < e1->fT ? s1 : e1; |
106 SkOpPtT* start2 = s2->fT < e2->fT ? s2 : e2; | 106 SkOpPtT* start2 = s2->fT < e2->fT ? s2 : e2; |
107 *sOut = between(s1->fT, start2->fT, e1->fT) ? start2 | 107 *sOut = between(s1->fT, start2->fT, e1->fT) ? start2 |
108 : between(s2->fT, start1->fT, e2->fT) ? start1 : NULL; | 108 : between(s2->fT, start1->fT, e2->fT) ? start1 : nullptr; |
109 SkOpPtT* end1 = s1->fT < e1->fT ? e1 : s1; | 109 SkOpPtT* end1 = s1->fT < e1->fT ? e1 : s1; |
110 SkOpPtT* end2 = s2->fT < e2->fT ? e2 : s2; | 110 SkOpPtT* end2 = s2->fT < e2->fT ? e2 : s2; |
111 *eOut = between(s1->fT, end2->fT, e1->fT) ? end2 | 111 *eOut = between(s1->fT, end2->fT, e1->fT) ? end2 |
112 : between(s2->fT, end1->fT, e2->fT) ? end1 : NULL; | 112 : between(s2->fT, end1->fT, e2->fT) ? end1 : nullptr; |
113 if (*sOut == *eOut) { | 113 if (*sOut == *eOut) { |
114 SkASSERT(start1->fT >= end2->fT || start2->fT >= end1->fT); | 114 SkASSERT(start1->fT >= end2->fT || start2->fT >= end1->fT); |
115 return false; | 115 return false; |
116 } | 116 } |
117 SkASSERT(!*sOut || *sOut != *eOut); | 117 SkASSERT(!*sOut || *sOut != *eOut); |
118 return *sOut && *eOut; | 118 return *sOut && *eOut; |
119 } | 119 } |
120 | 120 |
121 SkOpPtT* prev(); | 121 SkOpPtT* prev(); |
122 SkOpPtT* remove(); | 122 SkOpPtT* remove(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 SkASSERT(!final()); | 334 SkASSERT(!final()); |
335 return (SkOpSpan*) this; | 335 return (SkOpSpan*) this; |
336 } | 336 } |
337 | 337 |
338 const SkOpSpan* upCast() const { | 338 const SkOpSpan* upCast() const { |
339 SkASSERT(!final()); | 339 SkASSERT(!final()); |
340 return (const SkOpSpan*) this; | 340 return (const SkOpSpan*) this; |
341 } | 341 } |
342 | 342 |
343 SkOpSpan* upCastable() { | 343 SkOpSpan* upCastable() { |
344 return final() ? NULL : upCast(); | 344 return final() ? nullptr : upCast(); |
345 } | 345 } |
346 | 346 |
347 const SkOpSpan* upCastable() const { | 347 const SkOpSpan* upCastable() const { |
348 return final() ? NULL : upCast(); | 348 return final() ? nullptr : upCast(); |
349 } | 349 } |
350 | 350 |
351 private: | 351 private: |
352 void alignInner(); | 352 void alignInner(); |
353 | 353 |
354 protected: // no direct access to internals to avoid treating a span base as a
span | 354 protected: // no direct access to internals to avoid treating a span base as a
span |
355 SkOpPtT fPtT; // list of points and t values associated with the start of t
his span | 355 SkOpPtT fPtT; // list of points and t values associated with the start of t
his span |
356 SkOpSegment* fSegment; // segment that contains this span | 356 SkOpSegment* fSegment; // segment that contains this span |
357 SkOpSpanBase* fCoinEnd; // linked list of coincident spans that end here (m
ay point to itself) | 357 SkOpSpanBase* fCoinEnd; // linked list of coincident spans that end here (m
ay point to itself) |
358 SkOpAngle* fFromAngle; // points to next angle from span start to end | 358 SkOpAngle* fFromAngle; // points to next angle from span start to end |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 SkOpSpanBase* fNext; // next intersection point | 496 SkOpSpanBase* fNext; // next intersection point |
497 int fWindSum; // accumulated from contours surrounding this one. | 497 int fWindSum; // accumulated from contours surrounding this one. |
498 int fOppSum; // for binary operators: the opposite winding sum | 498 int fOppSum; // for binary operators: the opposite winding sum |
499 int fWindValue; // 0 == canceled; 1 == normal; >1 == coincident | 499 int fWindValue; // 0 == canceled; 1 == normal; >1 == coincident |
500 int fOppValue; // normally 0 -- when binary coincident edges combine, opp v
alue goes here | 500 int fOppValue; // normally 0 -- when binary coincident edges combine, opp v
alue goes here |
501 int fTopTTry; // specifies direction and t value to try next | 501 int fTopTTry; // specifies direction and t value to try next |
502 bool fDone; // if set, this span to next higher T has been processed | 502 bool fDone; // if set, this span to next higher T has been processed |
503 }; | 503 }; |
504 | 504 |
505 #endif | 505 #endif |
OLD | NEW |