Index: src/pathops/SkAddIntersections.cpp |
diff --git a/src/pathops/SkAddIntersections.cpp b/src/pathops/SkAddIntersections.cpp |
index 05079845fed9dad737d03af79fdfdca6ba03bf22..5fa80ec50619f41a13f3592c9c7744207e5ef09d 100644 |
--- a/src/pathops/SkAddIntersections.cpp |
+++ b/src/pathops/SkAddIntersections.cpp |
@@ -363,15 +363,20 @@ bool AddIntersectTs(SkOpContour* test, SkOpContour* next) { |
if (pts == 2) { |
if (wn.segmentType() <= SkIntersectionHelper::kLine_Segment |
&& wt.segmentType() <= SkIntersectionHelper::kLine_Segment) { |
- wt.addCoincident(wn, ts, swap); |
- continue; |
- } |
- if (wn.segmentType() >= SkIntersectionHelper::kQuad_Segment |
+ if (wt.addCoincident(wn, ts, swap)) { |
+ continue; |
+ } |
+ ts.cleanUpCoincidence(); // prefer (t == 0 or t == 1) |
+ pts = 1; |
+ } else if (wn.segmentType() >= SkIntersectionHelper::kQuad_Segment |
&& wt.segmentType() >= SkIntersectionHelper::kQuad_Segment |
&& ts.isCoincident(0)) { |
SkASSERT(ts.coincidentUsed() == 2); |
- wt.addCoincident(wn, ts, swap); |
- continue; |
+ if (wt.addCoincident(wn, ts, swap)) { |
+ continue; |
+ } |
+ ts.cleanUpCoincidence(); // prefer (t == 0 or t == 1) |
+ pts = 1; |
} |
} |
if (pts >= 2) { |
@@ -380,7 +385,11 @@ bool AddIntersectTs(SkOpContour* test, SkOpContour* next) { |
const SkDPoint& next = ts.pt(pt + 1); |
if (wt.isNear(ts[swap][pt], ts[swap][pt + 1], point, next) |
&& wn.isNear(ts[!swap][pt], ts[!swap][pt + 1], point, next)) { |
- wt.addPartialCoincident(wn, ts, pt, swap); |
+ if (!wt.addPartialCoincident(wn, ts, pt, swap)) { |
+ // remove extra point if two map to same float values |
+ ts.cleanUpCoincidence(); // prefer (t == 0 or t == 1) |
+ pts = 1; |
+ } |
} |
} |
} |