| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, -5, -8), path.getBounds()); | 612 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, -5, -8), path.getBounds()); |
| 613 | 613 |
| 614 path.addRect(SkRect::MakeLTRB(1, 2, 3, 4)); // should extend the bounds | 614 path.addRect(SkRect::MakeLTRB(1, 2, 3, 4)); // should extend the bounds |
| 615 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds()); | 615 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds()); |
| 616 | 616 |
| 617 path.moveTo(1, 2); // don't expect this to have changed the bounds | 617 path.moveTo(1, 2); // don't expect this to have changed the bounds |
| 618 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds()); | 618 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds()); |
| 619 #endif | 619 #endif |
| 620 } | 620 } |
| 621 | 621 |
| 622 #include "SkSurface.h" |
| 623 static void test_fuzz_crbug_627414(skiatest::Reporter* reporter) { |
| 624 SkPath path; |
| 625 path.moveTo(0, 0); |
| 626 path.conicTo(3.58732e-43f, 2.72084f, 3.00392f, 3.00392f, 8.46e+37f); |
| 627 |
| 628 SkPaint paint; |
| 629 paint.setAntiAlias(true); |
| 630 |
| 631 auto surf = SkSurface::MakeRasterN32Premul(100, 100); |
| 632 surf->getCanvas()->drawPath(path, paint); |
| 633 } |
| 634 |
| 622 // Inspired by http://ie.microsoft.com/testdrive/Performance/Chalkboard/ | 635 // Inspired by http://ie.microsoft.com/testdrive/Performance/Chalkboard/ |
| 623 // which triggered an assert, from a tricky cubic. This test replicates that | 636 // which triggered an assert, from a tricky cubic. This test replicates that |
| 624 // example, so we can ensure that we handle it (in SkEdge.cpp), and don't | 637 // example, so we can ensure that we handle it (in SkEdge.cpp), and don't |
| 625 // assert in the SK_DEBUG build. | 638 // assert in the SK_DEBUG build. |
| 626 static void test_tricky_cubic() { | 639 static void test_tricky_cubic() { |
| 627 const SkPoint pts[] = { | 640 const SkPoint pts[] = { |
| 628 { SkDoubleToScalar(18.8943768), SkDoubleToScalar(129.121277) }, | 641 { SkDoubleToScalar(18.8943768), SkDoubleToScalar(129.121277) }, |
| 629 { SkDoubleToScalar(18.8937435), SkDoubleToScalar(129.121689) }, | 642 { SkDoubleToScalar(18.8937435), SkDoubleToScalar(129.121689) }, |
| 630 { SkDoubleToScalar(18.8950119), SkDoubleToScalar(129.120422) }, | 643 { SkDoubleToScalar(18.8950119), SkDoubleToScalar(129.120422) }, |
| 631 { SkDoubleToScalar(18.5030727), SkDoubleToScalar(129.13121) }, | 644 { SkDoubleToScalar(18.5030727), SkDoubleToScalar(129.13121) }, |
| (...skipping 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4173 DEF_TEST(PathInterp, reporter) { | 4186 DEF_TEST(PathInterp, reporter) { |
| 4174 test_interp(reporter); | 4187 test_interp(reporter); |
| 4175 } | 4188 } |
| 4176 | 4189 |
| 4177 DEF_TEST(PathContains, reporter) { | 4190 DEF_TEST(PathContains, reporter) { |
| 4178 test_contains(reporter); | 4191 test_contains(reporter); |
| 4179 } | 4192 } |
| 4180 | 4193 |
| 4181 DEF_TEST(Paths, reporter) { | 4194 DEF_TEST(Paths, reporter) { |
| 4182 test_crbug_629455(reporter); | 4195 test_crbug_629455(reporter); |
| 4196 test_fuzz_crbug_627414(reporter); |
| 4183 test_path_crbug364224(); | 4197 test_path_crbug364224(); |
| 4184 | 4198 |
| 4185 SkTSize<SkScalar>::Make(3,4); | 4199 SkTSize<SkScalar>::Make(3,4); |
| 4186 | 4200 |
| 4187 SkPath p, empty; | 4201 SkPath p, empty; |
| 4188 SkRect bounds, bounds2; | 4202 SkRect bounds, bounds2; |
| 4189 test_empty(reporter, p); | 4203 test_empty(reporter, p); |
| 4190 | 4204 |
| 4191 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); | 4205 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); |
| 4192 | 4206 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4328 PathTest_Private::TestPathTo(reporter); | 4342 PathTest_Private::TestPathTo(reporter); |
| 4329 PathRefTest_Private::TestPathRef(reporter); | 4343 PathRefTest_Private::TestPathRef(reporter); |
| 4330 PathTest_Private::TestPathrefListeners(reporter); | 4344 PathTest_Private::TestPathrefListeners(reporter); |
| 4331 test_dump(reporter); | 4345 test_dump(reporter); |
| 4332 test_path_crbug389050(reporter); | 4346 test_path_crbug389050(reporter); |
| 4333 test_path_crbugskia2820(reporter); | 4347 test_path_crbugskia2820(reporter); |
| 4334 test_skbug_3469(reporter); | 4348 test_skbug_3469(reporter); |
| 4335 test_skbug_3239(reporter); | 4349 test_skbug_3239(reporter); |
| 4336 test_bounds_crbug_513799(reporter); | 4350 test_bounds_crbug_513799(reporter); |
| 4337 } | 4351 } |
| OLD | NEW |