OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "SkOpCoincidence.h" | 7 #include "SkOpCoincidence.h" |
8 #include "SkOpSegment.h" | 8 #include "SkOpSegment.h" |
9 #include "SkPathOpsTSect.h" | 9 #include "SkPathOpsTSect.h" |
10 | 10 |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 if (overlap && os && oe && overlap->contains(os, oe)) { | 739 if (overlap && os && oe && overlap->contains(os, oe)) { |
740 return true; | 740 return true; |
741 } | 741 } |
742 SkASSERT(!cs || !cs->deleted()); | 742 SkASSERT(!cs || !cs->deleted()); |
743 SkASSERT(!os || !os->deleted()); | 743 SkASSERT(!os || !os->deleted()); |
744 SkASSERT(!ce || !ce->deleted()); | 744 SkASSERT(!ce || !ce->deleted()); |
745 SkASSERT(!oe || !oe->deleted()); | 745 SkASSERT(!oe || !oe->deleted()); |
746 const SkOpPtT* csExisting = !cs ? coinSeg->existing(coinTs, nullptr) : nullp
tr; | 746 const SkOpPtT* csExisting = !cs ? coinSeg->existing(coinTs, nullptr) : nullp
tr; |
747 const SkOpPtT* ceExisting = !ce ? coinSeg->existing(coinTe, nullptr) : nullp
tr; | 747 const SkOpPtT* ceExisting = !ce ? coinSeg->existing(coinTe, nullptr) : nullp
tr; |
748 FAIL_IF(csExisting && csExisting == ceExisting); | 748 FAIL_IF(csExisting && csExisting == ceExisting); |
749 FAIL_IF(csExisting && (csExisting == ce || | 749 // FAIL_IF(csExisting && (csExisting == ce || |
750 csExisting->contains(ceExisting ? ceExisting : ce))); | 750 // csExisting->contains(ceExisting ? ceExisting : ce))); |
751 FAIL_IF(ceExisting && (ceExisting == cs || | 751 FAIL_IF(ceExisting && (ceExisting == cs || |
752 ceExisting->contains(csExisting ? csExisting : cs))); | 752 ceExisting->contains(csExisting ? csExisting : cs))); |
753 const SkOpPtT* osExisting = !os ? oppSeg->existing(oppTs, nullptr) : nullptr
; | 753 const SkOpPtT* osExisting = !os ? oppSeg->existing(oppTs, nullptr) : nullptr
; |
754 const SkOpPtT* oeExisting = !oe ? oppSeg->existing(oppTe, nullptr) : nullptr
; | 754 const SkOpPtT* oeExisting = !oe ? oppSeg->existing(oppTe, nullptr) : nullptr
; |
755 FAIL_IF(osExisting && osExisting == oeExisting); | 755 FAIL_IF(osExisting && osExisting == oeExisting); |
756 FAIL_IF(osExisting && (osExisting == oe || | 756 FAIL_IF(osExisting && (osExisting == oe || |
757 osExisting->contains(oeExisting ? oeExisting : oe))); | 757 osExisting->contains(oeExisting ? oeExisting : oe))); |
758 FAIL_IF(oeExisting && (oeExisting == os || | 758 FAIL_IF(oeExisting && (oeExisting == os || |
759 oeExisting->contains(osExisting ? osExisting : os))); | 759 oeExisting->contains(osExisting ? osExisting : os))); |
760 // extra line in debug code | 760 // extra line in debug code |
761 this->debugValidate(); | 761 this->debugValidate(); |
762 if (!cs || !os) { | 762 if (!cs || !os) { |
763 SkOpPtT* csWritable = cs ? const_cast<SkOpPtT*>(cs) | 763 SkOpPtT* csWritable = cs ? const_cast<SkOpPtT*>(cs) |
764 : coinSeg->addT(coinTs); | 764 : coinSeg->addT(coinTs); |
| 765 if (csWritable == ce) { |
| 766 return true; |
| 767 } |
765 SkOpPtT* osWritable = os ? const_cast<SkOpPtT*>(os) | 768 SkOpPtT* osWritable = os ? const_cast<SkOpPtT*>(os) |
766 : oppSeg->addT(oppTs); | 769 : oppSeg->addT(oppTs); |
767 FAIL_IF(!csWritable || !osWritable); | 770 FAIL_IF(!csWritable || !osWritable); |
768 csWritable->span()->addOpp(osWritable->span()); | 771 csWritable->span()->addOpp(osWritable->span()); |
769 cs = csWritable; | 772 cs = csWritable; |
770 os = osWritable->active(); | 773 os = osWritable->active(); |
771 FAIL_IF((ce && ce->deleted()) || (oe && oe->deleted())); | 774 FAIL_IF((ce && ce->deleted()) || (oe && oe->deleted())); |
772 } | 775 } |
773 if (!ce || !oe) { | 776 if (!ce || !oe) { |
774 SkOpPtT* ceWritable = ce ? const_cast<SkOpPtT*>(ce) | 777 SkOpPtT* ceWritable = ce ? const_cast<SkOpPtT*>(ce) |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 this->release(fHead, coin); | 1600 this->release(fHead, coin); |
1598 } | 1601 } |
1599 } while ((coin = coin->next())); | 1602 } while ((coin = coin->next())); |
1600 } | 1603 } |
1601 | 1604 |
1602 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S
kOpPtT* testS, | 1605 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S
kOpPtT* testS, |
1603 const SkOpPtT* testE) const { | 1606 const SkOpPtT* testE) const { |
1604 return testS->segment()->testForCoincidence(testS, testE, testS->span(), | 1607 return testS->segment()->testForCoincidence(testS, testE, testS->span(), |
1605 testE->span(), outer->coinPtTStart()->segment()); | 1608 testE->span(), outer->coinPtTStart()->segment()); |
1606 } | 1609 } |
OLD | NEW |