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" |
11 #include "SkOpSpan.h" | 11 #include "SkOpSpan.h" |
12 #include "SkPathOpsBounds.h" | 12 #include "SkPathOpsBounds.h" |
13 #include "SkPathOpsCurve.h" | 13 #include "SkPathOpsCurve.h" |
14 #include "SkTArray.h" | 14 #include "SkTArray.h" |
15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
16 | 16 |
17 class SkPathWriter; | 17 class SkPathWriter; |
18 | 18 |
19 class SkOpSegment { | 19 class SkOpSegment { |
20 public: | 20 public: |
21 SkOpSegment() { | 21 SkOpSegment() { |
22 #if DEBUG_DUMP | 22 #ifdef SK_DEBUG |
23 fID = ++gSegmentID; | 23 fID = ++SkPathOpsDebug::gSegmentID; |
24 #endif | 24 #endif |
25 } | 25 } |
26 | 26 |
27 bool operator<(const SkOpSegment& rh) const { | 27 bool operator<(const SkOpSegment& rh) const { |
28 return fBounds.fTop < rh.fBounds.fTop; | 28 return fBounds.fTop < rh.fBounds.fTop; |
29 } | 29 } |
30 | 30 |
31 const SkPathOpsBounds& bounds() const { | 31 const SkPathOpsBounds& bounds() const { |
32 return fBounds; | 32 return fBounds; |
33 } | 33 } |
(...skipping 18 matching lines...) Expand all Loading... |
52 } | 52 } |
53 | 53 |
54 bool done(int min) const { | 54 bool done(int min) const { |
55 return fTs[min].fDone; | 55 return fTs[min].fDone; |
56 } | 56 } |
57 | 57 |
58 bool done(const SkOpAngle* angle) const { | 58 bool done(const SkOpAngle* angle) const { |
59 return done(SkMin32(angle->start(), angle->end())); | 59 return done(SkMin32(angle->start(), angle->end())); |
60 } | 60 } |
61 | 61 |
| 62 // used only by partial coincidence detection |
| 63 SkDPoint dPtAtT(double mid) const { |
| 64 return (*CurveDPointAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, mid); |
| 65 } |
| 66 |
62 SkVector dxdy(int index) const { | 67 SkVector dxdy(int index) const { |
63 return (*CurveSlopeAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, fTs[index].f
T); | 68 return (*CurveSlopeAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, fTs[index].f
T); |
64 } | 69 } |
65 | 70 |
66 SkScalar dy(int index) const { | 71 SkScalar dy(int index) const { |
67 return dxdy(index).fY; | 72 return dxdy(index).fY; |
68 } | 73 } |
69 | 74 |
70 bool intersected() const { | 75 bool intersected() const { |
71 return fTs.count() > 0; | 76 return fTs.count() > 0; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 return yAtT(&fTs[index]); | 232 return yAtT(&fTs[index]); |
228 } | 233 } |
229 | 234 |
230 SkScalar yAtT(const SkOpSpan* span) const { | 235 SkScalar yAtT(const SkOpSpan* span) const { |
231 return xyAtT(span).fY; | 236 return xyAtT(span).fY; |
232 } | 237 } |
233 | 238 |
234 bool activeAngle(int index, int* done, SkTArray<SkOpAngle, true>* angles); | 239 bool activeAngle(int index, int* done, SkTArray<SkOpAngle, true>* angles); |
235 SkPoint activeLeftTop(bool onlySortable, int* firstT) const; | 240 SkPoint activeLeftTop(bool onlySortable, int* firstT) const; |
236 bool activeOp(int index, int endIndex, int xorMiMask, int xorSuMask, SkPathO
p op); | 241 bool activeOp(int index, int endIndex, int xorMiMask, int xorSuMask, SkPathO
p op); |
237 bool activeOp(int xorMiMask, int xorSuMask, int index, int endIndex, SkPathO
p op, | |
238 int* sumMiWinding, int* sumSuWinding, int* maxWinding, int* su
mWinding, | |
239 int* oppMaxWinding, int* oppSumWinding); | |
240 bool activeWinding(int index, int endIndex); | 242 bool activeWinding(int index, int endIndex); |
241 bool activeWinding(int index, int endIndex, int* maxWinding, int* sumWinding
); | |
242 void addCubic(const SkPoint pts[4], bool operand, bool evenOdd); | 243 void addCubic(const SkPoint pts[4], bool operand, bool evenOdd); |
243 void addCurveTo(int start, int end, SkPathWriter* path, bool active) const; | 244 void addCurveTo(int start, int end, SkPathWriter* path, bool active) const; |
244 void addLine(const SkPoint pts[2], bool operand, bool evenOdd); | 245 void addLine(const SkPoint pts[2], bool operand, bool evenOdd); |
245 void addOtherT(int index, double otherT, int otherIndex); | 246 void addOtherT(int index, double otherT, int otherIndex); |
246 void addQuad(const SkPoint pts[3], bool operand, bool evenOdd); | 247 void addQuad(const SkPoint pts[3], bool operand, bool evenOdd); |
247 int addSelfT(SkOpSegment* other, const SkPoint& pt, double newT); | 248 int addSelfT(SkOpSegment* other, const SkPoint& pt, double newT); |
248 int addT(SkOpSegment* other, const SkPoint& pt, double newT); | 249 int addT(SkOpSegment* other, const SkPoint& pt, double newT, bool isNear); |
249 void addTCancel(double startT, double endT, SkOpSegment* other, double oStar
tT, double oEndT); | 250 void addTCancel(const SkPoint& startPt, const SkPoint& endPt, SkOpSegment* o
ther); |
250 void addTCoincident(double startT, double endT, SkOpSegment* other, double o
StartT, | 251 void addTCoincident(const SkPoint& startPt, const SkPoint& endPt, SkOpSegmen
t* other); |
251 double oEndT); | |
252 void addTPair(double t, SkOpSegment* other, double otherT, bool borrowWind,
const SkPoint& pt); | 252 void addTPair(double t, SkOpSegment* other, double otherT, bool borrowWind,
const SkPoint& pt); |
253 void addTPair(double t, SkOpSegment* other, double otherT, bool borrowWind,
const SkPoint& pt, | |
254 const SkPoint& oPt); | |
255 int addUnsortableT(SkOpSegment* other, bool start, const SkPoint& pt, double
newT); | |
256 bool betweenTs(int lesser, double testT, int greater) const; | 253 bool betweenTs(int lesser, double testT, int greater) const; |
257 void checkEnds(); | 254 void checkEnds(); |
258 int computeSum(int startIndex, int endIndex, bool binary); | 255 bool checkSmall(int index) const; |
| 256 void checkTiny(); |
| 257 int computeSum(int startIndex, int endIndex, SkOpAngle::IncludeType includeT
ype, |
| 258 SkTArray<SkOpAngle, true>* angles, SkTArray<SkOpAngle*, true
>* sorted); |
259 int crossedSpanY(const SkPoint& basePt, SkScalar* bestY, double* hitT, bool*
hitSomething, | 259 int crossedSpanY(const SkPoint& basePt, SkScalar* bestY, double* hitT, bool*
hitSomething, |
260 double mid, bool opp, bool current) const; | 260 double mid, bool opp, bool current) const; |
261 SkOpSegment* findNextOp(SkTDArray<SkOpSpan*>* chase, int* nextStart, int* ne
xtEnd, | 261 SkOpSegment* findNextOp(SkTDArray<SkOpSpan*>* chase, int* nextStart, int* ne
xtEnd, |
262 bool* unsortable, SkPathOp op, const int xorMiMask, | 262 bool* unsortable, SkPathOp op, const int xorMiMask, |
263 const int xorSuMask); | 263 const int xorSuMask); |
264 SkOpSegment* findNextWinding(SkTDArray<SkOpSpan*>* chase, int* nextStart, in
t* nextEnd, | 264 SkOpSegment* findNextWinding(SkTDArray<SkOpSpan*>* chase, int* nextStart, in
t* nextEnd, |
265 bool* unsortable); | 265 bool* unsortable); |
266 SkOpSegment* findNextXor(int* nextStart, int* nextEnd, bool* unsortable); | 266 SkOpSegment* findNextXor(int* nextStart, int* nextEnd, bool* unsortable); |
267 void findTooCloseToCall(); | |
268 SkOpSegment* findTop(int* tIndex, int* endIndex, bool* unsortable, bool only
Sortable); | 267 SkOpSegment* findTop(int* tIndex, int* endIndex, bool* unsortable, bool only
Sortable); |
269 void fixOtherTIndex(); | 268 void fixOtherTIndex(); |
270 void initWinding(int start, int end); | 269 void initWinding(int start, int end); |
271 void initWinding(int start, int end, double tHit, int winding, SkScalar hitD
x, int oppWind, | 270 void initWinding(int start, int end, double tHit, int winding, SkScalar hitD
x, int oppWind, |
272 SkScalar hitOppDx); | 271 SkScalar hitOppDx); |
273 bool isLinear(int start, int end) const; | |
274 bool isMissing(double startT) const; | 272 bool isMissing(double startT) const; |
275 bool isSimple(int end) const; | |
276 bool isTiny(const SkOpAngle* angle) const; | 273 bool isTiny(const SkOpAngle* angle) const; |
277 bool isTiny(int index) const; | |
278 SkOpSpan* markAndChaseDoneBinary(int index, int endIndex); | 274 SkOpSpan* markAndChaseDoneBinary(int index, int endIndex); |
279 SkOpSpan* markAndChaseDoneUnary(int index, int endIndex); | 275 SkOpSpan* markAndChaseDoneUnary(int index, int endIndex); |
280 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, int winding, int oppWi
nding); | 276 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, int winding, int oppWi
nding); |
281 SkOpSpan* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, int o
ppSumWinding, | 277 SkOpSpan* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, int o
ppSumWinding, |
282 bool activeAngle, const SkOpAngle* angle); | 278 bool activeAngle, const SkOpAngle* angle); |
283 void markDone(int index, int winding); | 279 void markDone(int index, int winding); |
284 void markDoneBinary(int index); | 280 void markDoneBinary(int index); |
285 void markDoneUnary(int index); | 281 void markDoneUnary(int index); |
286 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding); | |
287 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding, int o
ppWinding); | |
288 void markWinding(int index, int winding); | |
289 void markWinding(int index, int winding, int oppWinding); | |
290 bool nextCandidate(int* start, int* end) const; | 282 bool nextCandidate(int* start, int* end) const; |
291 int nextExactSpan(int from, int step) const; | |
292 int nextSpan(int from, int step) const; | 283 int nextSpan(int from, int step) const; |
293 void setUpWindings(int index, int endIndex, int* sumMiWinding, int* sumSuWin
ding, | 284 void setUpWindings(int index, int endIndex, int* sumMiWinding, int* sumSuWin
ding, |
294 int* maxWinding, int* sumWinding, int* oppMaxWinding, int* oppSumWin
ding); | 285 int* maxWinding, int* sumWinding, int* oppMaxWinding, int* oppSumWin
ding); |
295 enum SortAngleKind { | 286 enum SortAngleKind { |
296 kMustBeOrdered_SortAngleKind, // required for winding calc | 287 kMustBeOrdered_SortAngleKind, // required for winding calc |
297 kMayBeUnordered_SortAngleKind // ok for find top | 288 kMayBeUnordered_SortAngleKind // ok for find top |
298 }; | 289 }; |
299 static bool SortAngles(const SkTArray<SkOpAngle, true>& angles, | 290 static bool SortAngles(const SkTArray<SkOpAngle, true>& angles, // FIXME: r
eplace with |
300 SkTArray<SkOpAngle*, true>* angleList, | 291 SkTArray<SkOpAngle*, true>* angleList, // Sort An
gles 2 |
301 SortAngleKind ); | 292 SortAngleKind ); |
| 293 static bool SortAngles2(const SkTArray<SkOpAngle, true>& angles, |
| 294 SkTArray<SkOpAngle*, true>* angleList); |
302 bool subDivide(int start, int end, SkPoint edge[4]) const; | 295 bool subDivide(int start, int end, SkPoint edge[4]) const; |
303 bool subDivide(int start, int end, SkDCubic* result) const; | 296 bool subDivide(int start, int end, SkDCubic* result) const; |
304 void undoneSpan(int* start, int* end); | 297 void undoneSpan(int* start, int* end); |
305 int updateOppWindingReverse(const SkOpAngle* angle) const; | 298 int updateOppWindingReverse(const SkOpAngle* angle) const; |
306 int updateWindingReverse(const SkOpAngle* angle) const; | 299 int updateWindingReverse(const SkOpAngle* angle) const; |
307 static bool UseInnerWinding(int outerWinding, int innerWinding); | 300 static bool UseInnerWinding(int outerWinding, int innerWinding); |
308 int windingAtT(double tHit, int tIndex, bool crossOpp, SkScalar* dx) const; | 301 int windingAtT(double tHit, int tIndex, bool crossOpp, SkScalar* dx) const; |
309 int windSum(const SkOpAngle* angle) const; | 302 int windSum(const SkOpAngle* angle) const; |
310 int windValue(const SkOpAngle* angle) const; | |
311 | 303 |
312 #if DEBUG_DUMP | 304 #ifdef SK_DEBUG |
313 int debugID() const { | 305 int debugID() const { |
314 return fID; | 306 return fID; |
315 } | 307 } |
316 #endif | 308 #endif |
317 #if DEBUG_ACTIVE_SPANS || DEBUG_ACTIVE_SPANS_FIRST_ONLY | 309 #if DEBUG_ACTIVE_SPANS || DEBUG_ACTIVE_SPANS_FIRST_ONLY |
318 void debugShowActiveSpans() const; | 310 void debugShowActiveSpans() const; |
319 #endif | 311 #endif |
320 #if DEBUG_SORT || DEBUG_SWAP_TOP | 312 #if DEBUG_SORT || DEBUG_SWAP_TOP |
321 void debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true>& angles
, int first, | 313 void debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true>& angles
, int first, |
322 const int contourWinding, const int oppContourWinding, bool sortable
) const; | 314 const int contourWinding, const int oppContourWinding, bool sortable
) const; |
323 void debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true>& angles
, int first, | 315 void debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true>& angles
, int first, |
324 bool sortable); | 316 bool sortable); |
325 #endif | 317 #endif |
326 #if DEBUG_CONCIDENT | 318 #if DEBUG_CONCIDENT |
327 void debugShowTs() const; | 319 void debugShowTs() const; |
328 #endif | 320 #endif |
329 #if DEBUG_SHOW_WINDING | 321 #if DEBUG_SHOW_WINDING |
330 int debugShowWindingValues(int slotCount, int ofInterest) const; | 322 int debugShowWindingValues(int slotCount, int ofInterest) const; |
331 #endif | 323 #endif |
332 | 324 |
333 private: | 325 private: |
| 326 struct MissingSpan { |
| 327 enum Command { |
| 328 kNoAction, |
| 329 kAddMissing, |
| 330 kRemoveNear, |
| 331 kZeroSpan, |
| 332 } fCommand; |
| 333 double fT; |
| 334 double fEndT; |
| 335 SkOpSegment* fSegment; |
| 336 SkOpSegment* fOther; |
| 337 double fOtherT; |
| 338 SkPoint fPt; |
| 339 }; |
| 340 |
334 bool activeAngleOther(int index, int* done, SkTArray<SkOpAngle, true>* angle
s); | 341 bool activeAngleOther(int index, int* done, SkTArray<SkOpAngle, true>* angle
s); |
335 bool activeAngleInner(int index, int* done, SkTArray<SkOpAngle, true>* angle
s); | 342 bool activeAngleInner(int index, int* done, SkTArray<SkOpAngle, true>* angle
s); |
| 343 bool activeOp(int xorMiMask, int xorSuMask, int index, int endIndex, SkPathO
p op, |
| 344 int* sumMiWinding, int* sumSuWinding, int* maxWinding, int* su
mWinding, |
| 345 int* oppMaxWinding, int* oppSumWinding); |
| 346 bool activeWinding(int index, int endIndex, int* maxWinding, int* sumWinding
); |
336 void addAngle(SkTArray<SkOpAngle, true>* angles, int start, int end) const; | 347 void addAngle(SkTArray<SkOpAngle, true>* angles, int start, int end) const; |
337 void addCancelOutsides(double tStart, double oStart, SkOpSegment* other, dou
ble oEnd); | 348 void addCancelOutsides(const SkPoint& startPt, const SkPoint& endPt, SkOpSeg
ment* other); |
338 void addCoinOutsides(const SkTArray<double, true>& outsideTs, SkOpSegment* o
ther, double oEnd); | 349 void addCoinOutsides(const SkPoint& startPt, const SkPoint& endPt, SkOpSegme
nt* other); |
| 350 void addTPair(double t, SkOpSegment* other, double otherT, bool borrowWind,
const SkPoint& pt, |
| 351 const SkPoint& oPt); |
339 void addTwoAngles(int start, int end, SkTArray<SkOpAngle, true>* angles) con
st; | 352 void addTwoAngles(int start, int end, SkTArray<SkOpAngle, true>* angles) con
st; |
340 int advanceCoincidentOther(const SkOpSpan* test, double oEndT, int oIndex); | 353 void adjustMissingNear(const SkPoint& startPt, const SkPoint& endPt, |
341 int advanceCoincidentThis(const SkOpSpan* oTest, bool opp, int index); | 354 SkTArray<MissingSpan, true>* ); |
342 void buildAngles(int index, SkTArray<SkOpAngle, true>* angles, bool includeO
pp) const; | 355 void adjustNear(double startT, const SkPoint& endPt, SkTArray<MissingSpan, t
rue>* ); |
| 356 void adjustOtherNear(double startT, const SkPoint& startPt, const SkPoint& e
ndPt, |
| 357 SkTArray<MissingSpan, true>* ); |
| 358 MissingSpan::Command adjustThisNear(double startT, const SkPoint& startPt, c
onst SkPoint& endPt, |
| 359 SkTArray<MissingSpan, true>* ); |
| 360 int advanceCoincidentOther(double oEndT, int oIndex); |
| 361 int advanceCoincidentThis(int index); |
| 362 bool betweenPoints(double midT, const SkPoint& pt1, const SkPoint& pt2) cons
t; |
| 363 bool buildAngles(int index, SkTArray<SkOpAngle, true>* angles, bool includeO
pp) const; |
343 void buildAnglesInner(int index, SkTArray<SkOpAngle, true>* angles) const; | 364 void buildAnglesInner(int index, SkTArray<SkOpAngle, true>* angles) const; |
344 int bumpCoincidentThis(const SkOpSpan& oTest, bool opp, int index, | 365 void bumpCoincidentThis(const SkOpSpan& oTest, bool binary, int* index, |
345 SkTArray<double, true>* outsideTs); | 366 SkTArray<SkPoint, true>* outsideTs); |
346 int bumpCoincidentOther(const SkOpSpan& test, double oEndT, int& oIndex, | 367 bool bumpCoincident(SkOpSpan* test, bool bigger, bool binary); |
347 SkTArray<double, true>* oOutsideTs); | 368 void bumpCoincidentOther(const SkOpSpan& oTest, int* index, |
| 369 SkTArray<SkPoint, true>* outsideTs); |
348 bool bumpSpan(SkOpSpan* span, int windDelta, int oppDelta); | 370 bool bumpSpan(SkOpSpan* span, int windDelta, int oppDelta); |
349 bool clockwise(int tStart, int tEnd) const; | 371 bool clockwise(int tStart, int tEnd) const; |
350 void decrementSpan(SkOpSpan* span); | 372 static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle, |
351 bool equalPoints(int greaterTIndex, int lesserTIndex); | 373 SkOpAngle::IncludeType ); |
| 374 static void ComputeOneSumReverse(const SkOpAngle* baseAngle, SkOpAngle* next
Angle, |
| 375 SkOpAngle::IncludeType ); |
| 376 bool decrementSpan(SkOpSpan* span); |
352 int findStartingEdge(const SkTArray<SkOpAngle*, true>& sorted, int start, in
t end); | 377 int findStartingEdge(const SkTArray<SkOpAngle*, true>& sorted, int start, in
t end); |
353 void init(const SkPoint pts[], SkPath::Verb verb, bool operand, bool evenOdd
); | 378 void init(const SkPoint pts[], SkPath::Verb verb, bool operand, bool evenOdd
); |
| 379 bool isSimple(int end) const; |
| 380 bool isTiny(int index) const; |
354 void matchWindingValue(int tIndex, double t, bool borrowWind); | 381 void matchWindingValue(int tIndex, double t, bool borrowWind); |
355 SkOpSpan* markAndChaseDone(int index, int endIndex, int winding); | 382 SkOpSpan* markAndChaseDone(int index, int endIndex, int winding); |
356 SkOpSpan* markAndChaseDoneBinary(const SkOpAngle* angle, int winding, int op
pWinding); | 383 SkOpSpan* markAndChaseDoneBinary(const SkOpAngle* angle, int winding, int op
pWinding); |
357 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, const int winding); | 384 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, const int winding); |
358 SkOpSpan* markAndChaseWinding(int index, int endIndex, int winding, int oppW
inding); | 385 SkOpSpan* markAndChaseWinding(int index, int endIndex, int winding, int oppW
inding); |
359 SkOpSpan* markAngle(int maxWinding, int sumWinding, bool activeAngle, const
SkOpAngle* angle); | 386 SkOpSpan* markAngle(int maxWinding, int sumWinding, bool activeAngle, const
SkOpAngle* angle); |
360 void markDoneBinary(int index, int winding, int oppWinding); | 387 void markDoneBinary(int index, int winding, int oppWinding); |
361 SkOpSpan* markAndChaseDoneUnary(const SkOpAngle* angle, int winding); | 388 SkOpSpan* markAndChaseDoneUnary(const SkOpAngle* angle, int winding); |
362 void markOneDone(const char* funName, int tIndex, int winding); | 389 void markOneDone(const char* funName, int tIndex, int winding); |
363 void markOneDoneBinary(const char* funName, int tIndex); | 390 void markOneDoneBinary(const char* funName, int tIndex); |
364 void markOneDoneBinary(const char* funName, int tIndex, int winding, int opp
Winding); | 391 void markOneDoneBinary(const char* funName, int tIndex, int winding, int opp
Winding); |
365 void markOneDoneUnary(const char* funName, int tIndex); | 392 void markOneDoneUnary(const char* funName, int tIndex); |
| 393 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding); |
| 394 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding, int o
ppWinding); |
| 395 void markWinding(int index, int winding); |
| 396 void markWinding(int index, int winding, int oppWinding); |
366 void markUnsortable(int start, int end); | 397 void markUnsortable(int start, int end); |
367 bool monotonicInY(int tStart, int tEnd) const; | 398 bool monotonicInY(int tStart, int tEnd) const; |
| 399 double missingNear(double otherT, const SkOpSegment* other, const SkPoint& s
tartPt, |
| 400 const SkPoint& endPt) const; |
368 bool multipleSpans(int end) const; | 401 bool multipleSpans(int end) const; |
369 SkOpSegment* nextChase(int* index, const int step, int* min, SkOpSpan** last
); | 402 SkOpSegment* nextChase(int* index, const int step, int* min, SkOpSpan** last
); |
| 403 int nextExactSpan(int from, int step) const; |
370 bool serpentine(int tStart, int tEnd) const; | 404 bool serpentine(int tStart, int tEnd) const; |
| 405 void setUpWindings(int index, int endIndex, int* sumMiWinding, |
| 406 int* maxWinding, int* sumWinding); |
371 void subDivideBounds(int start, int end, SkPathOpsBounds* bounds) const; | 407 void subDivideBounds(int start, int end, SkPathOpsBounds* bounds) const; |
372 static void TrackOutside(SkTArray<double, true>* outsideTs, double end, doub
le start); | 408 static void TrackOutsidePair(SkTArray<SkPoint, true>* outsideTs, const SkPoi
nt& endPt, |
| 409 const SkPoint& startPt); |
| 410 static void TrackOutside(SkTArray<SkPoint, true>* outsideTs, const SkPoint&
startPt); |
373 int updateOppWinding(int index, int endIndex) const; | 411 int updateOppWinding(int index, int endIndex) const; |
374 int updateOppWinding(const SkOpAngle* angle) const; | 412 int updateOppWinding(const SkOpAngle* angle) const; |
375 int updateWinding(int index, int endIndex) const; | 413 int updateWinding(int index, int endIndex) const; |
376 int updateWinding(const SkOpAngle* angle) const; | 414 int updateWinding(const SkOpAngle* angle) const; |
| 415 int updateWindingReverse(int index, int endIndex) const; |
| 416 static bool UseInnerWindingReverse(int outerWinding, int innerWinding); |
377 SkOpSpan* verifyOneWinding(const char* funName, int tIndex); | 417 SkOpSpan* verifyOneWinding(const char* funName, int tIndex); |
378 SkOpSpan* verifyOneWindingU(const char* funName, int tIndex); | 418 SkOpSpan* verifyOneWindingU(const char* funName, int tIndex); |
| 419 int windValue(const SkOpAngle* angle) const; |
379 int windValueAt(double t) const; | 420 int windValueAt(double t) const; |
380 void zeroSpan(SkOpSpan* span); | 421 void zeroSpan(SkOpSpan* span); |
381 | 422 |
382 #if DEBUG_SWAP_TOP | 423 #if DEBUG_SWAP_TOP |
383 bool controlsContainedByEnds(int tStart, int tEnd) const; | 424 bool controlsContainedByEnds(int tStart, int tEnd) const; |
384 #endif | 425 #endif |
385 #if DEBUG_CONCIDENT | 426 #if DEBUG_CONCIDENT |
386 void debugAddTPair(double t, const SkOpSegment& other, double otherT) const
; | 427 void debugAddTPair(double t, const SkOpSegment& other, double otherT) const
; |
387 #endif | 428 #endif |
388 #if DEBUG_MARK_DONE || DEBUG_UNSORTABLE | 429 #if DEBUG_MARK_DONE || DEBUG_UNSORTABLE |
389 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding)
; | 430 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding)
; |
390 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding,
int oppWinding); | 431 void debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding,
int oppWinding); |
391 #endif | 432 #endif |
392 #if DEBUG_WINDING | 433 #if DEBUG_WINDING |
393 static char as_digit(int value) { | 434 static char as_digit(int value) { |
394 return value < 0 ? '?' : value <= 9 ? '0' + value : '+'; | 435 return value < 0 ? '?' : value <= 9 ? '0' + value : '+'; |
395 } | 436 } |
396 #endif | 437 #endif |
397 void debugValidate() const; | 438 void debugValidate() const; |
| 439 #ifdef SK_DEBUG |
| 440 void dumpPts() const; |
| 441 void dumpDPts() const; |
| 442 void dumpSpans() const; |
| 443 #endif |
398 | 444 |
399 const SkPoint* fPts; | 445 const SkPoint* fPts; |
400 SkPathOpsBounds fBounds; | 446 SkPathOpsBounds fBounds; |
401 // FIXME: can't convert to SkTArray because it uses insert | 447 // FIXME: can't convert to SkTArray because it uses insert |
402 SkTDArray<SkOpSpan> fTs; // two or more (always includes t=0 t=1) | 448 SkTDArray<SkOpSpan> fTs; // two or more (always includes t=0 t=1) |
403 // OPTIMIZATION: could pack donespans, verb, operand, xor into 1 int-sized v
alue | 449 // OPTIMIZATION: could pack donespans, verb, operand, xor into 1 int-sized v
alue |
404 int fDoneSpans; // quick check that segment is finished | 450 int fDoneSpans; // quick check that segment is finished |
405 // OPTIMIZATION: force the following to be byte-sized | 451 // OPTIMIZATION: force the following to be byte-sized |
406 SkPath::Verb fVerb; | 452 SkPath::Verb fVerb; |
407 bool fOperand; | 453 bool fOperand; |
408 bool fXor; // set if original contour had even-odd fill | 454 bool fXor; // set if original contour had even-odd fill |
409 bool fOppXor; // set if opposite operand had even-odd fill | 455 bool fOppXor; // set if opposite operand had even-odd fill |
410 #if DEBUG_DUMP | 456 #ifdef SK_DEBUG |
411 int fID; | 457 int fID; |
412 #endif | 458 #endif |
413 }; | 459 }; |
414 | 460 |
415 #endif | 461 #endif |
OLD | NEW |