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 <cmath> | 8 #include <cmath> |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGeometry.h" | 10 #include "SkGeometry.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 path->lineTo(3.747501373f, 2.724499941f); | 90 path->lineTo(3.747501373f, 2.724499941f); |
91 path->close(); | 91 path->close(); |
92 } | 92 } |
93 | 93 |
94 static void make_path_crbug364224_simplified(SkPath* path) { | 94 static void make_path_crbug364224_simplified(SkPath* path) { |
95 path->moveTo(3.747501373f, 2.724499941f); | 95 path->moveTo(3.747501373f, 2.724499941f); |
96 path->cubicTo(3.648251295f, 0.5194999576f, 3.575501442f, 0.4999999702f, 3.49
7501373f, 0.4999999702f); | 96 path->cubicTo(3.648251295f, 0.5194999576f, 3.575501442f, 0.4999999702f, 3.49
7501373f, 0.4999999702f); |
97 path->close(); | 97 path->close(); |
98 } | 98 } |
99 | 99 |
| 100 static void test_sect_with_horizontal_needs_pinning() { |
| 101 // Test that sect_with_horizontal in SkLineClipper.cpp needs to pin after co
mputing the |
| 102 // intersection. |
| 103 SkPath path; |
| 104 path.reset(); |
| 105 path.moveTo(-540000, -720000); |
| 106 path.lineTo(-9.10000017e-05f, 9.99999996e-13f); |
| 107 path.lineTo(1, 1); |
| 108 |
| 109 // Without the pinning code in sect_with_horizontal(), this would assert in
the lineclipper |
| 110 SkPaint paint; |
| 111 SkSurface::MakeRasterN32Premul(10, 10)->getCanvas()->drawPath(path, paint); |
| 112 } |
| 113 |
100 static void test_path_crbug364224() { | 114 static void test_path_crbug364224() { |
101 SkPath path; | 115 SkPath path; |
102 SkPaint paint; | 116 SkPaint paint; |
103 auto surface(SkSurface::MakeRasterN32Premul(84, 88)); | 117 auto surface(SkSurface::MakeRasterN32Premul(84, 88)); |
104 SkCanvas* canvas = surface->getCanvas(); | 118 SkCanvas* canvas = surface->getCanvas(); |
105 | 119 |
106 make_path_crbug364224_simplified(&path); | 120 make_path_crbug364224_simplified(&path); |
107 canvas->drawPath(path, paint); | 121 canvas->drawPath(path, paint); |
108 | 122 |
109 make_path_crbug364224(&path); | 123 make_path_crbug364224(&path); |
(...skipping 4111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4221 | 4235 |
4222 DEF_TEST(PathInterp, reporter) { | 4236 DEF_TEST(PathInterp, reporter) { |
4223 test_interp(reporter); | 4237 test_interp(reporter); |
4224 } | 4238 } |
4225 | 4239 |
4226 DEF_TEST(PathContains, reporter) { | 4240 DEF_TEST(PathContains, reporter) { |
4227 test_contains(reporter); | 4241 test_contains(reporter); |
4228 } | 4242 } |
4229 | 4243 |
4230 DEF_TEST(Paths, reporter) { | 4244 DEF_TEST(Paths, reporter) { |
| 4245 test_sect_with_horizontal_needs_pinning(); |
4231 test_crbug_629455(reporter); | 4246 test_crbug_629455(reporter); |
4232 test_fuzz_crbug_627414(reporter); | 4247 test_fuzz_crbug_627414(reporter); |
4233 test_path_crbug364224(); | 4248 test_path_crbug364224(); |
4234 | 4249 |
4235 SkTSize<SkScalar>::Make(3,4); | 4250 SkTSize<SkScalar>::Make(3,4); |
4236 | 4251 |
4237 SkPath p, empty; | 4252 SkPath p, empty; |
4238 SkRect bounds, bounds2; | 4253 SkRect bounds, bounds2; |
4239 test_empty(reporter, p); | 4254 test_empty(reporter, p); |
4240 | 4255 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4378 PathTest_Private::TestPathTo(reporter); | 4393 PathTest_Private::TestPathTo(reporter); |
4379 PathRefTest_Private::TestPathRef(reporter); | 4394 PathRefTest_Private::TestPathRef(reporter); |
4380 PathTest_Private::TestPathrefListeners(reporter); | 4395 PathTest_Private::TestPathrefListeners(reporter); |
4381 test_dump(reporter); | 4396 test_dump(reporter); |
4382 test_path_crbug389050(reporter); | 4397 test_path_crbug389050(reporter); |
4383 test_path_crbugskia2820(reporter); | 4398 test_path_crbugskia2820(reporter); |
4384 test_skbug_3469(reporter); | 4399 test_skbug_3469(reporter); |
4385 test_skbug_3239(reporter); | 4400 test_skbug_3239(reporter); |
4386 test_bounds_crbug_513799(reporter); | 4401 test_bounds_crbug_513799(reporter); |
4387 } | 4402 } |
OLD | NEW |