diff options
author | caryclark <caryclark@google.com> | 2014-11-13 06:58:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-13 06:58:52 -0800 |
commit | 65f553182ab7069378ef863d30094d0327f178d0 (patch) | |
tree | 4e7a435941ae82ddd6cab0abcfb2ed7946f79969 /src/pathops/SkOpAngle.cpp | |
parent | b1cff03325c42bb1cd87204d9b0dd3d6b9678d3e (diff) |
These tests stress pathops by describing the union of circle-like paths that have tiny line segments embedded and double back to create near-coincident conditions.
The fixes include
- detect when finding the active top loops between two possible answers
- preflight chasing winding to ensure answer is consistent
- binary search more often when quadratic intersection fails
- add more failure paths when an intersect is missed
While this fixes the chrome bug, reenabling path ops in svg should be deferred until additional fixes are landed.
TBR=
BUG=421132
Committed: https://skia.googlesource.com/skia/+/6f726addf3178b01949bb389ef83cf14a1d7b6b2
Review URL: https://codereview.chromium.org/633393002
Diffstat (limited to 'src/pathops/SkOpAngle.cpp')
-rw-r--r-- | src/pathops/SkOpAngle.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/pathops/SkOpAngle.cpp b/src/pathops/SkOpAngle.cpp index 0c87d3ba9e..b3a188c1e8 100644 --- a/src/pathops/SkOpAngle.cpp +++ b/src/pathops/SkOpAngle.cpp @@ -409,7 +409,12 @@ bool SkOpAngle::endsIntersect(const SkOpAngle& rh) const { for (int index = 0; index < 2; ++index) { const SkOpSegment& segment = index ? *rh.fSegment : *fSegment; SkIntersections i; - (*CurveIntersectRay[index ? rPts : lPts])(segment.pts(), rays[index], &i); + int cPts = index ? rPts : lPts; + (*CurveIntersectRay[cPts])(segment.pts(), rays[index], &i); + // if the curve is a line, then the line and the ray intersect only at their crossing + if (cPts == 1) { // line + continue; + } // SkASSERT(i.used() >= 1); // if (i.used() <= 1) { // continue; @@ -657,7 +662,7 @@ void SkOpAngle::insert(SkOpAngle* angle) { } SkOpAngle* next = fNext; if (next->fNext == this) { - if (angle->overlap(*this)) { + if (angle->overlap(*this)) { // angles are essentially coincident return; } if (singleton || angle->after(this)) { @@ -777,7 +782,7 @@ bool SkOpAngle::merge(SkOpAngle* angle) { working = next; } while (working != angle); // it's likely that a pair of the angles are unorderable -#if DEBUG_ANGLE +#if 0 && DEBUG_ANGLE SkOpAngle* last = angle; working = angle->fNext; do { |