OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #define SUPPRESS_VISIBILITY_WARNING __attribute__((visibility("hidden"))) | 24 #define SUPPRESS_VISIBILITY_WARNING __attribute__((visibility("hidden"))) |
25 #endif | 25 #endif |
26 | 26 |
27 static SkSurface* new_surface(int w, int h) { | 27 static SkSurface* new_surface(int w, int h) { |
28 SkImage::Info info = { | 28 SkImage::Info info = { |
29 w, h, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType | 29 w, h, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType |
30 }; | 30 }; |
31 return SkSurface::NewRaster(info); | 31 return SkSurface::NewRaster(info); |
32 } | 32 } |
33 | 33 |
| 34 static void test_bad_cubic_crbug229478() { |
| 35 const SkPoint pts[] = { |
| 36 { 4595.91064f, -11596.9873f }, |
| 37 { 4597.2168f, -11595.9414f }, |
| 38 { 4598.52344f, -11594.8955f }, |
| 39 { 4599.83008f, -11593.8496f }, |
| 40 }; |
| 41 |
| 42 SkPath path; |
| 43 path.moveTo(pts[0]); |
| 44 path.cubicTo(pts[1], pts[2], pts[3]); |
| 45 |
| 46 SkPaint paint; |
| 47 paint.setStyle(SkPaint::kStroke_Style); |
| 48 paint.setStrokeWidth(20); |
| 49 |
| 50 SkPath dst; |
| 51 // Before the fix, this would infinite-recurse, and run out of stack |
| 52 // because we would keep trying to subdivide a degenerate cubic segment. |
| 53 paint.getFillPath(path, &dst, NULL); |
| 54 } |
| 55 |
34 static void build_path_170666(SkPath& path) { | 56 static void build_path_170666(SkPath& path) { |
35 path.moveTo(17.9459f, 21.6344f); | 57 path.moveTo(17.9459f, 21.6344f); |
36 path.lineTo(139.545f, -47.8105f); | 58 path.lineTo(139.545f, -47.8105f); |
37 path.lineTo(139.545f, -47.8105f); | 59 path.lineTo(139.545f, -47.8105f); |
38 path.lineTo(131.07f, -47.3888f); | 60 path.lineTo(131.07f, -47.3888f); |
39 path.lineTo(131.07f, -47.3888f); | 61 path.lineTo(131.07f, -47.3888f); |
40 path.lineTo(122.586f, -46.9532f); | 62 path.lineTo(122.586f, -46.9532f); |
41 path.lineTo(122.586f, -46.9532f); | 63 path.lineTo(122.586f, -46.9532f); |
42 path.lineTo(18076.6f, 31390.9f); | 64 path.lineTo(18076.6f, 31390.9f); |
43 path.lineTo(18076.6f, 31390.9f); | 65 path.lineTo(18076.6f, 31390.9f); |
(...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 test_strokerec(reporter); | 2368 test_strokerec(reporter); |
2347 test_addPoly(reporter); | 2369 test_addPoly(reporter); |
2348 test_isfinite(reporter); | 2370 test_isfinite(reporter); |
2349 test_isfinite_after_transform(reporter); | 2371 test_isfinite_after_transform(reporter); |
2350 test_arb_round_rect_is_convex(reporter); | 2372 test_arb_round_rect_is_convex(reporter); |
2351 test_arb_zero_rad_round_rect_is_rect(reporter); | 2373 test_arb_zero_rad_round_rect_is_rect(reporter); |
2352 test_addrect_isfinite(reporter); | 2374 test_addrect_isfinite(reporter); |
2353 test_tricky_cubic(); | 2375 test_tricky_cubic(); |
2354 test_clipped_cubic(); | 2376 test_clipped_cubic(); |
2355 test_crbug_170666(); | 2377 test_crbug_170666(); |
| 2378 test_bad_cubic_crbug229478(); |
2356 } | 2379 } |
2357 | 2380 |
2358 #include "TestClassDef.h" | 2381 #include "TestClassDef.h" |
2359 DEFINE_TESTCLASS("Path", PathTestClass, TestPath) | 2382 DEFINE_TESTCLASS("Path", PathTestClass, TestPath) |
OLD | NEW |