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

Unified Diff: src/pathops/SkOpAngle.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 | « src/pathops/SkIntersections.cpp ('k') | src/pathops/SkOpContour.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpAngle.cpp
diff --git a/src/pathops/SkOpAngle.cpp b/src/pathops/SkOpAngle.cpp
index c1e2eae831062c8abb337b100baeeb8e1d7a1200..5e1d9e745ebf98c14eed55dd874121155801de8f 100644
--- a/src/pathops/SkOpAngle.cpp
+++ b/src/pathops/SkOpAngle.cpp
@@ -131,6 +131,9 @@ bool SkOpAngle::operator<(const SkOpAngle& rh) const { // this/lh: left-hand; r
if (!SkDLine::NearRay(x, y, rx, ry) && x_ry != rx_y) {
return COMPARE_RESULT("7 !fComputed && !rh.fComputed", x_ry < rx_y);
}
+ if (fSide2 == 0 && rh.fSide2 == 0) {
+ return COMPARE_RESULT("7a !fComputed && !rh.fComputed", x_ry < rx_y);
+ }
} else {
// if the vector was a result of subdividing a curve, see if it is stable
bool sloppy1 = x_ry < rx_y;
@@ -142,8 +145,12 @@ bool SkOpAngle::operator<(const SkOpAngle& rh) const { // this/lh: left-hand; r
}
}
}
- if (fSide2 * rh.fSide2 == 0) {
-// SkASSERT(fSide2 + rh.fSide2 != 0); // hitting this assert means coincidence was undetected
+ if (fSide2 * rh.fSide2 == 0) { // one is zero
+#if DEBUG_ANGLE
+ if (fSide2 == rh.fSide2 && y_ry) { // both is zero; coincidence was undetected
+ SkDebugf("%s coincidence!\n", __FUNCTION__);
+ }
+#endif
return COMPARE_RESULT("9a fSide2 * rh.fSide2 == 0 ...", fSide2 < rh.fSide2);
}
// at this point, the initial tangent line is nearly coincident
@@ -409,8 +416,15 @@ void SkOpAngle::setSpans() {
#ifdef SK_DEBUG
void SkOpAngle::dump() const {
- SkDebugf("id=%d (%1.9g,%1.9g) start=%d (%1.9g) end=%d (%1.9g)\n", fSegment->debugID(),
- fSegment->xAtT(fStart), fSegment->yAtT(fStart), fStart, fSegment->span(fStart).fT,
- fEnd, fSegment->span(fEnd).fT);
+ const SkOpSpan& spanStart = fSegment->span(fStart);
+ const SkOpSpan& spanEnd = fSegment->span(fEnd);
+ const SkOpSpan& spanMin = fStart < fEnd ? spanStart : spanEnd;
+ SkDebugf("id=%d (%1.9g,%1.9g) start=%d (%1.9g) end=%d (%1.9g) sumWind=",
+ fSegment->debugID(), fSegment->xAtT(fStart), fSegment->yAtT(fStart),
+ fStart, spanStart.fT, fEnd, spanEnd.fT);
+ SkPathOpsDebug::WindingPrintf(spanMin.fWindSum);
+ SkDebugf(" oppWind=");
+ SkPathOpsDebug::WindingPrintf(spanMin.fOppSum),
+ SkDebugf(" done=%d\n", spanMin.fDone);
}
#endif
« no previous file with comments | « src/pathops/SkIntersections.cpp ('k') | src/pathops/SkOpContour.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698