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 SkOpSegment_DEFINE | 7 #ifndef SkOpSegment_DEFINE |
8 #define SkOpSegment_DEFINE | 8 #define SkOpSegment_DEFINE |
9 | 9 |
10 #include "SkOpAngle.h" | 10 #include "SkOpAngle.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 int oppValue(const SkOpAngle* angle) const { | 124 int oppValue(const SkOpAngle* angle) const { |
125 int lesser = SkMin32(angle->start(), angle->end()); | 125 int lesser = SkMin32(angle->start(), angle->end()); |
126 return fTs[lesser].fOppValue; | 126 return fTs[lesser].fOppValue; |
127 } | 127 } |
128 | 128 |
129 const SkOpSegment* other(int index) const { | 129 const SkOpSegment* other(int index) const { |
130 return fTs[index].fOther; | 130 return fTs[index].fOther; |
131 } | 131 } |
132 | 132 |
| 133 // was used only by right angle winding finding |
| 134 SkPoint ptAtT(double mid) const { |
| 135 return (*CurvePointAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, mid); |
| 136 } |
| 137 |
133 const SkPoint* pts() const { | 138 const SkPoint* pts() const { |
134 return fPts; | 139 return fPts; |
135 } | 140 } |
136 | 141 |
137 void reset() { | 142 void reset() { |
138 init(NULL, (SkPath::Verb) -1, false, false); | 143 init(NULL, (SkPath::Verb) -1, false, false); |
139 fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMax, SK_ScalarMax); | 144 fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMax, SK_ScalarMax); |
140 fTs.reset(); | 145 fTs.reset(); |
141 } | 146 } |
142 | 147 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 212 } |
208 | 213 |
209 SkScalar xAtT(const SkOpSpan* span) const { | 214 SkScalar xAtT(const SkOpSpan* span) const { |
210 return xyAtT(span).fX; | 215 return xyAtT(span).fX; |
211 } | 216 } |
212 | 217 |
213 const SkPoint& xyAtT(const SkOpSpan* span) const { | 218 const SkPoint& xyAtT(const SkOpSpan* span) const { |
214 return span->fPt; | 219 return span->fPt; |
215 } | 220 } |
216 | 221 |
217 // used only by right angle winding finding | |
218 SkPoint xyAtT(double mid) const { | |
219 return (*CurvePointAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, mid); | |
220 } | |
221 | |
222 const SkPoint& xyAtT(int index) const { | 222 const SkPoint& xyAtT(int index) const { |
223 return xyAtT(&fTs[index]); | 223 return xyAtT(&fTs[index]); |
224 } | 224 } |
225 | 225 |
226 SkScalar yAtT(int index) const { | 226 SkScalar yAtT(int index) const { |
227 return yAtT(&fTs[index]); | 227 return yAtT(&fTs[index]); |
228 } | 228 } |
229 | 229 |
230 SkScalar yAtT(const SkOpSpan* span) const { | 230 SkScalar yAtT(const SkOpSpan* span) const { |
231 return xyAtT(span).fY; | 231 return xyAtT(span).fY; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 #endif | 387 #endif |
388 #if DEBUG_MARK_DONE || DEBUG_UNSORTABLE | 388 #if DEBUG_MARK_DONE || DEBUG_UNSORTABLE |
389 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding)
; | 389 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding)
; |
390 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding,
int oppWinding); | 390 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding,
int oppWinding); |
391 #endif | 391 #endif |
392 #if DEBUG_WINDING | 392 #if DEBUG_WINDING |
393 static char as_digit(int value) { | 393 static char as_digit(int value) { |
394 return value < 0 ? '?' : value <= 9 ? '0' + value : '+'; | 394 return value < 0 ? '?' : value <= 9 ? '0' + value : '+'; |
395 } | 395 } |
396 #endif | 396 #endif |
| 397 void debugValidate() const; |
397 | 398 |
398 const SkPoint* fPts; | 399 const SkPoint* fPts; |
399 SkPathOpsBounds fBounds; | 400 SkPathOpsBounds fBounds; |
400 // FIXME: can't convert to SkTArray because it uses insert | 401 // FIXME: can't convert to SkTArray because it uses insert |
401 SkTDArray<SkOpSpan> fTs; // two or more (always includes t=0 t=1) | 402 SkTDArray<SkOpSpan> fTs; // two or more (always includes t=0 t=1) |
402 // OPTIMIZATION: could pack donespans, verb, operand, xor into 1 int-sized v
alue | 403 // OPTIMIZATION: could pack donespans, verb, operand, xor into 1 int-sized v
alue |
403 int fDoneSpans; // quick check that segment is finished | 404 int fDoneSpans; // quick check that segment is finished |
404 // OPTIMIZATION: force the following to be byte-sized | 405 // OPTIMIZATION: force the following to be byte-sized |
405 SkPath::Verb fVerb; | 406 SkPath::Verb fVerb; |
406 bool fOperand; | 407 bool fOperand; |
407 bool fXor; // set if original contour had even-odd fill | 408 bool fXor; // set if original contour had even-odd fill |
408 bool fOppXor; // set if opposite operand had even-odd fill | 409 bool fOppXor; // set if opposite operand had even-odd fill |
409 #if DEBUG_DUMP | 410 #if DEBUG_DUMP |
410 int fID; | 411 int fID; |
411 #endif | 412 #endif |
412 }; | 413 }; |
413 | 414 |
414 #endif | 415 #endif |
OLD | NEW |