Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Unified Diff: src/pathops/SkAddIntersections.cpp

Issue 21359002: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove space Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/pathops.gypi ('k') | src/pathops/SkDCubicIntersection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
}
« no previous file with comments | « gyp/pathops.gypi ('k') | src/pathops/SkDCubicIntersection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698