Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: tests/PathTest.cpp

Issue 2142393003: handle large conic weights (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another double warning Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/GeometryTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after
4157 4170
4158 DEF_TEST(PathInterp, reporter) { 4171 DEF_TEST(PathInterp, reporter) {
4159 test_interp(reporter); 4172 test_interp(reporter);
4160 } 4173 }
4161 4174
4162 DEF_TEST(PathContains, reporter) { 4175 DEF_TEST(PathContains, reporter) {
4163 test_contains(reporter); 4176 test_contains(reporter);
4164 } 4177 }
4165 4178
4166 DEF_TEST(Paths, reporter) { 4179 DEF_TEST(Paths, reporter) {
4180 test_fuzz_crbug_627414(reporter);
4167 test_path_crbug364224(); 4181 test_path_crbug364224();
4168 4182
4169 SkTSize<SkScalar>::Make(3,4); 4183 SkTSize<SkScalar>::Make(3,4);
4170 4184
4171 SkPath p, empty; 4185 SkPath p, empty;
4172 SkRect bounds, bounds2; 4186 SkRect bounds, bounds2;
4173 test_empty(reporter, p); 4187 test_empty(reporter, p);
4174 4188
4175 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); 4189 REPORTER_ASSERT(reporter, p.getBounds().isEmpty());
4176 4190
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4312 PathTest_Private::TestPathTo(reporter); 4326 PathTest_Private::TestPathTo(reporter);
4313 PathRefTest_Private::TestPathRef(reporter); 4327 PathRefTest_Private::TestPathRef(reporter);
4314 PathTest_Private::TestPathrefListeners(reporter); 4328 PathTest_Private::TestPathrefListeners(reporter);
4315 test_dump(reporter); 4329 test_dump(reporter);
4316 test_path_crbug389050(reporter); 4330 test_path_crbug389050(reporter);
4317 test_path_crbugskia2820(reporter); 4331 test_path_crbugskia2820(reporter);
4318 test_skbug_3469(reporter); 4332 test_skbug_3469(reporter);
4319 test_skbug_3239(reporter); 4333 test_skbug_3239(reporter);
4320 test_bounds_crbug_513799(reporter); 4334 test_bounds_crbug_513799(reporter);
4321 } 4335 }
OLDNEW
« no previous file with comments | « tests/GeometryTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698