path ops -- handle non-finite numbers
Op() and Simplify() do nothing if the input
is non-finite. Add code and tests.
Review URL: https://codereview.chromium.org/14407006
git-svn-id: http://skia.googlecode.com/svn/trunk@8882 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index 356f172..c0d13c8 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -3652,9 +3652,54 @@
testSimplify(reporter, path);
}
+// A test this for this case:
+// contourA has two segments that are coincident
+// contourB has two segments that are coincident in the same place
+// each ends up with +2/0 pairs for winding count
+// since logic in OpSegment::addTCoincident doesn't transfer count (only increments/decrements)
+// can this be resolved to +4/0 ?
+static void testAddTCoincident1(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.moveTo(2, 0);
+ path.lineTo(2, 2);
+ path.lineTo(1, 1);
+ path.lineTo(2, 0);
+ path.lineTo(2, 2);
+ path.lineTo(1, 1);
+ path.close();
+ path.moveTo(2, 0);
+ path.lineTo(2, 2);
+ path.lineTo(3, 1);
+ path.lineTo(2, 0);
+ path.lineTo(2, 2);
+ path.lineTo(3, 1);
+ path.close();
+ testSimplify(reporter, path);
+}
+
+// test with implicit close
+static void testAddTCoincident2(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.moveTo(2, 0);
+ path.lineTo(2, 2);
+ path.lineTo(1, 1);
+ path.lineTo(2, 0);
+ path.lineTo(2, 2);
+ path.lineTo(1, 1);
+ path.moveTo(2, 0);
+ path.lineTo(2, 2);
+ path.lineTo(3, 1);
+ path.lineTo(2, 0);
+ path.lineTo(2, 2);
+ path.lineTo(3, 1);
+ testSimplify(reporter, path);
+}
+
static void (*firstTest)(skiatest::Reporter* ) = 0;
static TestDesc tests[] = {
+ TEST(testAddTCoincident2),
+ TEST(testAddTCoincident1),
TEST(testTriangles2),
TEST(testTriangles1),
TEST(testQuadratic97),