aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/SkPath.cpp2
-rw-r--r--tests/PathTest.cpp15
2 files changed, 10 insertions, 7 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 19592211ce..99d7e1a66e 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -2476,7 +2476,7 @@ SkPath::Convexity SkPath::internalGetConvexity() const {
if (!isFinite()) {
return kUnknown_Convexity;
}
- while ((verb = iter.next(pts, false, false)) != SkPath::kDone_Verb) {
+ while ((verb = iter.next(pts, true, true)) != SkPath::kDone_Verb) {
switch (verb) {
case kMove_Verb:
if (++contourCount > 1) {
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 8c629d9485..75e86e3f92 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1880,10 +1880,15 @@ 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();
@@ -1891,12 +1896,10 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
path.moveTo(0, 0);
path.lineTo(SkIntToScalar(100), 0);
path.lineTo(0, SkIntToScalar(100));
- // 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))));
+
+ 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.