split tight quads and conics
Tight quads and conics may nearly fold over on themselves, confusing
coincidence against other curves. Split them at their max curvature
early on to avoid complicating later logic.
TBR=reed@google.com
BUG=skia:5131
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2357353002
Review-Url: https://codereview.chromium.org/2357353002
diff --git a/tests/PathOpsConicLineIntersectionTest.cpp b/tests/PathOpsConicLineIntersectionTest.cpp
index 6219506..ecc4a47 100644
--- a/tests/PathOpsConicLineIntersectionTest.cpp
+++ b/tests/PathOpsConicLineIntersectionTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsTestCommon.h"
+#include "SkGeometry.h"
#include "SkIntersections.h"
#include "SkPathOpsConic.h"
#include "SkPathOpsLine.h"
@@ -103,7 +104,9 @@
SkPoint pts[3] = { conic.fPts.fPts[0].asSkPoint(), conic.fPts.fPts[1].asSkPoint(),
conic.fPts.fPts[2].asSkPoint() };
SkPoint reduced[3];
- SkPath::Verb order1 = SkReduceOrder::Conic(pts, conic.fWeight, reduced);
+ SkConic floatConic;
+ floatConic.set(pts, conic.fWeight);
+ SkPath::Verb order1 = SkReduceOrder::Conic(floatConic, reduced);
if (order1 != SkPath::kConic_Verb) {
SkDebugf("%s [%d] conic verb=%d\n", __FUNCTION__, iIndex, order1);
REPORTER_ASSERT(reporter, 0);
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index dd7a7f7..9bf60b7 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -165,6 +165,9 @@
const int testSetCount = (int) SK_ARRAY_COUNT(testSet);
static const SkDCubic newTestSet[] = {
+{ { { 130.0427549999999997, 11417.41309999999976 },{ 130.2331240000000037, 11418.3192999999992 },{ 131.0370790000000056, 11419 },{ 132, 11419 } } },
+{ { { 132, 11419 },{ 130.8954319999999996, 11419 },{ 130, 11418.10449999999946 },{ 130, 11417 } } },
+
{{{1,3}, {-1.0564518,1.79032254}, {1.45265341,0.229448318}, {1.45381773,0.22913377}}},
{{{1.45381773,0.22913377}, {1.45425761,0.229014933}, {1.0967741,0.451612949}, {0,1}}},
@@ -698,7 +701,7 @@
}
DEF_TEST(PathOpsCubicIntersectionOneOff, reporter) {
- newOneOff(reporter, 66, 70);
+ newOneOff(reporter, 0, 1);
}
DEF_TEST(PathOpsCubicIntersectionTestsOneOff, reporter) {
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 8ff0079..9bb3a0f 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -5375,6 +5375,26 @@
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
+static void loop17(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.moveTo(1, 2);
+ path.cubicTo(0, 3, -0.333333343f, 3.33333325f, 0.833333373f, 3.5f);
+ path.close();
+ pathB.moveTo(0, 3);
+ pathB.cubicTo(-0.333333343f, 3.33333325f, 0.833333373f, 3.5f, 1, 2);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
+}
+
+static void circlesOp4(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.addCircle(0, 1, 5, SkPath::kCW_Direction);
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.addCircle(0, 1, 0, SkPath::kCW_Direction);
+ testPathOp(reporter, path, pathB, kDifference_SkPathOp, 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;
@@ -5382,6 +5402,8 @@
#define TEST(name) { name, #name }
static struct TestDesc tests[] = {
+ TEST(circlesOp4),
+ TEST(loop17),
TEST(cubicOp158),
TEST(loops_i1),
TEST(loops_i2),
diff --git a/tests/PathOpsQuadIntersectionTest.cpp b/tests/PathOpsQuadIntersectionTest.cpp
index f012622..be3d5a8 100644
--- a/tests/PathOpsQuadIntersectionTest.cpp
+++ b/tests/PathOpsQuadIntersectionTest.cpp
@@ -53,6 +53,9 @@
}
static const SkDQuad testSet[] = {
+{{{-0.001019871095195412636, -0.008523519150912761688}, {-0.005396408028900623322, -0.005396373569965362549}, {-0.02855382487177848816, -0.02855364233255386353}}},
+{{{-0.004567248281091451645, -0.01482933573424816132}, {-0.01142475008964538574, -0.01140109263360500336}, {-0.02852955088019371033, -0.02847047336399555206}}},
+
{{{1, 1}, {0, 2}, {3, 3}}},
{{{3, 0}, {0, 1}, {1, 2}}},
diff --git a/tests/PathOpsSimplifyFailTest.cpp b/tests/PathOpsSimplifyFailTest.cpp
index 4da43b8..0166a84 100644
--- a/tests/PathOpsSimplifyFailTest.cpp
+++ b/tests/PathOpsSimplifyFailTest.cpp
@@ -154,7 +154,7 @@
path.moveTo(SkBits2Float(0x64b6b6b6), SkBits2Float(0xe9e9e900)); // 2.69638e+22f, -3.53475e+25f
path.quadTo(SkBits2Float(0xb6b6b6e9), SkBits2Float(0xb6b6b6b6), SkBits2Float(0xe9e9b6ce), SkBits2Float(0xe9e93ae9)); // -5.44532e-06f, -5.44529e-06f, -3.53179e+25f, -3.52447e+25f
- testSimplify(reporter, path, filename);
+ testSimplifyFuzz(reporter, path, filename);
}
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index 07e3720..55f0447 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -5256,7 +5256,7 @@
#if DEBUG_UNDER_DEVELOPMENT // tiger
return;
#endif
- uint64_t testlines = 0x0000000a01900c00; // best so far: 0x0000001d14c14bb1;
+ uint64_t testlines = 0x0000000000002008; // best so far: 0x0000001d14c14bb1;
tiger8a_x(reporter, filename, testlines);
}
@@ -5331,7 +5331,7 @@
#if DEBUG_UNDER_DEVELOPMENT // tiger
return;
#endif
- uint64_t testlines = 0x0000001000350204; // best so far: 0x0000000104080223
+ uint64_t testlines = 0x000000201304b4a3; // best so far: 0x000000201304b4a3
tiger8b_x(reporter, filename, testlines);
}
@@ -5870,11 +5870,10 @@
}
static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0;
-static void (*firstTest)(skiatest::Reporter* , const char* filename) = tiger8b_h_1;
+static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
static TestDesc tests[] = {
- TEST(testQuads73),
TEST(tiger8a_h_1),
TEST(tiger8a_h),
TEST(tiger8a),
@@ -5882,6 +5881,7 @@
TEST(tiger8b_h),
TEST(tiger8b),
TEST(tiger8),
+ TEST(testQuads73),
TEST(testQuads72),
TEST(testQuads71),
TEST(testQuads70),
diff --git a/tests/PathOpsThreeWayTest.cpp b/tests/PathOpsThreeWayTest.cpp
index bf634f9..6a93bfb 100644
--- a/tests/PathOpsThreeWayTest.cpp
+++ b/tests/PathOpsThreeWayTest.cpp
@@ -75,6 +75,6 @@
}
DEF_TEST(PathOpsThreeWayOneOff, reporter) {
- int index = 1;
+ int index = 0;
testSetTest(reporter, index);
}