OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkParse.h" | 10 #include "SkParse.h" |
11 #include "SkParsePath.h" | 11 #include "SkParsePath.h" |
12 #include "SkPath.h" | 12 #include "SkPath.h" |
13 #include "SkPathEffect.h" | 13 #include "SkPathEffect.h" |
14 #include "SkRRect.h" | 14 #include "SkRRect.h" |
15 #include "SkRandom.h" | 15 #include "SkRandom.h" |
16 #include "SkReader32.h" | 16 #include "SkReader32.h" |
17 #include "SkSize.h" | 17 #include "SkSize.h" |
18 #include "SkStream.h" | 18 #include "SkStream.h" |
19 #include "SkSurface.h" | 19 #include "SkSurface.h" |
20 #include "SkTypes.h" | 20 #include "SkTypes.h" |
21 #include "SkWriter32.h" | 21 #include "SkWriter32.h" |
22 #include "Test.h" | 22 #include "Test.h" |
23 | 23 |
| 24 static void set_radii(SkVector radii[4], int index, float rad) { |
| 25 sk_bzero(radii, sizeof(SkVector) * 4); |
| 26 radii[index].set(rad, rad); |
| 27 } |
| 28 |
| 29 static void test_add_rrect(skiatest::Reporter* reporter, const SkRect& bounds, |
| 30 const SkVector radii[4]) { |
| 31 SkRRect rrect; |
| 32 rrect.setRectRadii(bounds, radii); |
| 33 REPORTER_ASSERT(reporter, bounds == rrect.rect()); |
| 34 |
| 35 SkPath path; |
| 36 // this line should not assert in the debug build (from validate) |
| 37 path.addRRect(rrect); |
| 38 REPORTER_ASSERT(reporter, bounds == path.getBounds()); |
| 39 } |
| 40 |
| 41 static void test_skbug_3239(skiatest::Reporter* reporter) { |
| 42 const float min = SkBits2Float(0xcb7f16c8); /* -16717512.000000 */ |
| 43 const float max = SkBits2Float(0x4b7f1c1d); /* 16718877.000000 */ |
| 44 const float big = SkBits2Float(0x4b7f1bd7); /* 16718807.000000 */ |
| 45 |
| 46 const float rad = 33436320; |
| 47 |
| 48 const SkRect rectx = SkRect::MakeLTRB(min, min, max, big); |
| 49 const SkRect recty = SkRect::MakeLTRB(min, min, big, max); |
| 50 |
| 51 SkVector radii[4]; |
| 52 for (int i = 0; i < 4; ++i) { |
| 53 set_radii(radii, i, rad); |
| 54 test_add_rrect(reporter, rectx, radii); |
| 55 test_add_rrect(reporter, recty, radii); |
| 56 } |
| 57 } |
| 58 |
24 static void make_path_crbug364224(SkPath* path) { | 59 static void make_path_crbug364224(SkPath* path) { |
25 path->reset(); | 60 path->reset(); |
26 path->moveTo(3.747501373f, 2.724499941f); | 61 path->moveTo(3.747501373f, 2.724499941f); |
27 path->lineTo(3.747501373f, 3.75f); | 62 path->lineTo(3.747501373f, 3.75f); |
28 path->cubicTo(3.747501373f, 3.88774991f, 3.635501385f, 4.0f, 3.497501373f, 4
.0f); | 63 path->cubicTo(3.747501373f, 3.88774991f, 3.635501385f, 4.0f, 3.497501373f, 4
.0f); |
29 path->lineTo(0.7475013733f, 4.0f); | 64 path->lineTo(0.7475013733f, 4.0f); |
30 path->cubicTo(0.6095013618f, 4.0f, 0.4975013733f, 3.88774991f, 0.4975013733f
, 3.75f); | 65 path->cubicTo(0.6095013618f, 4.0f, 0.4975013733f, 3.88774991f, 0.4975013733f
, 3.75f); |
31 path->lineTo(0.4975013733f, 1.0f); | 66 path->lineTo(0.4975013733f, 1.0f); |
32 path->cubicTo(0.4975013733f, 0.8622499704f, 0.6095013618f, 0.75f, 0.74750137
33f,0.75f); | 67 path->cubicTo(0.4975013733f, 0.8622499704f, 0.6095013618f, 0.75f, 0.74750137
33f,0.75f); |
33 path->lineTo(3.497501373f, 0.75f); | 68 path->lineTo(3.497501373f, 0.75f); |
(...skipping 3688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3722 test_extendClosedPath(reporter); | 3757 test_extendClosedPath(reporter); |
3723 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); | 3758 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); |
3724 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); | 3759 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); |
3725 test_conicTo_special_case(reporter); | 3760 test_conicTo_special_case(reporter); |
3726 test_get_point(reporter); | 3761 test_get_point(reporter); |
3727 test_contains(reporter); | 3762 test_contains(reporter); |
3728 PathTest_Private::TestPathTo(reporter); | 3763 PathTest_Private::TestPathTo(reporter); |
3729 PathRefTest_Private::TestPathRef(reporter); | 3764 PathRefTest_Private::TestPathRef(reporter); |
3730 test_dump(reporter); | 3765 test_dump(reporter); |
3731 test_path_crbugskia2820(reporter); | 3766 test_path_crbugskia2820(reporter); |
| 3767 test_skbug_3239(reporter); |
3732 } | 3768 } |
OLD | NEW |