Index: src/pathops/SkAddIntersections.cpp |
diff --git a/src/pathops/SkAddIntersections.cpp b/src/pathops/SkAddIntersections.cpp |
index bdc7ae256556b818cc4f00025d7ecab66cbeb777..04f5bc384c1e3cdac560a96a35219d76ffe34e86 100644 |
--- a/src/pathops/SkAddIntersections.cpp |
+++ b/src/pathops/SkAddIntersections.cpp |
@@ -508,16 +508,19 @@ bool AddIntersectTs(SkOpContour* test, SkOpContour* next, SkOpCoincidence* coinc |
SkOpPtT* testTAt = wt.segment()->addT(ts[swap][pt]); |
wn.segment()->debugValidate(); |
SkOpPtT* nextTAt = wn.segment()->addT(ts[!swap][pt]); |
- SkOpPtT* oppPrev = testTAt->oppPrev(nextTAt); |
- if (oppPrev) { |
- testTAt->addOpp(nextTAt, oppPrev); |
- } |
- if (testTAt->fPt != nextTAt->fPt) { |
- testTAt->span()->unaligned(); |
- nextTAt->span()->unaligned(); |
+ if (!testTAt->contains(nextTAt)) { |
+ SkOpPtT* oppPrev = testTAt->oppPrev(nextTAt); // Returns nullptr if pair |
+ if (oppPrev) { // already shares a pt-t loop. |
+ testTAt->span()->mergeMatches(nextTAt->span()); |
+ testTAt->addOpp(nextTAt, oppPrev); |
+ } |
+ if (testTAt->fPt != nextTAt->fPt) { |
+ testTAt->span()->unaligned(); |
+ nextTAt->span()->unaligned(); |
+ } |
+ wt.segment()->debugValidate(); |
+ wn.segment()->debugValidate(); |
} |
- wt.segment()->debugValidate(); |
- wn.segment()->debugValidate(); |
if (!ts.isCoincident(pt)) { |
continue; |
} |