fix bug introduced with SK_IGNORE_CUBIC_STROKE_FIX where we no longer respected
subDivide limit. This caused problems with degenate paths (too much recursion).
The fix was two parts:
1. decrement the subDivide limit as we recurse
2. up the limit for cubics to 7, to match our current quality
added unittest that replicated the too-much-recursion bug.
Review URL: https://codereview.chromium.org/14086002
git-svn-id: http://skia.googlecode.com/svn/trunk@8599 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index d8da95b..e124665 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -31,6 +31,28 @@
return SkSurface::NewRaster(info);
}
+static void test_bad_cubic_crbug229478() {
+ const SkPoint pts[] = {
+ { 4595.91064f, -11596.9873f },
+ { 4597.2168f, -11595.9414f },
+ { 4598.52344f, -11594.8955f },
+ { 4599.83008f, -11593.8496f },
+ };
+
+ SkPath path;
+ path.moveTo(pts[0]);
+ path.cubicTo(pts[1], pts[2], pts[3]);
+
+ SkPaint paint;
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(20);
+
+ SkPath dst;
+ // Before the fix, this would infinite-recurse, and run out of stack
+ // because we would keep trying to subdivide a degenerate cubic segment.
+ paint.getFillPath(path, &dst, NULL);
+}
+
static void build_path_170666(SkPath& path) {
path.moveTo(17.9459f, 21.6344f);
path.lineTo(139.545f, -47.8105f);
@@ -2353,6 +2375,7 @@
test_tricky_cubic();
test_clipped_cubic();
test_crbug_170666();
+ test_bad_cubic_crbug229478();
}
#include "TestClassDef.h"