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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 | 177 |
178 int spanSign(int startIndex, int endIndex) const { | 178 int spanSign(int startIndex, int endIndex) const { |
179 int result = startIndex < endIndex ? -fTs[startIndex].fWindValue : fTs[e
ndIndex].fWindValue; | 179 int result = startIndex < endIndex ? -fTs[startIndex].fWindValue : fTs[e
ndIndex].fWindValue; |
180 #if DEBUG_WIND_BUMP | 180 #if DEBUG_WIND_BUMP |
181 SkDebugf("%s spanSign=%d\n", __FUNCTION__, result); | 181 SkDebugf("%s spanSign=%d\n", __FUNCTION__, result); |
182 #endif | 182 #endif |
183 return result; | 183 return result; |
184 } | 184 } |
185 | 185 |
186 // OPTIMIZATION: mark as debugging only if used solely by tests | |
187 double t(int tIndex) const { | 186 double t(int tIndex) const { |
188 return fTs[tIndex].fT; | 187 return fTs[tIndex].fT; |
189 } | 188 } |
190 | 189 |
191 double tAtMid(int start, int end, double mid) const { | 190 double tAtMid(int start, int end, double mid) const { |
192 return fTs[start].fT * (1 - mid) + fTs[end].fT * mid; | 191 return fTs[start].fT * (1 - mid) + fTs[end].fT * mid; |
193 } | 192 } |
194 | 193 |
195 bool unsortable(int index) const { | 194 bool unsortable(int index) const { |
196 return fTs[index].fUnsortableStart || fTs[index].fUnsortableEnd; | 195 return fTs[index].fUnsortableStart || fTs[index].fUnsortableEnd; |
197 } | 196 } |
198 | 197 |
199 void updatePts(const SkPoint pts[]) { | 198 void updatePts(const SkPoint pts[]) { |
200 fPts = pts; | 199 fPts = pts; |
201 } | 200 } |
202 | 201 |
203 SkPath::Verb verb() const { | 202 SkPath::Verb verb() const { |
204 return fVerb; | 203 return fVerb; |
205 } | 204 } |
206 | 205 |
207 int windSum(int tIndex) const { | 206 int windSum(int tIndex) const { |
208 return fTs[tIndex].fWindSum; | 207 return fTs[tIndex].fWindSum; |
209 } | 208 } |
210 | 209 |
211 int windValue(int tIndex) const { | 210 int windValue(int tIndex) const { |
212 return fTs[tIndex].fWindValue; | 211 return fTs[tIndex].fWindValue; |
213 } | 212 } |
214 | 213 |
| 214 #if defined(SK_DEBUG) || DEBUG_WINDING |
215 SkScalar xAtT(int index) const { | 215 SkScalar xAtT(int index) const { |
216 return xAtT(&fTs[index]); | 216 return xAtT(&fTs[index]); |
217 } | 217 } |
218 | 218 #endif |
219 SkScalar xAtT(const SkOpSpan* span) const { | |
220 return xyAtT(span).fX; | |
221 } | |
222 | 219 |
223 const SkPoint& xyAtT(const SkOpSpan* span) const { | 220 const SkPoint& xyAtT(const SkOpSpan* span) const { |
224 return span->fPt; | 221 return span->fPt; |
225 } | 222 } |
226 | 223 |
227 const SkPoint& xyAtT(int index) const { | 224 const SkPoint& xyAtT(int index) const { |
228 return xyAtT(&fTs[index]); | 225 return xyAtT(&fTs[index]); |
229 } | 226 } |
230 | 227 |
| 228 #if defined(SK_DEBUG) || DEBUG_WINDING |
231 SkScalar yAtT(int index) const { | 229 SkScalar yAtT(int index) const { |
232 return yAtT(&fTs[index]); | 230 return yAtT(&fTs[index]); |
233 } | 231 } |
234 | 232 #endif |
235 SkScalar yAtT(const SkOpSpan* span) const { | |
236 return xyAtT(span).fY; | |
237 } | |
238 | 233 |
239 bool activeAngle(int index, int* done, SkTArray<SkOpAngle, true>* angles); | 234 bool activeAngle(int index, int* done, SkTArray<SkOpAngle, true>* angles); |
240 SkPoint activeLeftTop(bool onlySortable, int* firstT) const; | 235 SkPoint activeLeftTop(bool onlySortable, int* firstT) const; |
241 bool activeOp(int index, int endIndex, int xorMiMask, int xorSuMask, SkPathO
p op); | 236 bool activeOp(int index, int endIndex, int xorMiMask, int xorSuMask, SkPathO
p op); |
242 bool activeWinding(int index, int endIndex); | 237 bool activeWinding(int index, int endIndex); |
243 void addCubic(const SkPoint pts[4], bool operand, bool evenOdd); | 238 void addCubic(const SkPoint pts[4], bool operand, bool evenOdd); |
244 void addCurveTo(int start, int end, SkPathWriter* path, bool active) const; | 239 void addCurveTo(int start, int end, SkPathWriter* path, bool active) const; |
245 void addLine(const SkPoint pts[2], bool operand, bool evenOdd); | 240 void addLine(const SkPoint pts[2], bool operand, bool evenOdd); |
246 void addOtherT(int index, double otherT, int otherIndex); | 241 void addOtherT(int index, double otherT, int otherIndex); |
247 void addQuad(const SkPoint pts[3], bool operand, bool evenOdd); | 242 void addQuad(const SkPoint pts[3], bool operand, bool evenOdd); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 const SkPoint& startPt); | 391 const SkPoint& startPt); |
397 static void TrackOutside(SkTArray<SkPoint, true>* outsideTs, const SkPoint&
startPt); | 392 static void TrackOutside(SkTArray<SkPoint, true>* outsideTs, const SkPoint&
startPt); |
398 int updateOppWinding(int index, int endIndex) const; | 393 int updateOppWinding(int index, int endIndex) const; |
399 int updateOppWinding(const SkOpAngle* angle) const; | 394 int updateOppWinding(const SkOpAngle* angle) const; |
400 int updateWinding(int index, int endIndex) const; | 395 int updateWinding(int index, int endIndex) const; |
401 int updateWinding(const SkOpAngle* angle) const; | 396 int updateWinding(const SkOpAngle* angle) const; |
402 int updateWindingReverse(int index, int endIndex) const; | 397 int updateWindingReverse(int index, int endIndex) const; |
403 static bool UseInnerWindingReverse(int outerWinding, int innerWinding); | 398 static bool UseInnerWindingReverse(int outerWinding, int innerWinding); |
404 SkOpSpan* verifyOneWinding(const char* funName, int tIndex); | 399 SkOpSpan* verifyOneWinding(const char* funName, int tIndex); |
405 SkOpSpan* verifyOneWindingU(const char* funName, int tIndex); | 400 SkOpSpan* verifyOneWindingU(const char* funName, int tIndex); |
| 401 |
| 402 SkScalar xAtT(const SkOpSpan* span) const { |
| 403 return xyAtT(span).fX; |
| 404 } |
| 405 |
| 406 SkScalar yAtT(const SkOpSpan* span) const { |
| 407 return xyAtT(span).fY; |
| 408 } |
| 409 |
406 void zeroSpan(SkOpSpan* span); | 410 void zeroSpan(SkOpSpan* span); |
407 | 411 |
408 #if DEBUG_SWAP_TOP | 412 #if DEBUG_SWAP_TOP |
409 bool controlsContainedByEnds(int tStart, int tEnd) const; | 413 bool controlsContainedByEnds(int tStart, int tEnd) const; |
410 #endif | 414 #endif |
411 #if DEBUG_CONCIDENT | 415 #if DEBUG_CONCIDENT |
412 void debugAddTPair(double t, const SkOpSegment& other, double otherT) const
; | 416 void debugAddTPair(double t, const SkOpSegment& other, double otherT) const
; |
413 #endif | 417 #endif |
414 #if DEBUG_MARK_DONE || DEBUG_UNSORTABLE | 418 #if DEBUG_MARK_DONE || DEBUG_UNSORTABLE |
415 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding)
; | 419 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding)
; |
(...skipping 21 matching lines...) Expand all Loading... |
437 SkPath::Verb fVerb; | 441 SkPath::Verb fVerb; |
438 bool fOperand; | 442 bool fOperand; |
439 bool fXor; // set if original contour had even-odd fill | 443 bool fXor; // set if original contour had even-odd fill |
440 bool fOppXor; // set if opposite operand had even-odd fill | 444 bool fOppXor; // set if opposite operand had even-odd fill |
441 #ifdef SK_DEBUG | 445 #ifdef SK_DEBUG |
442 int fID; | 446 int fID; |
443 #endif | 447 #endif |
444 }; | 448 }; |
445 | 449 |
446 #endif | 450 #endif |
OLD | NEW |