Index: src/pathops/SkAddIntersections.cpp |
diff --git a/src/pathops/SkAddIntersections.cpp b/src/pathops/SkAddIntersections.cpp |
index 0d654467139ffedc0ea1a9489ff04b2642116ccd..05079845fed9dad737d03af79fdfdca6ba03bf22 100644 |
--- a/src/pathops/SkAddIntersections.cpp |
+++ b/src/pathops/SkAddIntersections.cpp |
@@ -176,9 +176,10 @@ static void debugShowCubicIntersection(int , const SkIntersectionHelper& , |
bool AddIntersectTs(SkOpContour* test, SkOpContour* next) { |
if (test != next) { |
- if (test->bounds().fBottom < next->bounds().fTop) { |
+ if (AlmostLessUlps(test->bounds().fBottom, next->bounds().fTop)) { |
return false; |
} |
+ // OPTIMIZATION: outset contour bounds a smidgen instead? |
if (!SkPathOpsBounds::Intersects(test->bounds(), next->bounds())) { |
return true; |
} |
@@ -373,12 +374,22 @@ bool AddIntersectTs(SkOpContour* test, SkOpContour* next) { |
continue; |
} |
} |
+ if (pts >= 2) { |
+ for (int pt = 0; pt < pts - 1; ++pt) { |
+ const SkDPoint& point = ts.pt(pt); |
+ 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); |
+ } |
+ } |
+ } |
for (int pt = 0; pt < pts; ++pt) { |
SkASSERT(ts[0][pt] >= 0 && ts[0][pt] <= 1); |
SkASSERT(ts[1][pt] >= 0 && ts[1][pt] <= 1); |
SkPoint point = ts.pt(pt).asSkPoint(); |
- int testTAt = wt.addT(wn, point, ts[swap][pt]); |
- int nextTAt = wn.addT(wt, point, ts[!swap][pt]); |
+ int testTAt = wt.addT(wn, point, ts[swap][pt], swap && ts.isNear(pt)); |
+ int nextTAt = wn.addT(wt, point, ts[!swap][pt], !swap && ts.isNear(pt)); |
wt.addOtherT(testTAt, ts[!swap][pt], nextTAt); |
wn.addOtherT(nextTAt, ts[swap][pt], testTAt); |
} |
@@ -405,7 +416,7 @@ void AddSelfIntersectTs(SkOpContour* test) { |
SkASSERT(ts[1][0] >= 0 && ts[1][0] <= 1); |
SkPoint point = ts.pt(0).asSkPoint(); |
int testTAt = wt.addSelfT(wt, point, ts[0][0]); |
- int nextTAt = wt.addT(wt, point, ts[1][0]); |
+ int nextTAt = wt.addT(wt, point, ts[1][0], ts.isNear(0)); |
wt.addOtherT(testTAt, ts[1][0], nextTAt); |
wt.addOtherT(nextTAt, ts[0][0], testTAt); |
} while (wt.advance()); |
@@ -425,6 +436,6 @@ void CoincidenceCheck(SkTArray<SkOpContour*, true>* contourList, int total) { |
} |
for (int cIndex = 0; cIndex < contourCount; ++cIndex) { |
SkOpContour* contour = (*contourList)[cIndex]; |
- contour->findTooCloseToCall(); |
+ contour->calcPartialCoincidentWinding(); |
} |
} |