| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 7 |
| 8 #include "SkChunkAlloc.h" | 8 #include "SkChunkAlloc.h" |
| 9 #include "SkPathOpsBounds.h" | 9 #include "SkPathOpsBounds.h" |
| 10 #include "SkPathOpsRect.h" | 10 #include "SkPathOpsRect.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 bool hasOppT(double t) const { | 106 bool hasOppT(double t) const { |
| 107 return SkToBool(oppT(t)); | 107 return SkToBool(oppT(t)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 int hullsIntersect(SkTSpan<OppCurve, TCurve>* span, bool* start, bool* oppSt
art); | 110 int hullsIntersect(SkTSpan<OppCurve, TCurve>* span, bool* start, bool* oppSt
art); |
| 111 void init(const TCurve& ); | 111 void init(const TCurve& ); |
| 112 void initBounds(const TCurve& ); | 112 void initBounds(const TCurve& ); |
| 113 | 113 |
| 114 bool isBounded() const { | 114 bool isBounded() const { |
| 115 return fBounded != NULL; | 115 return fBounded != nullptr; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool linearsIntersect(SkTSpan<OppCurve, TCurve>* span); | 118 bool linearsIntersect(SkTSpan<OppCurve, TCurve>* span); |
| 119 double linearT(const SkDPoint& ) const; | 119 double linearT(const SkDPoint& ) const; |
| 120 | 120 |
| 121 void markCoincident() { | 121 void markCoincident() { |
| 122 fCoinStart.markCoincident(); | 122 fCoinStart.markCoincident(); |
| 123 fCoinEnd.markCoincident(); | 123 fCoinEnd.markCoincident(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 const SkTSpan* next() const { | 126 const SkTSpan* next() const { |
| 127 return fNext; | 127 return fNext; |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool onlyEndPointsInCommon(const SkTSpan<OppCurve, TCurve>* opp, bool* start
, | 130 bool onlyEndPointsInCommon(const SkTSpan<OppCurve, TCurve>* opp, bool* start
, |
| 131 bool* oppStart, bool* ptsInCommon); | 131 bool* oppStart, bool* ptsInCommon); |
| 132 | 132 |
| 133 const TCurve& part() const { | 133 const TCurve& part() const { |
| 134 return fPart; | 134 return fPart; |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool removeAllBounded(); | 137 bool removeAllBounded(); |
| 138 bool removeBounded(const SkTSpan<OppCurve, TCurve>* opp); | 138 bool removeBounded(const SkTSpan<OppCurve, TCurve>* opp); |
| 139 | 139 |
| 140 void reset() { | 140 void reset() { |
| 141 fBounded = NULL; | 141 fBounded = nullptr; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void resetBounds(const TCurve& curve) { | 144 void resetBounds(const TCurve& curve) { |
| 145 fIsLinear = fIsLine = false; | 145 fIsLinear = fIsLine = false; |
| 146 initBounds(curve); | 146 initBounds(curve); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool split(SkTSpan* work, SkChunkAlloc* heap) { | 149 bool split(SkTSpan* work, SkChunkAlloc* heap) { |
| 150 return splitAt(work, (work->fStartT + work->fEndT) * 0.5, heap); | 150 return splitAt(work, (work->fStartT + work->fEndT) * 0.5, heap); |
| 151 } | 151 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 class SkTSect { | 200 class SkTSect { |
| 201 public: | 201 public: |
| 202 SkTSect(const TCurve& c PATH_OPS_DEBUG_T_SECT_PARAMS(int id)); | 202 SkTSect(const TCurve& c PATH_OPS_DEBUG_T_SECT_PARAMS(int id)); |
| 203 static void BinarySearch(SkTSect* sect1, SkTSect<OppCurve, TCurve>* sect2, | 203 static void BinarySearch(SkTSect* sect1, SkTSect<OppCurve, TCurve>* sect2, |
| 204 SkIntersections* intersections); | 204 SkIntersections* intersections); |
| 205 | 205 |
| 206 // for testing only | 206 // for testing only |
| 207 bool debugHasBounded(const SkTSpan<OppCurve, TCurve>* ) const; | 207 bool debugHasBounded(const SkTSpan<OppCurve, TCurve>* ) const; |
| 208 | 208 |
| 209 const SkTSect<OppCurve, TCurve>* debugOpp() const { | 209 const SkTSect<OppCurve, TCurve>* debugOpp() const { |
| 210 return SkDEBUGRELEASE(fOppSect, NULL); | 210 return SkDEBUGRELEASE(fOppSect, nullptr); |
| 211 } | 211 } |
| 212 | 212 |
| 213 const SkTSpan<TCurve, OppCurve>* debugSpan(int id) const; | 213 const SkTSpan<TCurve, OppCurve>* debugSpan(int id) const; |
| 214 const SkTSpan<TCurve, OppCurve>* debugT(double t) const; | 214 const SkTSpan<TCurve, OppCurve>* debugT(double t) const; |
| 215 void dump() const; | 215 void dump() const; |
| 216 void dumpBoth(SkTSect<OppCurve, TCurve>* ) const; | 216 void dumpBoth(SkTSect<OppCurve, TCurve>* ) const; |
| 217 void dumpBounded(int id) const; | 217 void dumpBounded(int id) const; |
| 218 void dumpBounds() const; | 218 void dumpBounds() const; |
| 219 void dumpCoin() const; | 219 void dumpCoin() const; |
| 220 void dumpCoinCurves() const; | 220 void dumpCoinCurves() const; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 do { | 445 do { |
| 446 if (between(work->fStartT, t, work->fEndT)) { | 446 if (between(work->fStartT, t, work->fEndT)) { |
| 447 return true; | 447 return true; |
| 448 } | 448 } |
| 449 } while ((work = work->fNext)); | 449 } while ((work = work->fNext)); |
| 450 return false; | 450 return false; |
| 451 } | 451 } |
| 452 | 452 |
| 453 template<typename TCurve, typename OppCurve> | 453 template<typename TCurve, typename OppCurve> |
| 454 const SkTSect<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::debugOpp() const { | 454 const SkTSect<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::debugOpp() const { |
| 455 return SkDEBUGRELEASE(fDebugSect->debugOpp(), NULL); | 455 return SkDEBUGRELEASE(fDebugSect->debugOpp(), nullptr); |
| 456 } | 456 } |
| 457 | 457 |
| 458 template<typename TCurve, typename OppCurve> | 458 template<typename TCurve, typename OppCurve> |
| 459 SkTSpan<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::findOppSpan( | 459 SkTSpan<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::findOppSpan( |
| 460 const SkTSpan<OppCurve, TCurve>* opp) const { | 460 const SkTSpan<OppCurve, TCurve>* opp) const { |
| 461 SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded; | 461 SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded; |
| 462 while (bounded) { | 462 while (bounded) { |
| 463 SkTSpan<OppCurve, TCurve>* test = bounded->fBounded; | 463 SkTSpan<OppCurve, TCurve>* test = bounded->fBounded; |
| 464 if (opp == test) { | 464 if (opp == test) { |
| 465 return test; | 465 return test; |
| 466 } | 466 } |
| 467 bounded = bounded->fNext; | 467 bounded = bounded->fNext; |
| 468 } | 468 } |
| 469 return NULL; | 469 return nullptr; |
| 470 } | 470 } |
| 471 | 471 |
| 472 // returns 0 if no hull intersection | 472 // returns 0 if no hull intersection |
| 473 // 1 if hulls intersect | 473 // 1 if hulls intersect |
| 474 // 2 if hulls only share a common endpoint | 474 // 2 if hulls only share a common endpoint |
| 475 // -1 if linear and further checking is required | 475 // -1 if linear and further checking is required |
| 476 template<typename TCurve, typename OppCurve> | 476 template<typename TCurve, typename OppCurve> |
| 477 int SkTSpan<TCurve, OppCurve>::hullCheck(const SkTSpan<OppCurve, TCurve>* opp, | 477 int SkTSpan<TCurve, OppCurve>::hullCheck(const SkTSpan<OppCurve, TCurve>* opp, |
| 478 bool* start, bool* oppStart) { | 478 bool* start, bool* oppStart) { |
| 479 if (fIsLinear) { | 479 if (fIsLinear) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 } | 513 } |
| 514 hullSect = opp->hullCheck(this, oppStart, start); | 514 hullSect = opp->hullCheck(this, oppStart, start); |
| 515 if (hullSect >= 0) { | 515 if (hullSect >= 0) { |
| 516 return hullSect; | 516 return hullSect; |
| 517 } | 517 } |
| 518 return -1; | 518 return -1; |
| 519 } | 519 } |
| 520 | 520 |
| 521 template<typename TCurve, typename OppCurve> | 521 template<typename TCurve, typename OppCurve> |
| 522 void SkTSpan<TCurve, OppCurve>::init(const TCurve& c) { | 522 void SkTSpan<TCurve, OppCurve>::init(const TCurve& c) { |
| 523 fPrev = fNext = NULL; | 523 fPrev = fNext = nullptr; |
| 524 fStartT = 0; | 524 fStartT = 0; |
| 525 fEndT = 1; | 525 fEndT = 1; |
| 526 fBounded = NULL; | 526 fBounded = nullptr; |
| 527 resetBounds(c); | 527 resetBounds(c); |
| 528 } | 528 } |
| 529 | 529 |
| 530 template<typename TCurve, typename OppCurve> | 530 template<typename TCurve, typename OppCurve> |
| 531 void SkTSpan<TCurve, OppCurve>::initBounds(const TCurve& c) { | 531 void SkTSpan<TCurve, OppCurve>::initBounds(const TCurve& c) { |
| 532 fPart = c.subDivide(fStartT, fEndT); | 532 fPart = c.subDivide(fStartT, fEndT); |
| 533 fBounds.setBounds(fPart); | 533 fBounds.setBounds(fPart); |
| 534 fCoinStart.init(); | 534 fCoinStart.init(); |
| 535 fCoinEnd.init(); | 535 fCoinEnd.init(); |
| 536 fBoundsMax = SkTMax(fBounds.width(), fBounds.height()); | 536 fBoundsMax = SkTMax(fBounds.width(), fBounds.height()); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 template<typename TCurve, typename OppCurve> | 649 template<typename TCurve, typename OppCurve> |
| 650 SkTSpan<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::oppT(double t) const { | 650 SkTSpan<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::oppT(double t) const { |
| 651 SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded; | 651 SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded; |
| 652 while (bounded) { | 652 while (bounded) { |
| 653 SkTSpan<OppCurve, TCurve>* test = bounded->fBounded; | 653 SkTSpan<OppCurve, TCurve>* test = bounded->fBounded; |
| 654 if (between(test->fStartT, t, test->fEndT)) { | 654 if (between(test->fStartT, t, test->fEndT)) { |
| 655 return test; | 655 return test; |
| 656 } | 656 } |
| 657 bounded = bounded->fNext; | 657 bounded = bounded->fNext; |
| 658 } | 658 } |
| 659 return NULL; | 659 return nullptr; |
| 660 } | 660 } |
| 661 | 661 |
| 662 template<typename TCurve, typename OppCurve> | 662 template<typename TCurve, typename OppCurve> |
| 663 bool SkTSpan<TCurve, OppCurve>::removeAllBounded() { | 663 bool SkTSpan<TCurve, OppCurve>::removeAllBounded() { |
| 664 bool deleteSpan = false; | 664 bool deleteSpan = false; |
| 665 SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded; | 665 SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded; |
| 666 while (bounded) { | 666 while (bounded) { |
| 667 SkTSpan<OppCurve, TCurve>* opp = bounded->fBounded; | 667 SkTSpan<OppCurve, TCurve>* opp = bounded->fBounded; |
| 668 deleteSpan |= opp->removeBounded(this); | 668 deleteSpan |= opp->removeBounded(this); |
| 669 bounded = bounded->fNext; | 669 bounded = bounded->fNext; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 685 } | 685 } |
| 686 bounded = bounded->fNext; | 686 bounded = bounded->fNext; |
| 687 } | 687 } |
| 688 if (!foundStart || !foundEnd) { | 688 if (!foundStart || !foundEnd) { |
| 689 fHasPerp = false; | 689 fHasPerp = false; |
| 690 fCoinStart.init(); | 690 fCoinStart.init(); |
| 691 fCoinEnd.init(); | 691 fCoinEnd.init(); |
| 692 } | 692 } |
| 693 } | 693 } |
| 694 SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded; | 694 SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded; |
| 695 SkTSpanBounded<OppCurve, TCurve>* prev = NULL; | 695 SkTSpanBounded<OppCurve, TCurve>* prev = nullptr; |
| 696 while (bounded) { | 696 while (bounded) { |
| 697 SkTSpanBounded<OppCurve, TCurve>* boundedNext = bounded->fNext; | 697 SkTSpanBounded<OppCurve, TCurve>* boundedNext = bounded->fNext; |
| 698 if (opp == bounded->fBounded) { | 698 if (opp == bounded->fBounded) { |
| 699 if (prev) { | 699 if (prev) { |
| 700 prev->fNext = boundedNext; | 700 prev->fNext = boundedNext; |
| 701 return false; | 701 return false; |
| 702 } else { | 702 } else { |
| 703 fBounded = boundedNext; | 703 fBounded = boundedNext; |
| 704 return fBounded == NULL; | 704 return fBounded == nullptr; |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 prev = bounded; | 707 prev = bounded; |
| 708 bounded = boundedNext; | 708 bounded = boundedNext; |
| 709 } | 709 } |
| 710 SkASSERT(0); | 710 SkASSERT(0); |
| 711 return false; | 711 return false; |
| 712 } | 712 } |
| 713 | 713 |
| 714 template<typename TCurve, typename OppCurve> | 714 template<typename TCurve, typename OppCurve> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 727 fPrev = work; | 727 fPrev = work; |
| 728 fNext = work->fNext; | 728 fNext = work->fNext; |
| 729 fIsLinear = work->fIsLinear; | 729 fIsLinear = work->fIsLinear; |
| 730 fIsLine = work->fIsLine; | 730 fIsLine = work->fIsLine; |
| 731 | 731 |
| 732 work->fNext = this; | 732 work->fNext = this; |
| 733 if (fNext) { | 733 if (fNext) { |
| 734 fNext->fPrev = this; | 734 fNext->fPrev = this; |
| 735 } | 735 } |
| 736 SkTSpanBounded<OppCurve, TCurve>* bounded = work->fBounded; | 736 SkTSpanBounded<OppCurve, TCurve>* bounded = work->fBounded; |
| 737 fBounded = NULL; | 737 fBounded = nullptr; |
| 738 while (bounded) { | 738 while (bounded) { |
| 739 this->addBounded(bounded->fBounded, heap); | 739 this->addBounded(bounded->fBounded, heap); |
| 740 bounded = bounded->fNext; | 740 bounded = bounded->fNext; |
| 741 } | 741 } |
| 742 bounded = fBounded; | 742 bounded = fBounded; |
| 743 while (bounded) { | 743 while (bounded) { |
| 744 bounded->fBounded->addBounded(this, heap); | 744 bounded->fBounded->addBounded(this, heap); |
| 745 bounded = bounded->fNext; | 745 bounded = bounded->fNext; |
| 746 } | 746 } |
| 747 return true; | 747 return true; |
| 748 } | 748 } |
| 749 | 749 |
| 750 template<typename TCurve, typename OppCurve> | 750 template<typename TCurve, typename OppCurve> |
| 751 void SkTSpan<TCurve, OppCurve>::validate() const { | 751 void SkTSpan<TCurve, OppCurve>::validate() const { |
| 752 #if DEBUG_T_SECT | 752 #if DEBUG_T_SECT |
| 753 SkASSERT(fNext == NULL || fNext != fPrev); | 753 SkASSERT(fNext == nullptr || fNext != fPrev); |
| 754 SkASSERT(fNext == NULL || this == fNext->fPrev); | 754 SkASSERT(fNext == nullptr || this == fNext->fPrev); |
| 755 SkASSERT(fPrev == NULL || this == fPrev->fNext); | 755 SkASSERT(fPrev == nullptr || this == fPrev->fNext); |
| 756 SkASSERT(fBounds.width() || fBounds.height() || fCollapsed); | 756 SkASSERT(fBounds.width() || fBounds.height() || fCollapsed); |
| 757 SkASSERT(fBoundsMax == SkTMax(fBounds.width(), fBounds.height())); | 757 SkASSERT(fBoundsMax == SkTMax(fBounds.width(), fBounds.height())); |
| 758 SkASSERT(0 <= fStartT); | 758 SkASSERT(0 <= fStartT); |
| 759 SkASSERT(fEndT <= 1); | 759 SkASSERT(fEndT <= 1); |
| 760 SkASSERT(fStartT <= fEndT); | 760 SkASSERT(fStartT <= fEndT); |
| 761 SkASSERT(fBounded); | 761 SkASSERT(fBounded); |
| 762 this->validateBounded(); | 762 this->validateBounded(); |
| 763 if (fHasPerp) { | 763 if (fHasPerp) { |
| 764 if (fCoinStart.isCoincident()) { | 764 if (fCoinStart.isCoincident()) { |
| 765 validatePerpT(fCoinStart.perpT()); | 765 validatePerpT(fCoinStart.perpT()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 template<typename TCurve, typename OppCurve> | 803 template<typename TCurve, typename OppCurve> |
| 804 void SkTSpan<TCurve, OppCurve>::validatePerpPt(double t, const SkDPoint& pt) con
st { | 804 void SkTSpan<TCurve, OppCurve>::validatePerpPt(double t, const SkDPoint& pt) con
st { |
| 805 SkASSERT(fDebugSect->fOppSect->fCurve.ptAtT(t) == pt); | 805 SkASSERT(fDebugSect->fOppSect->fCurve.ptAtT(t) == pt); |
| 806 } | 806 } |
| 807 | 807 |
| 808 | 808 |
| 809 template<typename TCurve, typename OppCurve> | 809 template<typename TCurve, typename OppCurve> |
| 810 SkTSect<TCurve, OppCurve>::SkTSect(const TCurve& c PATH_OPS_DEBUG_T_SECT_PARAMS(
int id)) | 810 SkTSect<TCurve, OppCurve>::SkTSect(const TCurve& c PATH_OPS_DEBUG_T_SECT_PARAMS(
int id)) |
| 811 : fCurve(c) | 811 : fCurve(c) |
| 812 , fHeap(sizeof(SkTSpan<TCurve, OppCurve>) * 4) | 812 , fHeap(sizeof(SkTSpan<TCurve, OppCurve>) * 4) |
| 813 , fCoincident(NULL) | 813 , fCoincident(nullptr) |
| 814 , fDeleted(NULL) | 814 , fDeleted(nullptr) |
| 815 , fActiveCount(0) | 815 , fActiveCount(0) |
| 816 PATH_OPS_DEBUG_T_SECT_PARAMS(fID(id)) | 816 PATH_OPS_DEBUG_T_SECT_PARAMS(fID(id)) |
| 817 PATH_OPS_DEBUG_T_SECT_PARAMS(fDebugCount(0)) | 817 PATH_OPS_DEBUG_T_SECT_PARAMS(fDebugCount(0)) |
| 818 PATH_OPS_DEBUG_T_SECT_PARAMS(fDebugAllocatedCount(0)) | 818 PATH_OPS_DEBUG_T_SECT_PARAMS(fDebugAllocatedCount(0)) |
| 819 { | 819 { |
| 820 fHead = addOne(); | 820 fHead = addOne(); |
| 821 fHead->init(c); | 821 fHead->init(c); |
| 822 } | 822 } |
| 823 | 823 |
| 824 template<typename TCurve, typename OppCurve> | 824 template<typename TCurve, typename OppCurve> |
| 825 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::addOne() { | 825 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::addOne() { |
| 826 SkTSpan<TCurve, OppCurve>* result; | 826 SkTSpan<TCurve, OppCurve>* result; |
| 827 if (fDeleted) { | 827 if (fDeleted) { |
| 828 result = fDeleted; | 828 result = fDeleted; |
| 829 result->reset(); | 829 result->reset(); |
| 830 fDeleted = result->fNext; | 830 fDeleted = result->fNext; |
| 831 } else { | 831 } else { |
| 832 result = new (fHeap.allocThrow(sizeof(SkTSpan<TCurve, OppCurve>)))( | 832 result = new (fHeap.allocThrow(sizeof(SkTSpan<TCurve, OppCurve>)))( |
| 833 SkTSpan<TCurve, OppCurve>); | 833 SkTSpan<TCurve, OppCurve>); |
| 834 result->fBounded = NULL; | 834 result->fBounded = nullptr; |
| 835 #if DEBUG_T_SECT | 835 #if DEBUG_T_SECT |
| 836 ++fDebugAllocatedCount; | 836 ++fDebugAllocatedCount; |
| 837 #endif | 837 #endif |
| 838 } | 838 } |
| 839 result->fHasPerp = false; | 839 result->fHasPerp = false; |
| 840 result->fDeleted = false; | 840 result->fDeleted = false; |
| 841 ++fActiveCount; | 841 ++fActiveCount; |
| 842 PATH_OPS_DEBUG_T_SECT_CODE(result->fID = fDebugCount++ * 2 + fID); | 842 PATH_OPS_DEBUG_T_SECT_CODE(result->fID = fDebugCount++ * 2 + fID); |
| 843 SkDEBUGCODE(result->fDebugSect = this); | 843 SkDEBUGCODE(result->fDebugSect = this); |
| 844 return result; | 844 return result; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 test = test->next(); | 966 test = test->next(); |
| 967 } | 967 } |
| 968 return result; | 968 return result; |
| 969 } | 969 } |
| 970 | 970 |
| 971 template<typename TCurve, typename OppCurve> | 971 template<typename TCurve, typename OppCurve> |
| 972 void SkTSect<TCurve, OppCurve>::computePerpendiculars(SkTSect<OppCurve, TCurve>*
sect2, | 972 void SkTSect<TCurve, OppCurve>::computePerpendiculars(SkTSect<OppCurve, TCurve>*
sect2, |
| 973 SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>* last) { | 973 SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>* last) { |
| 974 const OppCurve& opp = sect2->fCurve; | 974 const OppCurve& opp = sect2->fCurve; |
| 975 SkTSpan<TCurve, OppCurve>* work = first; | 975 SkTSpan<TCurve, OppCurve>* work = first; |
| 976 SkTSpan<TCurve, OppCurve>* prior = NULL; | 976 SkTSpan<TCurve, OppCurve>* prior = nullptr; |
| 977 do { | 977 do { |
| 978 if (!work->fHasPerp && !work->fCollapsed) { | 978 if (!work->fHasPerp && !work->fCollapsed) { |
| 979 if (prior) { | 979 if (prior) { |
| 980 work->fCoinStart = prior->fCoinEnd; | 980 work->fCoinStart = prior->fCoinEnd; |
| 981 } else { | 981 } else { |
| 982 work->fCoinStart.setPerp(fCurve, work->fStartT, work->fPart[0],
opp); | 982 work->fCoinStart.setPerp(fCurve, work->fStartT, work->fPart[0],
opp); |
| 983 } | 983 } |
| 984 if (work->fCoinStart.isCoincident()) { | 984 if (work->fCoinStart.isCoincident()) { |
| 985 double perpT = work->fCoinStart.perpT(); | 985 double perpT = work->fCoinStart.perpT(); |
| 986 if (sect2->coincidentHasT(perpT)) { | 986 if (sect2->coincidentHasT(perpT)) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 } | 1054 } |
| 1055 } | 1055 } |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 template<typename TCurve, typename OppCurve> | 1058 template<typename TCurve, typename OppCurve> |
| 1059 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::extractCoincident( | 1059 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::extractCoincident( |
| 1060 SkTSect<OppCurve, TCurve>* sect2, | 1060 SkTSect<OppCurve, TCurve>* sect2, |
| 1061 SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>* last) { | 1061 SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>* last) { |
| 1062 first = findCoincidentRun(first, &last); | 1062 first = findCoincidentRun(first, &last); |
| 1063 if (!first) { | 1063 if (!first) { |
| 1064 return NULL; | 1064 return nullptr; |
| 1065 } | 1065 } |
| 1066 // march outwards to find limit of coincidence from here to previous and nex
t spans | 1066 // march outwards to find limit of coincidence from here to previous and nex
t spans |
| 1067 double startT = first->fStartT; | 1067 double startT = first->fStartT; |
| 1068 double oppStartT SK_INIT_TO_AVOID_WARNING; | 1068 double oppStartT SK_INIT_TO_AVOID_WARNING; |
| 1069 double oppEndT SK_INIT_TO_AVOID_WARNING; | 1069 double oppEndT SK_INIT_TO_AVOID_WARNING; |
| 1070 SkTSpan<TCurve, OppCurve>* prev = first->fPrev; | 1070 SkTSpan<TCurve, OppCurve>* prev = first->fPrev; |
| 1071 SkASSERT(first->fCoinStart.isCoincident()); | 1071 SkASSERT(first->fCoinStart.isCoincident()); |
| 1072 SkTSpan<OppCurve, TCurve>* oppFirst = first->findOppT(first->fCoinStart.perp
T()); | 1072 SkTSpan<OppCurve, TCurve>* oppFirst = first->findOppT(first->fCoinStart.perp
T()); |
| 1073 SkASSERT(last->fCoinEnd.isCoincident()); | 1073 SkASSERT(last->fCoinEnd.isCoincident()); |
| 1074 bool oppMatched = first->fCoinStart.perpT() < first->fCoinEnd.perpT(); | 1074 bool oppMatched = first->fCoinStart.perpT() < first->fCoinEnd.perpT(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 sect2->validateBounded(); | 1139 sect2->validateBounded(); |
| 1140 last = first->fNext; | 1140 last = first->fNext; |
| 1141 this->removeCoincident(first, false); | 1141 this->removeCoincident(first, false); |
| 1142 sect2->removeCoincident(oppFirst, true); | 1142 sect2->removeCoincident(oppFirst, true); |
| 1143 if (deleteEmptySpans) { | 1143 if (deleteEmptySpans) { |
| 1144 this->deleteEmptySpans(); | 1144 this->deleteEmptySpans(); |
| 1145 sect2->deleteEmptySpans(); | 1145 sect2->deleteEmptySpans(); |
| 1146 } | 1146 } |
| 1147 this->validate(); | 1147 this->validate(); |
| 1148 sect2->validate(); | 1148 sect2->validate(); |
| 1149 return last && !last->fDeleted ? last : NULL; | 1149 return last && !last->fDeleted ? last : nullptr; |
| 1150 } | 1150 } |
| 1151 | 1151 |
| 1152 template<typename TCurve, typename OppCurve> | 1152 template<typename TCurve, typename OppCurve> |
| 1153 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::findCoincidentRun( | 1153 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::findCoincidentRun( |
| 1154 SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>** lastPtr) { | 1154 SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>** lastPtr) { |
| 1155 SkTSpan<TCurve, OppCurve>* work = first; | 1155 SkTSpan<TCurve, OppCurve>* work = first; |
| 1156 SkTSpan<TCurve, OppCurve>* lastCandidate = NULL; | 1156 SkTSpan<TCurve, OppCurve>* lastCandidate = nullptr; |
| 1157 first = NULL; | 1157 first = nullptr; |
| 1158 // find the first fully coincident span | 1158 // find the first fully coincident span |
| 1159 do { | 1159 do { |
| 1160 if (work->fCoinStart.isCoincident()) { | 1160 if (work->fCoinStart.isCoincident()) { |
| 1161 #if DEBUG_T_SECT | 1161 #if DEBUG_T_SECT |
| 1162 work->validatePerpT(work->fCoinStart.perpT()); | 1162 work->validatePerpT(work->fCoinStart.perpT()); |
| 1163 work->validatePerpPt(work->fCoinStart.perpT(), work->fCoinStart.perp
Pt()); | 1163 work->validatePerpPt(work->fCoinStart.perpT(), work->fCoinStart.perp
Pt()); |
| 1164 #endif | 1164 #endif |
| 1165 SkASSERT(work->hasOppT(work->fCoinStart.perpT())); | 1165 SkASSERT(work->hasOppT(work->fCoinStart.perpT())); |
| 1166 if (!work->fCoinEnd.isCoincident()) { | 1166 if (!work->fCoinEnd.isCoincident()) { |
| 1167 break; | 1167 break; |
| 1168 } | 1168 } |
| 1169 lastCandidate = work; | 1169 lastCandidate = work; |
| 1170 if (!first) { | 1170 if (!first) { |
| 1171 first = work; | 1171 first = work; |
| 1172 } | 1172 } |
| 1173 } else if (first && work->fCollapsed) { | 1173 } else if (first && work->fCollapsed) { |
| 1174 *lastPtr = lastCandidate; | 1174 *lastPtr = lastCandidate; |
| 1175 return first; | 1175 return first; |
| 1176 } else { | 1176 } else { |
| 1177 lastCandidate = NULL; | 1177 lastCandidate = nullptr; |
| 1178 SkASSERT(!first); | 1178 SkASSERT(!first); |
| 1179 } | 1179 } |
| 1180 if (work == *lastPtr) { | 1180 if (work == *lastPtr) { |
| 1181 return first; | 1181 return first; |
| 1182 } | 1182 } |
| 1183 work = work->fNext; | 1183 work = work->fNext; |
| 1184 SkASSERT(work); | 1184 SkASSERT(work); |
| 1185 } while (true); | 1185 } while (true); |
| 1186 if (lastCandidate) { | 1186 if (lastCandidate) { |
| 1187 *lastPtr = lastCandidate; | 1187 *lastPtr = lastCandidate; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 *oppMatched = this->matchedDirection(t, sect2, t2); | 1397 *oppMatched = this->matchedDirection(t, sect2, t2); |
| 1398 *calcMatched = true; | 1398 *calcMatched = true; |
| 1399 } | 1399 } |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 template<typename TCurve, typename OppCurve> | 1402 template<typename TCurve, typename OppCurve> |
| 1403 void SkTSect<TCurve, OppCurve>::mergeCoincidence(SkTSect<OppCurve, TCurve>* sect
2) { | 1403 void SkTSect<TCurve, OppCurve>::mergeCoincidence(SkTSect<OppCurve, TCurve>* sect
2) { |
| 1404 double smallLimit = 0; | 1404 double smallLimit = 0; |
| 1405 do { | 1405 do { |
| 1406 // find the smallest unprocessed span | 1406 // find the smallest unprocessed span |
| 1407 SkTSpan<TCurve, OppCurve>* smaller = NULL; | 1407 SkTSpan<TCurve, OppCurve>* smaller = nullptr; |
| 1408 SkTSpan<TCurve, OppCurve>* test = fCoincident; | 1408 SkTSpan<TCurve, OppCurve>* test = fCoincident; |
| 1409 do { | 1409 do { |
| 1410 if (test->fStartT < smallLimit) { | 1410 if (test->fStartT < smallLimit) { |
| 1411 continue; | 1411 continue; |
| 1412 } | 1412 } |
| 1413 if (smaller && smaller->fEndT < test->fStartT) { | 1413 if (smaller && smaller->fEndT < test->fStartT) { |
| 1414 continue; | 1414 continue; |
| 1415 } | 1415 } |
| 1416 smaller = test; | 1416 smaller = test; |
| 1417 } while ((test = test->fNext)); | 1417 } while ((test = test->fNext)); |
| 1418 if (!smaller) { | 1418 if (!smaller) { |
| 1419 return; | 1419 return; |
| 1420 } | 1420 } |
| 1421 smallLimit = smaller->fEndT; | 1421 smallLimit = smaller->fEndT; |
| 1422 // find next larger span | 1422 // find next larger span |
| 1423 SkTSpan<TCurve, OppCurve>* prior = NULL; | 1423 SkTSpan<TCurve, OppCurve>* prior = nullptr; |
| 1424 SkTSpan<TCurve, OppCurve>* larger = NULL; | 1424 SkTSpan<TCurve, OppCurve>* larger = nullptr; |
| 1425 SkTSpan<TCurve, OppCurve>* largerPrior = NULL; | 1425 SkTSpan<TCurve, OppCurve>* largerPrior = nullptr; |
| 1426 test = fCoincident; | 1426 test = fCoincident; |
| 1427 do { | 1427 do { |
| 1428 if (test->fStartT < smaller->fEndT) { | 1428 if (test->fStartT < smaller->fEndT) { |
| 1429 continue; | 1429 continue; |
| 1430 } | 1430 } |
| 1431 SkASSERT(test->fStartT != smaller->fEndT); | 1431 SkASSERT(test->fStartT != smaller->fEndT); |
| 1432 if (larger && larger->fStartT < test->fStartT) { | 1432 if (larger && larger->fStartT < test->fStartT) { |
| 1433 continue; | 1433 continue; |
| 1434 } | 1434 } |
| 1435 largerPrior = prior; | 1435 largerPrior = prior; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1451 } else { | 1451 } else { |
| 1452 fCoincident = larger->fNext; | 1452 fCoincident = larger->fNext; |
| 1453 } | 1453 } |
| 1454 } | 1454 } |
| 1455 } while (true); | 1455 } while (true); |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 template<typename TCurve, typename OppCurve> | 1458 template<typename TCurve, typename OppCurve> |
| 1459 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::prev( | 1459 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::prev( |
| 1460 SkTSpan<TCurve, OppCurve>* span) const { | 1460 SkTSpan<TCurve, OppCurve>* span) const { |
| 1461 SkTSpan<TCurve, OppCurve>* result = NULL; | 1461 SkTSpan<TCurve, OppCurve>* result = nullptr; |
| 1462 SkTSpan<TCurve, OppCurve>* test = fHead; | 1462 SkTSpan<TCurve, OppCurve>* test = fHead; |
| 1463 while (span != test) { | 1463 while (span != test) { |
| 1464 result = test; | 1464 result = test; |
| 1465 test = test->fNext; | 1465 test = test->fNext; |
| 1466 SkASSERT(test); | 1466 SkASSERT(test); |
| 1467 } | 1467 } |
| 1468 return result; | 1468 return result; |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 template<typename TCurve, typename OppCurve> | 1471 template<typename TCurve, typename OppCurve> |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 } | 1581 } |
| 1582 SkASSERT(!span->fDeleted || !opp->debugHasBounded(span)); | 1582 SkASSERT(!span->fDeleted || !opp->debugHasBounded(span)); |
| 1583 bounded = next; | 1583 bounded = next; |
| 1584 } | 1584 } |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 template<typename TCurve, typename OppCurve> | 1587 template<typename TCurve, typename OppCurve> |
| 1588 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::spanAtT(double t, | 1588 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::spanAtT(double t, |
| 1589 SkTSpan<TCurve, OppCurve>** priorSpan) { | 1589 SkTSpan<TCurve, OppCurve>** priorSpan) { |
| 1590 SkTSpan<TCurve, OppCurve>* test = fHead; | 1590 SkTSpan<TCurve, OppCurve>* test = fHead; |
| 1591 SkTSpan<TCurve, OppCurve>* prev = NULL; | 1591 SkTSpan<TCurve, OppCurve>* prev = nullptr; |
| 1592 while (test && test->fEndT < t) { | 1592 while (test && test->fEndT < t) { |
| 1593 prev = test; | 1593 prev = test; |
| 1594 test = test->fNext; | 1594 test = test->fNext; |
| 1595 } | 1595 } |
| 1596 *priorSpan = prev; | 1596 *priorSpan = prev; |
| 1597 return test && test->fStartT <= t ? test : NULL; | 1597 return test && test->fStartT <= t ? test : nullptr; |
| 1598 } | 1598 } |
| 1599 | 1599 |
| 1600 template<typename TCurve, typename OppCurve> | 1600 template<typename TCurve, typename OppCurve> |
| 1601 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::tail() { | 1601 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::tail() { |
| 1602 SkTSpan<TCurve, OppCurve>* result = fHead; | 1602 SkTSpan<TCurve, OppCurve>* result = fHead; |
| 1603 SkTSpan<TCurve, OppCurve>* next = fHead; | 1603 SkTSpan<TCurve, OppCurve>* next = fHead; |
| 1604 while ((next = next->fNext)) { | 1604 while ((next = next->fNext)) { |
| 1605 if (next->fEndT > result->fEndT) { | 1605 if (next->fEndT > result->fEndT) { |
| 1606 result = next; | 1606 result = next; |
| 1607 } | 1607 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 SkTSpan<TCurve, OppCurve>* prev = span->fPrev; | 1647 SkTSpan<TCurve, OppCurve>* prev = span->fPrev; |
| 1648 SkTSpan<TCurve, OppCurve>* next = span->fNext; | 1648 SkTSpan<TCurve, OppCurve>* next = span->fNext; |
| 1649 if (prev) { | 1649 if (prev) { |
| 1650 prev->fNext = next; | 1650 prev->fNext = next; |
| 1651 if (next) { | 1651 if (next) { |
| 1652 next->fPrev = prev; | 1652 next->fPrev = prev; |
| 1653 } | 1653 } |
| 1654 } else { | 1654 } else { |
| 1655 fHead = next; | 1655 fHead = next; |
| 1656 if (next) { | 1656 if (next) { |
| 1657 next->fPrev = NULL; | 1657 next->fPrev = nullptr; |
| 1658 } | 1658 } |
| 1659 } | 1659 } |
| 1660 } | 1660 } |
| 1661 | 1661 |
| 1662 template<typename TCurve, typename OppCurve> | 1662 template<typename TCurve, typename OppCurve> |
| 1663 bool SkTSect<TCurve, OppCurve>::updateBounded(SkTSpan<TCurve, OppCurve>* first, | 1663 bool SkTSect<TCurve, OppCurve>::updateBounded(SkTSpan<TCurve, OppCurve>* first, |
| 1664 SkTSpan<TCurve, OppCurve>* last, SkTSpan<OppCurve, TCurve>* oppFirst) { | 1664 SkTSpan<TCurve, OppCurve>* last, SkTSpan<OppCurve, TCurve>* oppFirst) { |
| 1665 SkTSpan<TCurve, OppCurve>* test = first; | 1665 SkTSpan<TCurve, OppCurve>* test = first; |
| 1666 const SkTSpan<TCurve, OppCurve>* final = last->next(); | 1666 const SkTSpan<TCurve, OppCurve>* final = last->next(); |
| 1667 bool deleteSpan = false; | 1667 bool deleteSpan = false; |
| 1668 do { | 1668 do { |
| 1669 deleteSpan |= test->removeAllBounded(); | 1669 deleteSpan |= test->removeAllBounded(); |
| 1670 } while ((test = test->fNext) != final); | 1670 } while ((test = test->fNext) != final); |
| 1671 first->fBounded = NULL; | 1671 first->fBounded = nullptr; |
| 1672 first->addBounded(oppFirst, &fHeap); | 1672 first->addBounded(oppFirst, &fHeap); |
| 1673 // cannot call validate until remove span range is called | 1673 // cannot call validate until remove span range is called |
| 1674 return deleteSpan; | 1674 return deleteSpan; |
| 1675 } | 1675 } |
| 1676 | 1676 |
| 1677 | 1677 |
| 1678 template<typename TCurve, typename OppCurve> | 1678 template<typename TCurve, typename OppCurve> |
| 1679 void SkTSect<TCurve, OppCurve>::validate() const { | 1679 void SkTSect<TCurve, OppCurve>::validate() const { |
| 1680 #if DEBUG_T_SECT | 1680 #if DEBUG_T_SECT |
| 1681 int count = 0; | 1681 int count = 0; |
| 1682 if (fHead) { | 1682 if (fHead) { |
| 1683 const SkTSpan<TCurve, OppCurve>* span = fHead; | 1683 const SkTSpan<TCurve, OppCurve>* span = fHead; |
| 1684 SkASSERT(!span->fPrev); | 1684 SkASSERT(!span->fPrev); |
| 1685 SkDEBUGCODE(double last = 0); | 1685 SkDEBUGCODE(double last = 0); |
| 1686 do { | 1686 do { |
| 1687 span->validate(); | 1687 span->validate(); |
| 1688 SkASSERT(span->fStartT >= last); | 1688 SkASSERT(span->fStartT >= last); |
| 1689 SkDEBUGCODE(last = span->fEndT); | 1689 SkDEBUGCODE(last = span->fEndT); |
| 1690 ++count; | 1690 ++count; |
| 1691 } while ((span = span->fNext) != NULL); | 1691 } while ((span = span->fNext) != nullptr); |
| 1692 } | 1692 } |
| 1693 SkASSERT(count == fActiveCount); | 1693 SkASSERT(count == fActiveCount); |
| 1694 SkASSERT(fActiveCount <= fDebugAllocatedCount); | 1694 SkASSERT(fActiveCount <= fDebugAllocatedCount); |
| 1695 int deletedCount = 0; | 1695 int deletedCount = 0; |
| 1696 const SkTSpan<TCurve, OppCurve>* deleted = fDeleted; | 1696 const SkTSpan<TCurve, OppCurve>* deleted = fDeleted; |
| 1697 while (deleted) { | 1697 while (deleted) { |
| 1698 ++deletedCount; | 1698 ++deletedCount; |
| 1699 deleted = deleted->fNext; | 1699 deleted = deleted->fNext; |
| 1700 } | 1700 } |
| 1701 const SkTSpan<TCurve, OppCurve>* coincident = fCoincident; | 1701 const SkTSpan<TCurve, OppCurve>* coincident = fCoincident; |
| 1702 while (coincident) { | 1702 while (coincident) { |
| 1703 ++deletedCount; | 1703 ++deletedCount; |
| 1704 coincident = coincident->fNext; | 1704 coincident = coincident->fNext; |
| 1705 } | 1705 } |
| 1706 SkASSERT(fActiveCount + deletedCount == fDebugAllocatedCount); | 1706 SkASSERT(fActiveCount + deletedCount == fDebugAllocatedCount); |
| 1707 #endif | 1707 #endif |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 template<typename TCurve, typename OppCurve> | 1710 template<typename TCurve, typename OppCurve> |
| 1711 void SkTSect<TCurve, OppCurve>::validateBounded() const { | 1711 void SkTSect<TCurve, OppCurve>::validateBounded() const { |
| 1712 #if DEBUG_T_SECT | 1712 #if DEBUG_T_SECT |
| 1713 if (!fHead) { | 1713 if (!fHead) { |
| 1714 return; | 1714 return; |
| 1715 } | 1715 } |
| 1716 const SkTSpan<TCurve, OppCurve>* span = fHead; | 1716 const SkTSpan<TCurve, OppCurve>* span = fHead; |
| 1717 do { | 1717 do { |
| 1718 span->validateBounded(); | 1718 span->validateBounded(); |
| 1719 } while ((span = span->fNext) != NULL); | 1719 } while ((span = span->fNext) != nullptr); |
| 1720 #endif | 1720 #endif |
| 1721 } | 1721 } |
| 1722 | 1722 |
| 1723 template<typename TCurve, typename OppCurve> | 1723 template<typename TCurve, typename OppCurve> |
| 1724 int SkTSect<TCurve, OppCurve>::EndsEqual(const SkTSect<TCurve, OppCurve>* sect1, | 1724 int SkTSect<TCurve, OppCurve>::EndsEqual(const SkTSect<TCurve, OppCurve>* sect1, |
| 1725 const SkTSect<OppCurve, TCurve>* sect2, SkIntersections* intersections)
{ | 1725 const SkTSect<OppCurve, TCurve>* sect2, SkIntersections* intersections)
{ |
| 1726 int zeroOneSet = 0; | 1726 int zeroOneSet = 0; |
| 1727 if (sect1->fCurve[0] == sect2->fCurve[0]) { | 1727 if (sect1->fCurve[0] == sect2->fCurve[0]) { |
| 1728 zeroOneSet |= kZeroS1Set | kZeroS2Set; | 1728 zeroOneSet |= kZeroS1Set | kZeroS2Set; |
| 1729 intersections->insert(0, 0, sect1->fCurve[0]); | 1729 intersections->insert(0, 0, sect1->fCurve[0]); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 void merge(const SkClosestRecord& mate) { | 1816 void merge(const SkClosestRecord& mate) { |
| 1817 fC1Span = mate.fC1Span; | 1817 fC1Span = mate.fC1Span; |
| 1818 fC2Span = mate.fC2Span; | 1818 fC2Span = mate.fC2Span; |
| 1819 fClosest = mate.fClosest; | 1819 fClosest = mate.fClosest; |
| 1820 fC1Index = mate.fC1Index; | 1820 fC1Index = mate.fC1Index; |
| 1821 fC2Index = mate.fC2Index; | 1821 fC2Index = mate.fC2Index; |
| 1822 } | 1822 } |
| 1823 | 1823 |
| 1824 void reset() { | 1824 void reset() { |
| 1825 fClosest = FLT_MAX; | 1825 fClosest = FLT_MAX; |
| 1826 SkDEBUGCODE(fC1Span = NULL); | 1826 SkDEBUGCODE(fC1Span = nullptr); |
| 1827 SkDEBUGCODE(fC2Span = NULL); | 1827 SkDEBUGCODE(fC2Span = nullptr); |
| 1828 SkDEBUGCODE(fC1Index = fC2Index = -1); | 1828 SkDEBUGCODE(fC1Index = fC2Index = -1); |
| 1829 } | 1829 } |
| 1830 | 1830 |
| 1831 void update(const SkClosestRecord& mate) { | 1831 void update(const SkClosestRecord& mate) { |
| 1832 fC1StartT = SkTMin(fC1StartT, mate.fC1StartT); | 1832 fC1StartT = SkTMin(fC1StartT, mate.fC1StartT); |
| 1833 fC1EndT = SkTMax(fC1EndT, mate.fC1EndT); | 1833 fC1EndT = SkTMax(fC1EndT, mate.fC1EndT); |
| 1834 fC2StartT = SkTMin(fC2StartT, mate.fC2StartT); | 1834 fC2StartT = SkTMin(fC2StartT, mate.fC2StartT); |
| 1835 fC2EndT = SkTMax(fC2EndT, mate.fC2EndT); | 1835 fC2EndT = SkTMax(fC2EndT, mate.fC2EndT); |
| 1836 } | 1836 } |
| 1837 | 1837 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 } else if (intersections->isCoincident(index + 1)) { | 2086 } else if (intersections->isCoincident(index + 1)) { |
| 2087 intersections->removeOne(index + 1); | 2087 intersections->removeOne(index + 1); |
| 2088 --last; | 2088 --last; |
| 2089 } else { | 2089 } else { |
| 2090 intersections->setCoincident(index++); | 2090 intersections->setCoincident(index++); |
| 2091 } | 2091 } |
| 2092 intersections->setCoincident(index); | 2092 intersections->setCoincident(index); |
| 2093 } | 2093 } |
| 2094 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); | 2094 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); |
| 2095 } | 2095 } |
| OLD | NEW |