| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 protected: | 117 protected: |
| 118 SkOpSpanBase* fSpan; // contains winding data | 118 SkOpSpanBase* fSpan; // contains winding data |
| 119 SkOpPtT* fNext; // intersection on opposite curve or alias on this curve | 119 SkOpPtT* fNext; // intersection on opposite curve or alias on this curve |
| 120 bool fDeleted; // set if removed from span list | 120 bool fDeleted; // set if removed from span list |
| 121 bool fDuplicatePt; // set if identical pt is somewhere in the next loop | 121 bool fDuplicatePt; // set if identical pt is somewhere in the next loop |
| 122 SkDEBUGCODE(int fID); | 122 SkDEBUGCODE(int fID); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 class SkOpSpanBase { | 125 class SkOpSpanBase { |
| 126 public: | 126 public: |
| 127 bool addSimpleAngle(bool checkFrom , SkChunkAlloc* ); | |
| 128 void align(); | 127 void align(); |
| 129 | 128 |
| 130 bool aligned() const { | 129 bool aligned() const { |
| 131 return fAligned; | 130 return fAligned; |
| 132 } | 131 } |
| 133 | 132 |
| 134 void alignEnd(double t, const SkPoint& pt); | 133 void alignEnd(double t, const SkPoint& pt); |
| 135 | 134 |
| 136 void bumpSpanAdds() { | 135 void bumpSpanAdds() { |
| 137 ++fSpanAdds; | 136 ++fSpanAdds; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 SkOpSpan* fPrev; // previous intersection point | 325 SkOpSpan* fPrev; // previous intersection point |
| 327 int fSpanAdds; // number of times intersections have been added to span | 326 int fSpanAdds; // number of times intersections have been added to span |
| 328 bool fAligned; | 327 bool fAligned; |
| 329 bool fChased; // set after span has been added to chase array | 328 bool fChased; // set after span has been added to chase array |
| 330 SkDEBUGCODE(int fCount); // number of pt/t pairs added | 329 SkDEBUGCODE(int fCount); // number of pt/t pairs added |
| 331 SkDEBUGCODE(int fID); | 330 SkDEBUGCODE(int fID); |
| 332 }; | 331 }; |
| 333 | 332 |
| 334 class SkOpSpan : public SkOpSpanBase { | 333 class SkOpSpan : public SkOpSpanBase { |
| 335 public: | 334 public: |
| 336 void applyCoincidence(SkOpSpan* opp); | |
| 337 | |
| 338 bool clearCoincident() { | 335 bool clearCoincident() { |
| 339 SkASSERT(!final()); | 336 SkASSERT(!final()); |
| 340 if (fCoincident == this) { | 337 if (fCoincident == this) { |
| 341 return false; | 338 return false; |
| 342 } | 339 } |
| 343 fCoincident = this; | 340 fCoincident = this; |
| 344 return true; | 341 return true; |
| 345 } | 342 } |
| 346 | 343 |
| 347 bool containsCoincidence(const SkOpSegment* ) const; | 344 bool containsCoincidence(const SkOpSegment* ) const; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 SkASSERT(!final()); | 422 SkASSERT(!final()); |
| 426 SkASSERT(fOppSum == SK_MinS32); | 423 SkASSERT(fOppSum == SK_MinS32); |
| 427 fOppValue = oppValue; | 424 fOppValue = oppValue; |
| 428 } | 425 } |
| 429 | 426 |
| 430 void setToAngle(SkOpAngle* angle) { | 427 void setToAngle(SkOpAngle* angle) { |
| 431 SkASSERT(!final()); | 428 SkASSERT(!final()); |
| 432 fToAngle = angle; | 429 fToAngle = angle; |
| 433 } | 430 } |
| 434 | 431 |
| 435 void setWindSum(int windSum) { | 432 void setWindSum(int windSum); |
| 436 SkASSERT(!final()); | |
| 437 SkASSERT(fWindSum == SK_MinS32 || fWindSum == windSum); | |
| 438 SkASSERT(!DEBUG_LIMIT_WIND_SUM || abs(windSum) <= DEBUG_LIMIT_WIND_SUM); | |
| 439 fWindSum = windSum; | |
| 440 } | |
| 441 | 433 |
| 442 void setWindValue(int windValue) { | 434 void setWindValue(int windValue) { |
| 443 SkASSERT(!final()); | 435 SkASSERT(!final()); |
| 444 SkASSERT(windValue >= 0); | 436 SkASSERT(windValue >= 0); |
| 445 SkASSERT(fWindSum == SK_MinS32); | 437 SkASSERT(fWindSum == SK_MinS32); |
| 446 fWindValue = windValue; | 438 fWindValue = windValue; |
| 447 } | 439 } |
| 448 | 440 |
| 441 bool sortableTop(SkOpContour* ); |
| 442 |
| 449 SkOpAngle* toAngle() const { | 443 SkOpAngle* toAngle() const { |
| 450 SkASSERT(!final()); | 444 SkASSERT(!final()); |
| 451 return fToAngle; | 445 return fToAngle; |
| 452 } | 446 } |
| 453 | 447 |
| 454 int windSum() const { | 448 int windSum() const { |
| 455 SkASSERT(!final()); | 449 SkASSERT(!final()); |
| 456 return fWindSum; | 450 return fWindSum; |
| 457 } | 451 } |
| 458 | 452 |
| 459 int windValue() const { | 453 int windValue() const { |
| 460 SkASSERT(!final()); | 454 SkASSERT(!final()); |
| 461 return fWindValue; | 455 return fWindValue; |
| 462 } | 456 } |
| 463 | 457 |
| 464 private: // no direct access to internals to avoid treating a span base as a sp
an | 458 private: // no direct access to internals to avoid treating a span base as a sp
an |
| 465 SkOpSpan* fCoincident; // linked list of spans coincident with this one (ma
y point to itself) | 459 SkOpSpan* fCoincident; // linked list of spans coincident with this one (ma
y point to itself) |
| 466 SkOpAngle* fToAngle; // points to next angle from span start to end | 460 SkOpAngle* fToAngle; // points to next angle from span start to end |
| 467 SkOpSpanBase* fNext; // next intersection point | 461 SkOpSpanBase* fNext; // next intersection point |
| 468 int fWindSum; // accumulated from contours surrounding this one. | 462 int fWindSum; // accumulated from contours surrounding this one. |
| 469 int fOppSum; // for binary operators: the opposite winding sum | 463 int fOppSum; // for binary operators: the opposite winding sum |
| 470 int fWindValue; // 0 == canceled; 1 == normal; >1 == coincident | 464 int fWindValue; // 0 == canceled; 1 == normal; >1 == coincident |
| 471 int fOppValue; // normally 0 -- when binary coincident edges combine, opp v
alue goes here | 465 int fOppValue; // normally 0 -- when binary coincident edges combine, opp v
alue goes here |
| 466 int fTopTTry; // specifies direction and t value to try next |
| 472 bool fDone; // if set, this span to next higher T has been processed | 467 bool fDone; // if set, this span to next higher T has been processed |
| 473 }; | 468 }; |
| 474 | 469 |
| 475 #endif | 470 #endif |
| OLD | NEW |