diff options
| author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-10 18:44:00 +0000 |
|---|---|---|
| committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-10 18:44:00 +0000 |
| commit | 7a90daf25878a7459ba9fbda581bb97cda034f02 (patch) | |
| tree | ea5b713f373f76be9f27c8a607aa67519c00bbbf /tests/PathTest.cpp | |
| parent | aef2d3b14eab4f86e7d0efef952e64b3546630ac (diff) | |
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
Diffstat (limited to 'tests/PathTest.cpp')
| -rw-r--r-- | tests/PathTest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index d8da95b23d..e124665026 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -31,6 +31,28 @@ static SkSurface* new_surface(int w, int h) { 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 @@ static void TestPath(skiatest::Reporter* reporter) { test_tricky_cubic(); test_clipped_cubic(); test_crbug_170666(); + test_bad_cubic_crbug229478(); } #include "TestClassDef.h" |
