aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-09-15 14:23:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-15 19:13:24 +0000
commit53cd6c4331a2ef21a7c5eb6166c782cd33178a7b (patch)
treef6c1a9820eb66b4bdee1430f7da74d19c9ce0589 /tests
parent451b7439f57e967a3dd05ea156c3a8660ab7980f (diff)
Don't ignore degenerates when deciding if a path is convex
This ensures that a path with a second contour will always be marked concave. GrDefaultPathRenderer was incorrectly drawing paths of this type (thinking that it could fill them with simple triangulation). Bug: skia:7020 skia:1460 Change-Id: I62bfd72e4c61da427687acf53c552357b57707aa Reviewed-on: https://skia-review.googlesource.com/47082 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/PathTest.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 75e86e3f92..8c629d9485 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1880,15 +1880,10 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
// Test that multiple move commands do not cause asserts.
-
- // At the time of writing, this would not modify cached convexity. This caused an assert while
- // checking conservative containment again. https://bug.skia.org/1460
path.moveTo(SkIntToScalar(100), SkIntToScalar(100));
-#if 0
REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
SkIntToScalar(10),
SkIntToScalar(10))));
-#endif
// Same as above path and first test but with an extra moveTo.
path.reset();
@@ -1896,10 +1891,12 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
path.moveTo(0, 0);
path.lineTo(SkIntToScalar(100), 0);
path.lineTo(0, SkIntToScalar(100));
-
- REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
- SkIntToScalar(10),
- SkIntToScalar(10))));
+ // Convexity logic is now more conservative, so that multiple (non-trailing) moveTos make a
+ // path non-convex.
+ REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(
+ SkRect::MakeXYWH(SkIntToScalar(50), 0,
+ SkIntToScalar(10),
+ SkIntToScalar(10))));
// Same as above path and first test but with the extra moveTo making a degenerate sub-path
// following the non-empty sub-path. Verifies that this does not trigger assertions.