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

Unified Diff: src/pathops/SkAddIntersections.cpp

Issue 23542056: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: verbose + mutex around file number access Created 7 years, 2 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_unittest.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 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;
+ }
}
}
}
« no previous file with comments | « gyp/pathops_unittest.gypi ('k') | src/pathops/SkDCubicIntersection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698