diff options
-rw-r--r-- | src/pathops/SkDLineIntersection.cpp | 8 | ||||
-rw-r--r-- | tests/PathOpsLineIntersectionTest.cpp | 2 | ||||
-rwxr-xr-x | tests/PathOpsSkpTest.cpp | 49 |
3 files changed, 57 insertions, 2 deletions
diff --git a/src/pathops/SkDLineIntersection.cpp b/src/pathops/SkDLineIntersection.cpp index 33c8480cd5..f10b440404 100644 --- a/src/pathops/SkDLineIntersection.cpp +++ b/src/pathops/SkDLineIntersection.cpp @@ -228,7 +228,9 @@ int SkIntersections::horizontal(const SkDLine& line, double left, double right, fT[1][index] = 1 - fT[1][index]; } } - computePoints(line, result); + fPt[0].fX = xIntercept; + fPt[0].fY = y; + fUsed = 1; } } if (fAllowNear || result == 2) { @@ -314,7 +316,9 @@ int SkIntersections::vertical(const SkDLine& line, double top, double bottom, fT[1][index] = 1 - fT[1][index]; } } - computePoints(line, result); + fPt[0].fX = x; + fPt[0].fY = yIntercept; + fUsed = 1; } } if (fAllowNear || result == 2) { diff --git a/tests/PathOpsLineIntersectionTest.cpp b/tests/PathOpsLineIntersectionTest.cpp index f37a5091b4..9934731f7e 100644 --- a/tests/PathOpsLineIntersectionTest.cpp +++ b/tests/PathOpsLineIntersectionTest.cpp @@ -11,6 +11,8 @@ // FIXME: add tests for intersecting, non-intersecting, degenerate, coincident static const SkDLine tests[][2] = { + {{{{30,20}, {30,50}}}, {{{24,30}, {36,30}}}}, + {{{{323,193}, {-317,193}}}, {{{0,994}, {0,0}}}}, {{{{90,230}, {160,60}}}, {{{60,120}, {260,120}}}}, {{{{90,230}, {160,60}}}, {{{181.176468,120}, {135.294128,120}}}}, {{{{181.1764678955078125f, 120}, {186.3661956787109375f, 134.7042236328125f}}}, diff --git a/tests/PathOpsSkpTest.cpp b/tests/PathOpsSkpTest.cpp index 6e7c7ace92..4d6d3bfb69 100755 --- a/tests/PathOpsSkpTest.cpp +++ b/tests/PathOpsSkpTest.cpp @@ -1549,10 +1549,59 @@ static void skpgithub_io_26(skiatest::Reporter* reporter) { testPathOp(reporter, path, pathB, kIntersect_PathOp); } +static void skpskpicture14(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.setFillType(SkPath::kEvenOdd_FillType);
+ path.moveTo(0, 994);
+ path.lineTo(0, 0);
+ path.lineTo(512, 0);
+ path.lineTo(512, 994);
+ path.lineTo(0, 994);
+ path.close();
+ SkPath pathB;
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.moveTo(-317, 168);
+ pathB.quadTo(-317, 166.757385f, -316.121338f, 165.878662f);
+ pathB.quadTo(-315.242645f, 165, -314, 165);
+ pathB.lineTo(320, 165);
+ pathB.quadTo(321.242615f, 165, 322.121338f, 165.878662f);
+ pathB.quadTo(323, 166.757385f, 323, 168);
+ pathB.lineTo(323, 193);
+ pathB.lineTo(-317, 193);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kIntersect_PathOp);
+}
+
+static void skpskpicture15(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.setFillType(SkPath::kEvenOdd_FillType);
+ path.moveTo(0, 193);
+ path.lineTo(323, 193);
+ path.lineTo(323, 168);
+ path.quadTo(323, 166.757385f, 322.121338f, 165.878662f);
+ path.quadTo(321.242615f, 165, 320, 165);
+ path.lineTo(0, 165);
+ path.lineTo(0, 193);
+ path.close();
+ SkPath pathB;
+ pathB.setFillType(SkPath::kInverseWinding_FillType);
+ pathB.moveTo(-314, 165);
+ pathB.lineTo(320, 165);
+ pathB.cubicTo(321.65686f, 165, 323, 166.34314f, 323, 168);
+ pathB.lineTo(323, 192);
+ pathB.lineTo(-317, 192);
+ pathB.lineTo(-317, 168);
+ pathB.cubicTo(-317, 166.34314f, -315.65686f, 165, -314, 165);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kIntersect_PathOp);
+}
+ static void (*firstTest)(skiatest::Reporter* ) = 0; static struct TestDesc tests[] = { + TEST(skpskpicture14), #if TRY_SEPT_BROKEN_TESTS + TEST(skpskpicture15), TEST(skpwww_meb_gov_tr_6), TEST(skpwww_sciality_com_101), TEST(skpwww_booking_com_68), // similar to lavoixdunord |