diff options
author | caryclark <caryclark@google.com> | 2016-10-18 07:59:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-18 07:59:44 -0700 |
commit | b36a3cd137e2b6c328854015018594bb9967e493 (patch) | |
tree | 78e6c88a0915d3004381a359f9a517341fe4aa97 /src/pathops/SkOpAngle.h | |
parent | c5eceb00adaa05e50ed732985a2df7db17c80053 (diff) |
break ambiguous angle sorting loop
A pair of cubics may be difficult to sort if the tangents suggest
one sort but the midpoints suggest a different one. When in this
gray area, and when the cumulative sort of all the angles fails to
resolve, reverse the sort to break the tie.
Before, when tiger8 was run through the signed distance field
generated directly from the path data, the simplify call might
hang since the angle could not be resolved. If the endless loop
is detected, and if there is no tie to break, just fail instead.
TBR=reed@google.com
BUG=skia:5131
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2426753002
Review-Url: https://codereview.chromium.org/2426753002
Diffstat (limited to 'src/pathops/SkOpAngle.h')
-rw-r--r-- | src/pathops/SkOpAngle.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/pathops/SkOpAngle.h b/src/pathops/SkOpAngle.h index cbdadf1039..3cebfff717 100644 --- a/src/pathops/SkOpAngle.h +++ b/src/pathops/SkOpAngle.h @@ -64,7 +64,7 @@ public: return fEnd; } - void insert(SkOpAngle* ); + bool insert(SkOpAngle* ); SkOpSpanBase* lastMarked() const; bool loopContains(const SkOpAngle* ) const; int loopCount() const; @@ -87,6 +87,10 @@ public: SkOpSpan* starter(); + bool tangentsAmbiguous() const { + return fTangentsAmbiguous; + } + bool unorderable() const { return fUnorderable; } @@ -97,7 +101,7 @@ private: bool checkCrossesZero() const; bool checkParallel(SkOpAngle* ); bool computeSector(); - int convexHullOverlaps(const SkOpAngle* ) const; + int convexHullOverlaps(const SkOpAngle* ); bool endToSide(const SkOpAngle* rh, bool* inside) const; bool endsIntersect(SkOpAngle* ); int findSector(SkPath::Verb verb, double x, double y) const; @@ -109,7 +113,7 @@ private: bool orderable(SkOpAngle* rh); // false == this < rh ; true == this > rh void setSector(); void setSpans(); - bool tangentsDiverge(const SkOpAngle* rh, double s0xt0) const; + bool tangentsDiverge(const SkOpAngle* rh, double s0xt0); SkDCurve fOriginalCurvePart; // the curve from start to end SkDCurveSweep fPart; // the curve from start to end offset as needed @@ -127,6 +131,7 @@ private: bool fComputeSector; bool fComputedSector; bool fCheckCoincidence; + bool fTangentsAmbiguous; SkDEBUGCODE(int fID); friend class PathOpsAngleTester; |