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 #if defined(SK_DEBUG) || !FORCE_RELEASE | 17 #if defined(SK_DEBUG) || !FORCE_RELEASE |
18 #include "SkThread.h" | 18 #include "SkThread.h" |
19 #endif | 19 #endif |
20 | 20 |
| 21 struct SkCoincidence; |
21 class SkPathWriter; | 22 class SkPathWriter; |
22 | 23 |
23 class SkOpSegment { | 24 class SkOpSegment { |
24 public: | 25 public: |
25 SkOpSegment() { | 26 SkOpSegment() { |
26 #if defined(SK_DEBUG) || !FORCE_RELEASE | 27 #if defined(SK_DEBUG) || !FORCE_RELEASE |
27 fID = sk_atomic_inc(&SkPathOpsDebug::gSegmentID); | 28 fID = sk_atomic_inc(&SkPathOpsDebug::gSegmentID); |
28 #endif | 29 #endif |
29 } | 30 } |
30 | 31 |
31 bool operator<(const SkOpSegment& rh) const { | 32 bool operator<(const SkOpSegment& rh) const { |
32 return fBounds.fTop < rh.fBounds.fTop; | 33 return fBounds.fTop < rh.fBounds.fTop; |
33 } | 34 } |
34 | 35 |
35 // FIXME: add some template or macro to avoid casting | 36 struct AlignedSpan { |
36 SkOpAngle& angle(int index) { | 37 double fOldT; |
37 const SkOpAngle& cAngle = (const_cast<const SkOpSegment*>(this))->angle(
index); | 38 double fT; |
38 return const_cast<SkOpAngle&>(cAngle); | 39 SkPoint fOldPt; |
39 } | 40 SkPoint fPt; |
| 41 const SkOpSegment* fSegment; |
| 42 const SkOpSegment* fOther1; |
| 43 const SkOpSegment* fOther2; |
| 44 }; |
40 | 45 |
41 const SkPathOpsBounds& bounds() const { | 46 const SkPathOpsBounds& bounds() const { |
42 return fBounds; | 47 return fBounds; |
43 } | 48 } |
44 | 49 |
45 // OPTIMIZE | 50 // OPTIMIZE |
46 // when the edges are initially walked, they don't automatically get the pri
or and next | 51 // when the edges are initially walked, they don't automatically get the pri
or and next |
47 // edges assigned to positions t=0 and t=1. Doing that would remove the need
for this check, | 52 // edges assigned to positions t=0 and t=1. Doing that would remove the need
for this check, |
48 // and would additionally remove the need for similar checks in condition ed
ges. It would | 53 // and would additionally remove the need for similar checks in condition ed
ges. It would |
49 // also allow intersection code to assume end of segment intersections (mayb
e?) | 54 // also allow intersection code to assume end of segment intersections (mayb
e?) |
(...skipping 24 matching lines...) Expand all Loading... |
74 } | 79 } |
75 | 80 |
76 SkVector dxdy(int index) const { | 81 SkVector dxdy(int index) const { |
77 return (*CurveSlopeAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, fTs[index].f
T); | 82 return (*CurveSlopeAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, fTs[index].f
T); |
78 } | 83 } |
79 | 84 |
80 SkScalar dy(int index) const { | 85 SkScalar dy(int index) const { |
81 return dxdy(index).fY; | 86 return dxdy(index).fY; |
82 } | 87 } |
83 | 88 |
| 89 bool hasMultiples() const { |
| 90 return fMultiples; |
| 91 } |
| 92 |
84 bool hasSmall() const { | 93 bool hasSmall() const { |
85 return fSmall; | 94 return fSmall; |
86 } | 95 } |
87 | 96 |
88 bool hasTiny() const { | 97 bool hasTiny() const { |
89 return fTiny; | 98 return fTiny; |
90 } | 99 } |
91 | 100 |
92 bool intersected() const { | 101 bool intersected() const { |
93 return fTs.count() > 0; | 102 return fTs.count() > 0; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 *sumWinding -= deltaSum; | 187 *sumWinding -= deltaSum; |
179 } | 188 } |
180 | 189 |
181 const SkOpSpan& span(int tIndex) const { | 190 const SkOpSpan& span(int tIndex) const { |
182 return fTs[tIndex]; | 191 return fTs[tIndex]; |
183 } | 192 } |
184 | 193 |
185 const SkOpAngle* spanToAngle(int tStart, int tEnd) const { | 194 const SkOpAngle* spanToAngle(int tStart, int tEnd) const { |
186 SkASSERT(tStart != tEnd); | 195 SkASSERT(tStart != tEnd); |
187 const SkOpSpan& span = fTs[tStart]; | 196 const SkOpSpan& span = fTs[tStart]; |
188 int index = tStart < tEnd ? span.fToAngleIndex : span.fFromAngleIndex; | 197 return tStart < tEnd ? span.fToAngle : span.fFromAngle; |
189 return index >= 0 ? &angle(index) : NULL; | |
190 } | 198 } |
191 | 199 |
192 // FIXME: create some sort of macro or template that avoids casting | 200 // FIXME: create some sort of macro or template that avoids casting |
193 SkOpAngle* spanToAngle(int tStart, int tEnd) { | 201 SkOpAngle* spanToAngle(int tStart, int tEnd) { |
194 const SkOpAngle* cAngle = (const_cast<const SkOpSegment*>(this))->spanTo
Angle(tStart, tEnd); | 202 const SkOpAngle* cAngle = (const_cast<const SkOpSegment*>(this))->spanTo
Angle(tStart, tEnd); |
195 return const_cast<SkOpAngle*>(cAngle); | 203 return const_cast<SkOpAngle*>(cAngle); |
196 } | 204 } |
197 | 205 |
198 int spanSign(const SkOpAngle* angle) const { | 206 int spanSign(const SkOpAngle* angle) const { |
199 SkASSERT(angle->segment() == this); | 207 SkASSERT(angle->segment() == this); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 void addQuad(const SkPoint pts[3], bool operand, bool evenOdd); | 279 void addQuad(const SkPoint pts[3], bool operand, bool evenOdd); |
272 void addSimpleAngle(int endIndex); | 280 void addSimpleAngle(int endIndex); |
273 int addSelfT(const SkPoint& pt, double newT); | 281 int addSelfT(const SkPoint& pt, double newT); |
274 void addStartSpan(int endIndex); | 282 void addStartSpan(int endIndex); |
275 int addT(SkOpSegment* other, const SkPoint& pt, double newT); | 283 int addT(SkOpSegment* other, const SkPoint& pt, double newT); |
276 void addTCancel(const SkPoint& startPt, const SkPoint& endPt, SkOpSegment* o
ther); | 284 void addTCancel(const SkPoint& startPt, const SkPoint& endPt, SkOpSegment* o
ther); |
277 void addTCoincident(const SkPoint& startPt, const SkPoint& endPt, double end
T, | 285 void addTCoincident(const SkPoint& startPt, const SkPoint& endPt, double end
T, |
278 SkOpSegment* other); | 286 SkOpSegment* other); |
279 const SkOpSpan* addTPair(double t, SkOpSegment* other, double otherT, bool b
orrowWind, | 287 const SkOpSpan* addTPair(double t, SkOpSegment* other, double otherT, bool b
orrowWind, |
280 const SkPoint& pt); | 288 const SkPoint& pt); |
| 289 const SkOpSpan* addTPair(double t, SkOpSegment* other, double otherT, bool b
orrowWind, |
| 290 const SkPoint& pt, const SkPoint& oPt); |
| 291 void alignMultiples(SkTDArray<AlignedSpan>* aligned); |
281 bool alignSpan(int index, double thisT, const SkPoint& thisPt); | 292 bool alignSpan(int index, double thisT, const SkPoint& thisPt); |
282 void alignSpanState(int start, int end); | 293 void alignSpanState(int start, int end); |
283 const SkOpAngle& angle(int index) const; | |
284 bool betweenTs(int lesser, double testT, int greater) const; | 294 bool betweenTs(int lesser, double testT, int greater) const; |
| 295 void blindCancel(const SkCoincidence& coincidence, SkOpSegment* other); |
| 296 void blindCoincident(const SkCoincidence& coincidence, SkOpSegment* other); |
285 bool calcAngles(); | 297 bool calcAngles(); |
| 298 double calcMissingTEnd(const SkOpSegment* ref, double loEnd, double min, dou
ble max, |
| 299 double hiEnd, const SkOpSegment* other, int thisEnd); |
| 300 double calcMissingTStart(const SkOpSegment* ref, double loEnd, double min, d
ouble max, |
| 301 double hiEnd, const SkOpSegment* other, int thisEnd
); |
286 void checkDuplicates(); | 302 void checkDuplicates(); |
287 void checkEnds(); | 303 void checkEnds(); |
288 void checkMultiples(); | 304 void checkMultiples(); |
289 void checkSmall(); | 305 void checkSmall(); |
290 bool checkSmall(int index) const; | 306 bool checkSmall(int index) const; |
291 void checkTiny(); | 307 void checkTiny(); |
292 int computeSum(int startIndex, int endIndex, SkOpAngle::IncludeType includeT
ype); | 308 int computeSum(int startIndex, int endIndex, SkOpAngle::IncludeType includeT
ype); |
293 bool containsPt(const SkPoint& , int index, int endIndex) const; | 309 bool containsPt(const SkPoint& , int index, int endIndex) const; |
294 int crossedSpanY(const SkPoint& basePt, SkScalar* bestY, double* hitT, bool*
hitSomething, | 310 int crossedSpanY(const SkPoint& basePt, SkScalar* bestY, double* hitT, bool*
hitSomething, |
295 double mid, bool opp, bool current) const; | 311 double mid, bool opp, bool current) const; |
296 bool findCoincidentMatch(const SkOpSpan* span, const SkOpSegment* other, int
oStart, int oEnd, | 312 bool findCoincidentMatch(const SkOpSpan* span, const SkOpSegment* other, int
oStart, int oEnd, |
297 int step, SkPoint* startPt, SkPoint* endPt, double*
endT) const; | 313 int step, SkPoint* startPt, SkPoint* endPt, double*
endT) const; |
298 SkOpSegment* findNextOp(SkTDArray<SkOpSpan*>* chase, int* nextStart, int* ne
xtEnd, | 314 SkOpSegment* findNextOp(SkTDArray<SkOpSpan*>* chase, int* nextStart, int* ne
xtEnd, |
299 bool* unsortable, SkPathOp op, int xorMiMask, int xo
rSuMask); | 315 bool* unsortable, SkPathOp op, int xorMiMask, int xo
rSuMask); |
300 SkOpSegment* findNextWinding(SkTDArray<SkOpSpan*>* chase, int* nextStart, in
t* nextEnd, | 316 SkOpSegment* findNextWinding(SkTDArray<SkOpSpan*>* chase, int* nextStart, in
t* nextEnd, |
301 bool* unsortable); | 317 bool* unsortable); |
302 SkOpSegment* findNextXor(int* nextStart, int* nextEnd, bool* unsortable); | 318 SkOpSegment* findNextXor(int* nextStart, int* nextEnd, bool* unsortable); |
303 int findExactT(double t, const SkOpSegment* ) const; | 319 int findExactT(double t, const SkOpSegment* ) const; |
| 320 int findOtherT(double t, const SkOpSegment* ) const; |
304 int findT(double t, const SkPoint& , const SkOpSegment* ) const; | 321 int findT(double t, const SkPoint& , const SkOpSegment* ) const; |
305 SkOpSegment* findTop(int* tIndex, int* endIndex, bool* unsortable, bool firs
tPass); | 322 SkOpSegment* findTop(int* tIndex, int* endIndex, bool* unsortable, bool firs
tPass); |
306 void fixOtherTIndex(); | 323 void fixOtherTIndex(); |
307 void initWinding(int start, int end, SkOpAngle::IncludeType angleIncludeType
); | 324 void initWinding(int start, int end, SkOpAngle::IncludeType angleIncludeType
); |
308 void initWinding(int start, int end, double tHit, int winding, SkScalar hitD
x, int oppWind, | 325 void initWinding(int start, int end, double tHit, int winding, SkScalar hitD
x, int oppWind, |
309 SkScalar hitOppDx); | 326 SkScalar hitOppDx); |
310 bool isMissing(double startT, const SkPoint& pt) const; | 327 bool isMissing(double startT, const SkPoint& pt) const; |
311 bool isTiny(const SkOpAngle* angle) const; | 328 bool isTiny(const SkOpAngle* angle) const; |
312 bool joinCoincidence(SkOpSegment* other, double otherT, const SkPoint& other
Pt, int step, | 329 bool joinCoincidence(SkOpSegment* other, double otherT, const SkPoint& other
Pt, int step, |
313 bool cancel); | 330 bool cancel); |
314 SkOpSpan* markAndChaseDoneBinary(int index, int endIndex); | 331 SkOpSpan* markAndChaseDoneBinary(int index, int endIndex); |
315 SkOpSpan* markAndChaseDoneUnary(int index, int endIndex); | 332 SkOpSpan* markAndChaseDoneUnary(int index, int endIndex); |
316 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, int winding, int oppWi
nding); | 333 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, int winding, int oppWi
nding); |
317 SkOpSpan* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, int o
ppSumWinding, | 334 SkOpSpan* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, int o
ppSumWinding, |
318 const SkOpAngle* angle); | 335 const SkOpAngle* angle); |
319 void markDone(int index, int winding); | 336 void markDone(int index, int winding); |
320 void markDoneBinary(int index); | 337 void markDoneBinary(int index); |
321 void markDoneUnary(int index); | 338 void markDoneUnary(int index); |
322 bool nextCandidate(int* start, int* end) const; | 339 bool nextCandidate(int* start, int* end) const; |
323 int nextSpan(int from, int step) const; | 340 int nextSpan(int from, int step) const; |
| 341 void pinT(const SkPoint& pt, double* t); |
324 void setUpWindings(int index, int endIndex, int* sumMiWinding, int* sumSuWin
ding, | 342 void setUpWindings(int index, int endIndex, int* sumMiWinding, int* sumSuWin
ding, |
325 int* maxWinding, int* sumWinding, int* oppMaxWinding, int* oppSumWin
ding); | 343 int* maxWinding, int* sumWinding, int* oppMaxWinding, int* oppSumWin
ding); |
326 void sortAngles(); | 344 void sortAngles(); |
327 bool subDivide(int start, int end, SkPoint edge[4]) const; | 345 bool subDivide(int start, int end, SkPoint edge[4]) const; |
328 bool subDivide(int start, int end, SkDCubic* result) const; | 346 bool subDivide(int start, int end, SkDCubic* result) const; |
329 void undoneSpan(int* start, int* end); | 347 void undoneSpan(int* start, int* end); |
330 int updateOppWindingReverse(const SkOpAngle* angle) const; | 348 int updateOppWindingReverse(const SkOpAngle* angle) const; |
331 int updateWindingReverse(const SkOpAngle* angle) const; | 349 int updateWindingReverse(const SkOpAngle* angle) const; |
332 static bool UseInnerWinding(int outerWinding, int innerWinding); | 350 static bool UseInnerWinding(int outerWinding, int innerWinding); |
333 static bool UseInnerWindingReverse(int outerWinding, int innerWinding); | 351 static bool UseInnerWindingReverse(int outerWinding, int innerWinding); |
334 int windingAtT(double tHit, int tIndex, bool crossOpp, SkScalar* dx) const; | 352 int windingAtT(double tHit, int tIndex, bool crossOpp, SkScalar* dx) const; |
335 int windSum(const SkOpAngle* angle) const; | 353 int windSum(const SkOpAngle* angle) const; |
336 // available for testing only | 354 // available for testing only |
337 #if DEBUG_VALIDATE | |
338 bool debugContains(const SkOpAngle* ) const; | |
339 #endif | |
340 #if defined(SK_DEBUG) || !FORCE_RELEASE | 355 #if defined(SK_DEBUG) || !FORCE_RELEASE |
341 int debugID() const { | 356 int debugID() const { |
342 return fID; | 357 return fID; |
343 } | 358 } |
344 #else | 359 #else |
345 int debugID() const { | 360 int debugID() const { |
346 return -1; | 361 return -1; |
347 } | 362 } |
348 #endif | 363 #endif |
349 #if DEBUG_ACTIVE_SPANS || DEBUG_ACTIVE_SPANS_FIRST_ONLY | 364 #if DEBUG_ACTIVE_SPANS || DEBUG_ACTIVE_SPANS_FIRST_ONLY |
350 void debugShowActiveSpans() const; | 365 void debugShowActiveSpans() const; |
351 #endif | 366 #endif |
352 #if DEBUG_CONCIDENT | 367 #if DEBUG_CONCIDENT |
353 void debugShowTs(const char* prefix) const; | 368 void debugShowTs(const char* prefix) const; |
354 #endif | 369 #endif |
355 #if DEBUG_SHOW_WINDING | 370 #if DEBUG_SHOW_WINDING |
356 int debugShowWindingValues(int slotCount, int ofInterest) const; | 371 int debugShowWindingValues(int slotCount, int ofInterest) const; |
357 #endif | 372 #endif |
358 const SkTDArray<SkOpSpan>& debugSpans() const; | 373 const SkTDArray<SkOpSpan>& debugSpans() const; |
359 void debugValidate() const; | 374 void debugValidate() const; |
360 // available to testing only | 375 // available to testing only |
| 376 const SkOpAngle* debugLastAngle() const; |
361 void dumpAngles() const; | 377 void dumpAngles() const; |
362 void dumpContour(int firstID, int lastID) const; | 378 void dumpContour(int firstID, int lastID) const; |
363 void dumpPts() const; | 379 void dumpPts() const; |
364 void dumpSpans() const; | 380 void dumpSpans() const; |
365 | 381 |
366 private: | 382 private: |
367 struct MissingSpan { | 383 struct MissingSpan { |
368 double fT; | 384 double fT; |
369 double fEndT; | 385 double fEndT; |
370 SkOpSegment* fSegment; | 386 SkOpSegment* fSegment; |
371 SkOpSegment* fOther; | 387 SkOpSegment* fOther; |
372 double fOtherT; | 388 double fOtherT; |
373 SkPoint fPt; | 389 SkPoint fPt; |
374 }; | 390 }; |
375 | 391 |
376 const SkOpAngle* activeAngleInner(int index, int* start, int* end, bool* don
e, | 392 const SkOpAngle* activeAngleInner(int index, int* start, int* end, bool* don
e, |
377 bool* sortable) const; | 393 bool* sortable) const; |
378 const SkOpAngle* activeAngleOther(int index, int* start, int* end, bool* don
e, | 394 const SkOpAngle* activeAngleOther(int index, int* start, int* end, bool* don
e, |
379 bool* sortable) const; | 395 bool* sortable) const; |
380 bool activeOp(int xorMiMask, int xorSuMask, int index, int endIndex, SkPathO
p op, | 396 bool activeOp(int xorMiMask, int xorSuMask, int index, int endIndex, SkPathO
p op, |
381 int* sumMiWinding, int* sumSuWinding); | 397 int* sumMiWinding, int* sumSuWinding); |
382 bool activeWinding(int index, int endIndex, int* sumWinding); | 398 bool activeWinding(int index, int endIndex, int* sumWinding); |
383 void addCancelOutsides(const SkPoint& startPt, const SkPoint& endPt, SkOpSeg
ment* other); | 399 void addCancelOutsides(const SkPoint& startPt, const SkPoint& endPt, SkOpSeg
ment* other); |
384 void addCoinOutsides(const SkPoint& startPt, const SkPoint& endPt, SkOpSegme
nt* other); | 400 void addCoinOutsides(const SkPoint& startPt, const SkPoint& endPt, SkOpSegme
nt* other); |
385 int addSingletonAngleDown(int start, SkOpSegment** otherPtr); | 401 SkOpAngle* addSingletonAngleDown(SkOpSegment** otherPtr, SkOpAngle** ); |
386 int addSingletonAngleUp(int start, SkOpSegment** otherPtr); | 402 SkOpAngle* addSingletonAngleUp(SkOpSegment** otherPtr, SkOpAngle** ); |
387 SkOpAngle* addSingletonAngles(int start, int step); | 403 SkOpAngle* addSingletonAngles(int step); |
388 void addTPair(double t, SkOpSegment* other, double otherT, bool borrowWind,
const SkPoint& pt, | 404 void alignSpan(const SkPoint& newPt, double newT, const SkOpSegment* other,
double otherT, |
389 const SkPoint& oPt); | 405 const SkOpSegment* other2, SkOpSpan* oSpan, SkTDArray<Aligned
Span>* ); |
390 bool betweenPoints(double midT, const SkPoint& pt1, const SkPoint& pt2) cons
t; | 406 bool betweenPoints(double midT, const SkPoint& pt1, const SkPoint& pt2) cons
t; |
| 407 void bumpCoincidentBlind(bool binary, int index, int last); |
391 void bumpCoincidentThis(const SkOpSpan& oTest, bool binary, int* index, | 408 void bumpCoincidentThis(const SkOpSpan& oTest, bool binary, int* index, |
392 SkTArray<SkPoint, true>* outsideTs); | 409 SkTArray<SkPoint, true>* outsideTs); |
| 410 void bumpCoincidentOBlind(int index, int last); |
393 void bumpCoincidentOther(const SkOpSpan& oTest, int* index, | 411 void bumpCoincidentOther(const SkOpSpan& oTest, int* index, |
394 SkTArray<SkPoint, true>* outsideTs); | 412 SkTArray<SkPoint, true>* outsideTs); |
395 bool bumpSpan(SkOpSpan* span, int windDelta, int oppDelta); | 413 bool bumpSpan(SkOpSpan* span, int windDelta, int oppDelta); |
396 bool calcLoopSpanCount(const SkOpSpan& thisSpan, int* smallCounts); | 414 bool calcLoopSpanCount(const SkOpSpan& thisSpan, int* smallCounts); |
| 415 bool checkForSmall(const SkOpSpan* span, const SkPoint& pt, double newT, |
| 416 int* less, int* more) const; |
397 void checkLinks(const SkOpSpan* , | 417 void checkLinks(const SkOpSpan* , |
398 SkTArray<MissingSpan, true>* missingSpans) const; | 418 SkTArray<MissingSpan, true>* missingSpans) const; |
399 static void CheckOneLink(const SkOpSpan* test, const SkOpSpan* oSpan, | 419 static void CheckOneLink(const SkOpSpan* test, const SkOpSpan* oSpan, |
400 const SkOpSpan* oFirst, const SkOpSpan* oLast, | 420 const SkOpSpan* oFirst, const SkOpSpan* oLast, |
401 const SkOpSpan** missingPtr, | 421 const SkOpSpan** missingPtr, |
402 SkTArray<MissingSpan, true>* missingSpans); | 422 SkTArray<MissingSpan, true>* missingSpans); |
403 int checkSetAngle(int tIndex) const; | 423 int checkSetAngle(int tIndex) const; |
404 void checkSmallCoincidence(const SkOpSpan& span, SkTArray<MissingSpan, true>
* ); | 424 void checkSmallCoincidence(const SkOpSpan& span, SkTArray<MissingSpan, true>
* ); |
| 425 bool coincidentSmall(const SkPoint& pt, double t, const SkOpSegment* other)
const; |
405 bool clockwise(int tStart, int tEnd) const; | 426 bool clockwise(int tStart, int tEnd) const; |
406 static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle, | 427 static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle, |
407 SkOpAngle::IncludeType ); | 428 SkOpAngle::IncludeType ); |
408 static void ComputeOneSumReverse(const SkOpAngle* baseAngle, SkOpAngle* next
Angle, | 429 static void ComputeOneSumReverse(const SkOpAngle* baseAngle, SkOpAngle* next
Angle, |
409 SkOpAngle::IncludeType ); | 430 SkOpAngle::IncludeType ); |
| 431 bool containsT(double t, const SkOpSegment* other, double otherT) const; |
410 bool decrementSpan(SkOpSpan* span); | 432 bool decrementSpan(SkOpSpan* span); |
411 int findEndSpan(int endIndex) const; | 433 int findEndSpan(int endIndex) const; |
412 int findStartSpan(int startIndex) const; | 434 int findStartSpan(int startIndex) const; |
413 int firstActive(int tIndex) const; | 435 int firstActive(int tIndex) const; |
414 const SkOpSpan& firstSpan(const SkOpSpan& thisSpan) const; | 436 const SkOpSpan& firstSpan(const SkOpSpan& thisSpan) const; |
415 void init(const SkPoint pts[], SkPath::Verb verb, bool operand, bool evenOdd
); | 437 void init(const SkPoint pts[], SkPath::Verb verb, bool operand, bool evenOdd
); |
| 438 bool inCoincidentSpan(double t, const SkOpSegment* other) const; |
416 bool inLoop(const SkOpAngle* baseAngle, int spanCount, int* indexPtr) const; | 439 bool inLoop(const SkOpAngle* baseAngle, int spanCount, int* indexPtr) const; |
| 440 #if OLD_CHASE |
417 bool isSimple(int end) const; | 441 bool isSimple(int end) const; |
| 442 #else |
| 443 SkOpSegment* isSimple(int* end, int* step); |
| 444 #endif |
418 bool isTiny(int index) const; | 445 bool isTiny(int index) const; |
419 const SkOpSpan& lastSpan(const SkOpSpan& thisSpan) const; | 446 const SkOpSpan& lastSpan(const SkOpSpan& thisSpan) const; |
420 void matchWindingValue(int tIndex, double t, bool borrowWind); | 447 void matchWindingValue(int tIndex, double t, bool borrowWind); |
421 SkOpSpan* markAndChaseDone(int index, int endIndex, int winding); | 448 SkOpSpan* markAndChaseDone(int index, int endIndex, int winding); |
422 SkOpSpan* markAndChaseDoneBinary(const SkOpAngle* angle, int winding, int op
pWinding); | 449 SkOpSpan* markAndChaseDoneBinary(const SkOpAngle* angle, int winding, int op
pWinding); |
423 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, int winding); | 450 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, int winding); |
424 SkOpSpan* markAndChaseWinding(int index, int endIndex, int winding); | 451 SkOpSpan* markAndChaseWinding(int index, int endIndex, int winding); |
425 SkOpSpan* markAndChaseWinding(int index, int endIndex, int winding, int oppW
inding); | 452 SkOpSpan* markAndChaseWinding(int index, int endIndex, int winding, int oppW
inding); |
426 SkOpSpan* markAngle(int maxWinding, int sumWinding, const SkOpAngle* angle); | 453 SkOpSpan* markAngle(int maxWinding, int sumWinding, const SkOpAngle* angle); |
427 void markDoneBinary(int index, int winding, int oppWinding); | 454 void markDoneBinary(int index, int winding, int oppWinding); |
428 SkOpSpan* markAndChaseDoneUnary(const SkOpAngle* angle, int winding); | 455 SkOpSpan* markAndChaseDoneUnary(const SkOpAngle* angle, int winding); |
429 void markOneDone(const char* funName, int tIndex, int winding); | 456 void markOneDone(const char* funName, int tIndex, int winding); |
430 void markOneDoneBinary(const char* funName, int tIndex); | 457 void markOneDoneBinary(const char* funName, int tIndex); |
431 void markOneDoneBinary(const char* funName, int tIndex, int winding, int opp
Winding); | 458 void markOneDoneBinary(const char* funName, int tIndex, int winding, int opp
Winding); |
432 void markOneDoneUnary(const char* funName, int tIndex); | 459 void markOneDoneUnary(const char* funName, int tIndex); |
433 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding); | 460 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding); |
434 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding, int o
ppWinding); | 461 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding, int o
ppWinding); |
435 void markWinding(int index, int winding); | 462 void markWinding(int index, int winding); |
436 void markWinding(int index, int winding, int oppWinding); | 463 void markWinding(int index, int winding, int oppWinding); |
437 bool monotonicInY(int tStart, int tEnd) const; | 464 bool monotonicInY(int tStart, int tEnd) const; |
438 | 465 |
439 bool multipleEnds() const { | 466 bool multipleEnds() const { return fTs[count() - 2].fT == 1; } |
440 return fTs[count() - 2].fT == 1; | 467 bool multipleStarts() const { return fTs[1].fT == 0; } |
441 } | |
442 | 468 |
443 bool multipleStarts() const { | 469 SkOpSegment* nextChase(int* index, int* step, int* min, SkOpSpan** last); |
444 return fTs[1].fT == 0; | |
445 } | |
446 | |
447 bool multipleSpans(int end) const; | |
448 SkOpSegment* nextChase(int* index, const int step, int* min, SkOpSpan** last
); | |
449 int nextExactSpan(int from, int step) const; | 470 int nextExactSpan(int from, int step) const; |
450 bool serpentine(int tStart, int tEnd) const; | 471 bool serpentine(int tStart, int tEnd) const; |
451 void setFromAngleIndex(int endIndex, int angleIndex); | 472 void setCoincidentRange(const SkPoint& startPt, const SkPoint& endPt, SkOpS
egment* other); |
452 void setToAngleIndex(int endIndex, int angleIndex); | 473 void setFromAngle(int endIndex, SkOpAngle* ); |
| 474 void setToAngle(int endIndex, SkOpAngle* ); |
453 void setUpWindings(int index, int endIndex, int* sumMiWinding, | 475 void setUpWindings(int index, int endIndex, int* sumMiWinding, |
454 int* maxWinding, int* sumWinding); | 476 int* maxWinding, int* sumWinding); |
455 void subDivideBounds(int start, int end, SkPathOpsBounds* bounds) const; | 477 void subDivideBounds(int start, int end, SkPathOpsBounds* bounds) const; |
456 static void TrackOutsidePair(SkTArray<SkPoint, true>* outsideTs, const SkPoi
nt& endPt, | 478 static void TrackOutsidePair(SkTArray<SkPoint, true>* outsideTs, const SkPoi
nt& endPt, |
457 const SkPoint& startPt); | 479 const SkPoint& startPt); |
458 static void TrackOutside(SkTArray<SkPoint, true>* outsideTs, const SkPoint&
startPt); | 480 static void TrackOutside(SkTArray<SkPoint, true>* outsideTs, const SkPoint&
startPt); |
459 int updateOppWinding(int index, int endIndex) const; | 481 int updateOppWinding(int index, int endIndex) const; |
460 int updateOppWinding(const SkOpAngle* angle) const; | 482 int updateOppWinding(const SkOpAngle* angle) const; |
461 int updateWinding(int index, int endIndex) const; | 483 int updateWinding(int index, int endIndex) const; |
462 int updateWinding(const SkOpAngle* angle) const; | 484 int updateWinding(const SkOpAngle* angle) const; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 void debugConstructLine(SkPoint shortQuad[2]); | 524 void debugConstructLine(SkPoint shortQuad[2]); |
503 void debugConstructQuad(SkPoint shortQuad[3]); | 525 void debugConstructQuad(SkPoint shortQuad[3]); |
504 void debugReset(); | 526 void debugReset(); |
505 void dumpDPts() const; | 527 void dumpDPts() const; |
506 void dumpSpan(int index) const; | 528 void dumpSpan(int index) const; |
507 | 529 |
508 const SkPoint* fPts; | 530 const SkPoint* fPts; |
509 SkPathOpsBounds fBounds; | 531 SkPathOpsBounds fBounds; |
510 // FIXME: can't convert to SkTArray because it uses insert | 532 // FIXME: can't convert to SkTArray because it uses insert |
511 SkTDArray<SkOpSpan> fTs; // 2+ (always includes t=0 t=1) -- at least (numbe
r of spans) + 1 | 533 SkTDArray<SkOpSpan> fTs; // 2+ (always includes t=0 t=1) -- at least (numbe
r of spans) + 1 |
512 // FIXME: replace both with bucket storage that allows direct immovable pointers
to angles | 534 SkOpAngleSet fAngles; // empty or 2+ -- (number of non-zero spans) * 2 |
513 SkTArray<SkOpAngle, true> fSingletonAngles; // 0 or 2 -- allocated for sing
letons | |
514 SkTArray<SkOpAngle, true> fAngles; // 0 or 2+ -- (number of non-zero spans)
* 2 | |
515 // OPTIMIZATION: could pack donespans, verb, operand, xor into 1 int-sized v
alue | 535 // OPTIMIZATION: could pack donespans, verb, operand, xor into 1 int-sized v
alue |
516 int fDoneSpans; // quick check that segment is finished | 536 int fDoneSpans; // quick check that segment is finished |
517 // OPTIMIZATION: force the following to be byte-sized | 537 // OPTIMIZATION: force the following to be byte-sized |
518 SkPath::Verb fVerb; | 538 SkPath::Verb fVerb; |
519 bool fLoop; // set if cubic intersects itself | 539 bool fLoop; // set if cubic intersects itself |
| 540 bool fMultiples; // set if curve intersects multiple other curves at one in
terior point |
520 bool fOperand; | 541 bool fOperand; |
521 bool fXor; // set if original contour had even-odd fill | 542 bool fXor; // set if original contour had even-odd fill |
522 bool fOppXor; // set if opposite operand had even-odd fill | 543 bool fOppXor; // set if opposite operand had even-odd fill |
523 bool fSmall; // set if some span is small | 544 bool fSmall; // set if some span is small |
524 bool fTiny; // set if some span is tiny | 545 bool fTiny; // set if some span is tiny |
525 #if defined(SK_DEBUG) || !FORCE_RELEASE | 546 #if defined(SK_DEBUG) || !FORCE_RELEASE |
526 int fID; | 547 int fID; |
527 #endif | 548 #endif |
528 | 549 |
529 friend class PathOpsSegmentTester; | 550 friend class PathOpsSegmentTester; |
530 }; | 551 }; |
531 | 552 |
532 #endif | 553 #endif |
OLD | NEW |