simplify bug
The path contains a cubic with a very tight curve.
Split the cubic into pieces so that the individual
curves are better behaved.
Use both inflections and max curvature to
potentially split cubics. Since this may require
a bit of work, preflight to ignore cubics that
monotonically change in x and y.
Only one of the three tests referred to by the bug
below repro'd. Use path.dumpHex() instead of
path.dump() to capture the crashing data.
TBR=reed@google.com
BUG=skia:6041
Change-Id: I29a264f87242cacc7c421e7685b90aca81621c74
Reviewed-on: https://skia-review.googlesource.com/5702
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index e69aff8..638ecb0 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -645,13 +645,15 @@
for (int i = 0; i < 4; ++i) {
c[i] = cubic.fPts[i].asSkPoint();
}
- SkScalar loopT;
+ SkScalar loopT[3];
SkScalar d[3];
SkCubicType cubicType = SkClassifyCubic(c, d);
- if (SkDCubic::ComplexBreak(c, &loopT) && cubicType == SkCubicType::kLoop_SkCubicType) {
+ int breaks = SkDCubic::ComplexBreak(c, loopT);
+ SkASSERT(breaks < 2);
+ if (breaks && cubicType == SkCubicType::kLoop_SkCubicType) {
SkIntersections i;
SkPoint twoCubics[7];
- SkChopCubicAt(c, twoCubics, loopT);
+ SkChopCubicAt(c, twoCubics, loopT[0]);
SkDCubic chopped[2];
chopped[0].set(&twoCubics[0]);
chopped[1].set(&twoCubics[3]);