Index: tests/PathOpsOpTest.cpp |
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp |
index fbfa0b56a7efe01b13c23eccdaff1efaef8ba1c8..72689615706451b8e8899ac4a26de3f52a2d099e 100644 |
--- a/tests/PathOpsOpTest.cpp |
+++ b/tests/PathOpsOpTest.cpp |
@@ -713,11 +713,6 @@ static void cubicOp37d(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
} |
-// this fails to detect a cubic/cubic intersection |
-// the slight overlap is missed when the cubics are approximated by quadratics |
-// and the subsequent line/cubic intersection also (correctly) misses the intersection |
-// if the line/cubic was a matching line/approx.quadratic then the missing intersection |
-// could have been detected |
static void cubicOp38d(skiatest::Reporter* reporter, const char* filename) { |
SkPath path, pathB; |
path.setFillType(SkPath::kWinding_FillType); |
@@ -1795,9 +1790,6 @@ static void cubicOp85d(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
} |
-// this fails because the pair of nearly coincident cubics intersect at the ends |
-// but the line connected to one of the cubics at the same point does not intersect |
-// the other |
static void skpkkiste_to98(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
@@ -1934,7 +1926,7 @@ static void issue1417(skiatest::Reporter* reporter, const char* filename) { |
path2.lineTo(113.232177734375f, 173.5789947509765625f); |
path2.lineTo(113.232177734375f, 173.5789947509765625f); |
path2.close(); |
- |
+ // FIXME : difficult data, circle back later |
testPathOp(reporter, path1, path2, kUnion_PathOp, filename); |
} |
@@ -2056,9 +2048,6 @@ static void rectOp3x(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kXOR_PathOp, filename); |
} |
-// this fails to generate two interior line segments |
-// an earlier pathops succeeded, but still failed to generate one interior line segment |
-// (but was saved by assemble, which works around a single line missing segment) |
static void issue1435(skiatest::Reporter* reporter, const char* filename) { |
SkPath path1; |
path1.moveTo(160, 60); |
@@ -2256,7 +2245,7 @@ static void cubicOp91u(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kUnion_PathOp, filename); |
} |
-static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filename) { // add t cancel |
+static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(-1.24344979e-014f, 348); |
@@ -2277,7 +2266,7 @@ static void skpaaalgarve_org53(skiatest::Reporter* reporter, const char* filenam |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename) { // add t cancel |
+static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(1.99840144e-015f, 494); |
@@ -2300,7 +2289,7 @@ static void skpabcspark_ca103(skiatest::Reporter* reporter, const char* filename |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filename) { // partial coincidence |
+static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(670.537415f, 285); |
@@ -2326,7 +2315,7 @@ static void skpacesoftech_com47(skiatest::Reporter* reporter, const char* filena |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-static void skpact_com43(skiatest::Reporter* reporter, const char* filename) { // bridge op |
+static void skpact_com43(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(1.45716772e-016f, 924.336121f); |
@@ -2351,7 +2340,7 @@ static void skpact_com43(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) { // zero span |
+static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(320.097229f, 628.573669f); |
@@ -2375,7 +2364,7 @@ static void skpadbox_lt8(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) { // find chase op |
+static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(0, 926); |
@@ -2394,7 +2383,7 @@ static void skpadindex_de4(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) { // calc common |
+static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(205.605804f, 142.334625f); |
@@ -2418,7 +2407,7 @@ static void skpadithya_putr4_blogspot_com551(skiatest::Reporter* reporter, const |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) { // mark and chase winding |
+static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(-4.4408921e-016f, 682.5f); |
@@ -2439,7 +2428,7 @@ static void skpadspert_de11(skiatest::Reporter* reporter, const char* filename) |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filename) { // cubic/cubic intersect |
+static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
path.moveTo(324.071075f, 845.071045f); |
@@ -2466,7 +2455,7 @@ static void skpaiaigames_com870(skiatest::Reporter* reporter, const char* filena |
pathB.cubicTo(145, 715.477173f, 149.477158f, 711, 155, 711); |
pathB.lineTo(317, 711); |
pathB.close(); |
- testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+ testPathOpCheck(reporter, path, pathB, kIntersect_PathOp, filename, FLAGS_runFail); |
} |
static void cubicOp92i(skiatest::Reporter* reporter, const char* filename) { |
@@ -2724,7 +2713,6 @@ static void skpcarpetplanet_ru22(skiatest::Reporter* reporter, const char* filen |
testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
-// this fails because cubic/quad misses an intersection (failure is isolated in c/q int test) |
static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) { |
SkPath path; |
path.setFillType(SkPath::kEvenOdd_FillType); |
@@ -2748,7 +2736,7 @@ static void skpcarrot_is24(skiatest::Reporter* reporter, const char* filename) { |
pathB.cubicTo(1019.77502f, 679.955017f, 1020.08099f, 676.094971f, 1020.08099f, 672.161987f); |
pathB.cubicTo(1020.08002f, 630.73999f, 986.502014f, 597.161987f, 945.080994f, 597.161987f); |
pathB.close(); |
- testPathOpCheck(reporter, path, pathB, kIntersect_PathOp, filename, FLAGS_runFail); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
static void skpbangalorenest_com4(skiatest::Reporter* reporter, const char* filename) { |
@@ -3247,7 +3235,6 @@ static void findFirst1(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
} |
-// triggers addSimpleAngle with non-zero argument |
static void cubicOp112(skiatest::Reporter* reporter, const char* filename) { |
SkPath path, pathB; |
path.setFillType(SkPath::kWinding_FillType); |
@@ -3282,7 +3269,7 @@ static void cubicOp114(skiatest::Reporter* reporter, const char* filename) { |
pathB.moveTo(1, 3); |
pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1); |
pathB.close(); |
- testPathOpCheck(reporter, path, pathB, kIntersect_PathOp, filename, FLAGS_runFail); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
} |
static void cubicOp114asQuad(skiatest::Reporter* reporter, const char* filename) { |
@@ -3464,7 +3451,7 @@ static void issue2753(skiatest::Reporter* reporter, const char* filename) { |
path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f); |
path2.close(); |
- testPathOpCheck(reporter, path1, path2, kUnion_PathOp, filename, FLAGS_runFail); |
+ testPathOp(reporter, path1, path2, kUnion_PathOp, filename); |
} |
static void issue2808(skiatest::Reporter* reporter, const char* filename) { |
@@ -3509,12 +3496,335 @@ static void cubicOp115(skiatest::Reporter* reporter, const char* filename) { |
testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
} |
+static void testRect1(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, path2; |
+ path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction); |
+ path.addRect(30, 20, 50, 50, SkPath::kCCW_Direction); |
+ path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); |
+// path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction); |
+ testPathOp(reporter, path, path2, kUnion_PathOp, filename); |
+} |
+ |
+static void testRect2(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
+ path.addRect(4, 4, 5, 5, SkPath::kCW_Direction); |
+ pathB.setFillType(SkPath::kEvenOdd_FillType); |
+ pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
+ pathB.addRect(0, 0, 6, 6, SkPath::kCW_Direction); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void cubicOp116(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(4,6, 2,0, 2,0); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(0,2); |
+ pathB.cubicTo(0,2, 1,0, 6,4); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void cubicOp117(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(4,5, 6,0, 1,0); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(0,6); |
+ pathB.cubicTo(0,1, 1,0, 5,4); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void cubicOp118(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(4,6, 5,1, 6,2); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(1,5); |
+ pathB.cubicTo(2,6, 1,0, 6,4); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void loop1(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.moveTo(0,1); |
+ path.cubicTo(1,5, -5.66666651f,3.33333349f, 8.83333302f,2.33333349f); |
+ path.close(); |
+ pathB.moveTo(1,5); |
+ pathB.cubicTo(-5.66666651f,3.33333349f, 8.83333302f,2.33333349f, 0,1); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+#include "SkPathOpsCubic.h" |
+ |
+static void loop1asQuad(skiatest::Reporter* reporter, const char* filename) { |
+ SkDCubic c1 = {{{0,1}, {1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}}}; |
+ SkDCubic c2 = {{{1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}, {0,1}}}; |
+ double c1InflectionTs[2], c2InflectionTs[2]; |
+ SkDEBUGCODE(int c1InfTCount =) c1.findInflections(c1InflectionTs); |
+ SkASSERT(c1InfTCount == 2); |
+ SkDEBUGCODE(int c2InfTCount =) c2.findInflections(c2InflectionTs); |
+ SkASSERT(c2InfTCount == 1); |
+ SkASSERT(c1InflectionTs[0] > c1InflectionTs[1]); |
+ SkDCubicPair c1pair = c1.chopAt(c1InflectionTs[0]); |
+ SkDCubicPair c1apair = c1pair.first().chopAt(c1InflectionTs[1]); |
+ SkDCubicPair c2pair = c2.chopAt(c2InflectionTs[0]); |
+ SkDQuad q1[2] = { c1pair.first().toQuad(), c1pair.second().toQuad() }; |
+ SkDQuad q1a[2] = { c1apair.first().toQuad(), c1apair.second().toQuad() }; |
+ SkDQuad q2[2] = { c2pair.first().toQuad(), c2pair.second().toQuad() }; |
+ SkPath path, pathB; |
+ path.moveTo(q1a[0].fPts[0].asSkPoint()); |
+ path.quadTo(q1a[0].fPts[1].asSkPoint(), q1a[0].fPts[2].asSkPoint()); |
+ path.quadTo(q1a[1].fPts[1].asSkPoint(), q1a[1].fPts[2].asSkPoint()); |
+ path.quadTo(q1[1].fPts[1].asSkPoint(), q1[1].fPts[2].asSkPoint()); |
+ path.close(); |
+ pathB.moveTo(q2[0].fPts[0].asSkPoint()); |
+ pathB.quadTo(q2[0].fPts[1].asSkPoint(), q2[0].fPts[2].asSkPoint()); |
+ pathB.quadTo(q2[1].fPts[1].asSkPoint(), q2[1].fPts[2].asSkPoint()); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+static void loop2(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.moveTo(0,1); |
+ path.cubicTo(3,4, 3.f,4.f, 4.5f,1.5f); |
+ path.close(); |
+ pathB.moveTo(3,4); |
+ pathB.cubicTo(3.f,4.f, 4.5f,1.5f, 0,1); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+static void loop3(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.moveTo(0,1); |
+ path.cubicTo(3,5, -3.66666651f,0, 10.5f,-1.66666651f); |
+ path.close(); |
+ pathB.moveTo(3,5); |
+ pathB.cubicTo(-3.66666651f,0, 10.5f,-1.66666651f, 0,1); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+static void loop4(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.moveTo(0,5); |
+ path.cubicTo(1,5, 1,4, 0.833333313f,3); |
+ path.close(); |
+ pathB.moveTo(1,5); |
+ pathB.cubicTo(1,4, 0.833333313f,3, 0,5); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+#include "SkParsePath.h" |
+ |
+static void issue3517(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ |
+ const char str[] = "M31.35 57.75L31.35 57.75C31.9 57.7486 32.45 57.7948 33 57.7413C33.55 57.6878 34.1 57.5014 34.65 57.4291C35.2 57.3569 35.75 57.3223 36.3 57.3079C36.85 57.2935 37.4 57.3143 37.95 57.3428C38.5 57.3712 39.05 57.4112 39.6 57.4786C40.15 57.546 40.7 57.7029 41.25 57.7472C41.8 57.7916 42.35 57.7962 42.9 57.7445C43.45 57.6928 44 57.5345 44.55 57.4373C45.1 57.34 45.65 57.2115 46.2 57.1611C46.75 57.1107 47.3 57.1371 47.85 57.1349C48.4 57.1327 48.95 57.144 49.5 57.1478C50.05 57.1516 50.6 57.1553 51.15 57.1579C51.7 57.1605 52.25 57.1601 52.8 57.1634C53.35 57.1667 53.9 57.1731 54.45 57.1776C55 57.182 55.55 57.1916 56.1 57.19C56.65 57.1884 57.2 57.178 57.75 57.168C58.3 57.158 58.85 57.1355 59.4 57.1299C59.95 57.1243 60.5 57.1338 61.05 57.1345C61.6 57.1352 62.15 57.124 62.7 57.134C63.25 57.1441 63.8 57.1731 64.35 57.195C64.9 57.2169 65.45 57.2532 66 57.2655C66.55 57.2778 67.1 57.2647 67.65 57.2687C68.2 57.2728 68.75 57.267 69.3 57.2896C69.85 57.3122 70.4 57.371 70.95 57.4044C71.5 57.4377 72.05 57.4668 72.6 57.4896C73.15 57.5123 73.7 57.545 74.25 57.5408C74.8 57.5365 75.35 57.5068 75.9 57.4641C76.45 57.4213 77 57.3244 77.55 57.2842C78.1 57.244 78.65 57.2163 79.2 57.2228C79.75 57.2293 80.3 57.29 80.85 57.3232C81.4 57.3563 81.95 57.396 82.5 57.4219C83.05 57.4478 83.6 57.4637 84.15 57.4787C84.7 57.4937 85.25 57.5011 85.8 57.5121C86.35 57.523 86.9 57.5411 87.45 57.5444C88 57.5477 88.55 57.5663 89.1 57.5318C89.65 57.4972 90.2 57.3126 90.75 57.337C91.3 57.3613 91.85 57.6088 92.4 57.6776C92.95 57.7465 93.5 57.7379 94.05 57.75C94.6 57.7621 95.15 57.75 95.7 57.75L95.7 57.75L31.35 57.75Z"; |
+ SkParsePath::FromSVGString(str, &path); |
+ |
+ const char strB[] = "M31.35 57.75L31.35 57.75C31.9 57.7514 32.45 57.7052 33 57.7587C33.55 57.8122 34.1 57.9986 34.65 58.0709C35.2 58.1431 35.75 58.1777 36.3 58.1921C36.85 58.2065 37.4 58.1857 37.95 58.1572C38.5 58.1288 39.05 58.0888 39.6 58.0214C40.15 57.954 40.7 57.7971 41.25 57.7528C41.8 57.7084 42.35 57.7038 42.9 57.7555C43.45 57.8072 44 57.9655 44.55 58.0627C45.1 58.16 45.65 58.2885 46.2 58.3389C46.75 58.3893 47.3 58.3629 47.85 58.3651C48.4 58.3673 48.95 58.356 49.5 58.3522C50.05 58.3484 50.6 58.3447 51.15 58.3421C51.7 58.3395 52.25 58.3399 52.8 58.3366C53.35 58.3333 53.9 58.3269 54.45 58.3224C55 58.318 55.55 58.3084 56.1 58.31C56.65 58.3116 57.2 58.322 57.75 58.332C58.3 58.342 58.85 58.3645 59.4 58.3701C59.95 58.3757 60.5 58.3662 61.05 58.3655C61.6 58.3648 62.15 58.376 62.7 58.366C63.25 58.3559 63.8 58.3269 64.35 58.305C64.9 58.2831 65.45 58.2468 66 58.2345C66.55 58.2222 67.1 58.2353 67.65 58.2313C68.2 58.2272 68.75 58.233 69.3 58.2104C69.85 58.1878 70.4 58.129 70.95 58.0956C71.5 58.0623 72.05 58.0332 72.6 58.0104C73.15 57.9877 73.7 57.955 74.25 57.9592C74.8 57.9635 75.35 57.9932 75.9 58.0359C76.45 58.0787 77 58.1756 77.55 58.2158C78.1 58.256 78.65 58.2837 79.2 58.2772C79.75 58.2707 80.3 58.21 80.85 58.1768C81.4 58.1437 81.95 58.104 82.5 58.0781C83.05 58.0522 83.6 58.0363 84.15 58.0213C84.7 58.0063 85.25 57.9989 85.8 57.9879C86.35 57.977 86.9 57.9589 87.45 57.9556C88 57.9523 88.55 57.9337 89.1 57.9682C89.65 58.0028 90.2 58.1874 90.75 58.163C91.3 58.1387 91.85 57.8912 92.4 57.8224C92.95 57.7535 93.5 57.7621 94.05 57.75C94.6 57.7379 95.15 57.75 95.7 57.75L95.7 57.75L31.35 57.75Z"; |
+ SkParsePath::FromSVGString(strB, &pathB); |
+ testPathOp(reporter, path, pathB, kUnion_PathOp, filename); |
+} |
+ |
+static void cubicOp119(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(3,5, 2,1, 3,1); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(1,2); |
+ pathB.cubicTo(1,3, 1,0, 5,3); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+static void cubicOp120(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(2,4, 2,1, 4,0); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(1,2); |
+ pathB.cubicTo(0,4, 1,0, 4,2); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void cubicOp121(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(3,4, 3,2, 4,3); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(2,3); |
+ pathB.cubicTo(3,4, 1,0, 4,3); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+// FIXME : haven't debugged this failure yet |
+static void cubicOp122(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(3,5, 4,1, 4,0); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(1,4); |
+ pathB.cubicTo(0,4, 1,0, 5,3); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void cubicOp123(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(1,5, 2,0, 6,0); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(0,2); |
+ pathB.cubicTo(0,6, 1,0, 5,1); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void loop5(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.moveTo(0,2); |
+ path.cubicTo(1,2, 1,1.66666663f, 0.833333313f,1.33333325f); |
+ path.close(); |
+ pathB.moveTo(1,2); |
+ pathB.cubicTo(1,1.66666663f, 0.833333313f,1.33333325f, 0,2); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+static void loop6(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.moveTo(0,1); |
+ path.cubicTo(1,3, -1.66666675f,1.66666663f, 4.16666651f,1.00000012f); |
+ path.close(); |
+ pathB.moveTo(1,3); |
+ pathB.cubicTo(-1.66666675f,1.66666663f, 4.16666651f,1.00000012f, 0,1); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+static void cubicOp124(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(1,5, 6,0, 3,0); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(0,6); |
+ pathB.cubicTo(0,3, 1,0, 5,1); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void cubicOp125(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(3,6, 3,1, 6,2); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(1,3); |
+ pathB.cubicTo(2,6, 1,0, 6,3); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void cubicOp126(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(0,3, 6,0, 2,1); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(0,6); |
+ pathB.cubicTo(1,2, 1,0, 3,0); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void cubicOp127(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(1,5, 6,0, 3,0); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(0,6); |
+ pathB.cubicTo(0,3, 1,0, 5,1); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); |
+} |
+ |
+static void cubicOp128(skiatest::Reporter* reporter, const char* filename) { |
+ SkPath path, pathB; |
+ path.setFillType(SkPath::kWinding_FillType); |
+ path.moveTo(0,1); |
+ path.cubicTo(0,3, 3,2, 5,2); |
+ path.close(); |
+ pathB.setFillType(SkPath::kWinding_FillType); |
+ pathB.moveTo(2,3); |
+ pathB.cubicTo(2,5, 1,0, 3,0); |
+ pathB.close(); |
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
+} |
+ |
+static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0; |
static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; |
static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; |
static struct TestDesc tests[] = { |
+ TEST(cubicOp128), |
+ TEST(cubicOp127), |
+ TEST(cubicOp126), |
+ TEST(cubicOp125), |
+ TEST(cubicOp124), |
+ TEST(loop6), |
+ TEST(loop5), |
+ TEST(cubicOp123), |
+ TEST(cubicOp122), |
+ TEST(cubicOp121), |
+ TEST(cubicOp120), |
+ TEST(cubicOp119), |
+ TEST(loop4), |
+ TEST(loop3), |
+ TEST(loop2), |
+ TEST(loop1asQuad), |
+ TEST(loop1), |
+ TEST(issue3517), |
+ TEST(cubicOp118), |
+ TEST(cubicOp117), |
+ TEST(cubicOp116), |
+ TEST(testRect2), |
+ TEST(testRect1), |
TEST(cubicOp115), |
- TEST(issue2753), // FIXME: pair of cubics miss intersection |
+ TEST(issue2753), |
TEST(cubicOp114), // FIXME: curve with inflection is ordered the wrong way |
TEST(issue2808), |
TEST(cubicOp114asQuad), |
@@ -3527,8 +3837,6 @@ static struct TestDesc tests[] = { |
TEST(kari1), |
TEST(quadOp10i), |
TEST(cubicOp113), |
- // fails because a cubic/quadratic intersection is missed |
- // the internal quad/quad is far enough away from the real cubic/quad that it is rejected |
TEST(skpcarrot_is24), |
TEST(issue1417), |
TEST(cubicOp112), |
@@ -3555,7 +3863,7 @@ static struct TestDesc tests[] = { |
TEST(issue1435), |
TEST(cubicOp98x), |
TEST(cubicOp97x), |
- TEST(skpcarpetplanet_ru22), // cubic/cubic intersect detects unwanted coincidence |
+ TEST(skpcarpetplanet_ru22), |
TEST(cubicOp96d), |
TEST(cubicOp95u), |
TEST(skpadbox_lt15), |
@@ -3747,11 +4055,11 @@ DEF_TEST(PathOpsOp, reporter) { |
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); |
#endif |
if (runSubTests && runSubTestsFirst) { |
- RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse); |
+ RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse); |
} |
- RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse); |
+ RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse); |
if (runSubTests && !runSubTestsFirst) { |
- RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse); |
+ RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse); |
} |
} |
@@ -3760,7 +4068,7 @@ static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) { |
path.addRect(0,0, 300,170141183460469231731687303715884105728.f); |
SkPath pathB; |
pathB.addRect(0,0, 300,16); |
- testPathFailOp(reporter, path, pathB, kUnion_PathOp, filename); |
+ testPathOp(reporter, path, pathB, kUnion_PathOp, filename); |
} |
// m 100,0 60,170 -160,-110 200,0 -170,11000000000 z |
@@ -3780,7 +4088,7 @@ static void fuzz433(skiatest::Reporter* reporter, const char* filename) { |
path2.lineTo(-170 + 20,11000000000.0f + 20); |
path2.close(); |
- testPathFailOp(reporter, path1, path2, kIntersect_PathOp, filename); |
+ testPathOpCheck(reporter, path1, path2, kIntersect_PathOp, filename, FLAGS_runFail); |
} |
static void fuzz433b(skiatest::Reporter* reporter, const char* filename) { |
@@ -3803,7 +4111,7 @@ static void fuzz433b(skiatest::Reporter* reporter, const char* filename) { |
path2.lineTo(190, 60); |
path2.close(); |
- testPathFailOp(reporter, path1, path2, kUnion_PathOp, filename); |
+ testPathOpCheck(reporter, path1, path2, kUnion_PathOp, filename, FLAGS_runFail); |
} |
static void fuzz487a(skiatest::Reporter* reporter, const char* filename) { |
@@ -3849,7 +4157,7 @@ path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); |
path.close(); |
SkPath path2(path); |
- testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename); |
+ testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFail); |
} |
static void fuzz487b(skiatest::Reporter* reporter, const char* filename) { |
@@ -3895,7 +4203,7 @@ path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); |
path.close(); |
SkPath path2(path); |
- testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename); |
+ testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFail); |
} |
static void fuzz714(skiatest::Reporter* reporter, const char* filename) { |
@@ -3962,5 +4270,5 @@ DEF_TEST(PathOpsFailOp, reporter) { |
#if DEBUG_SHOW_TEST_NAME |
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); |
#endif |
- RunTestSet(reporter, failTests, failTestCount, 0, 0, false); |
+ RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false); |
} |