aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsCubicIntersectionTest.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-10-16 09:03:38 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-16 09:03:38 -0700
commit26ad22ab61539e3d3b6bc5e0da8dcebbd52a53de (patch)
treec2deb3596ffaa9aa5d8ebaf975ae71ef8e97e86a /tests/PathOpsCubicIntersectionTest.cpp
parent1a1d0b8d07d1d1cc2e56bb4790ff62179ba0c74c (diff)
Enabling clip stack flattening exercises path ops.
Iterating through the 903K skps that represent the imagable 1M top web pages triggers a number of bugs, some of which are addressed here. Some web pages trigger intersecting cubic representations of arc with their conic counterparts. This exposed a flaw in coincident detection that caused an infinite loop. The loop alternatively extended the coincident section and, determining the that the bounds of the curve pairs did not overlap, deleted the extension. Track the number of times the coincident detection is called, and if it exceeds an empirically found limit, assume that the curves are coincident and force it to be so. The loop count limit can be determined by enabling DEBUG_T_SECT_LOOP_COUNT and running all tests. The largest count is reported on completion. Another class of bugs was caused by concident detection duplicating nearly identical points that had been merged earlier. To track these bugs, the 'handle coincidence' code was duplicated as a const debug variety that reported if one of a dozen or so irregularities are present; then it is easier to see when a block of code that fixes one irregularity regresses another. Creating the debug const code version exposed some non-debug code that could be const, and some that was experimental and could be removed. Set DEBUG_COINCIDENCE to track coincidence health and handling. For running on Chrome, DEBUG_VERIFY checks the result of pathops against the same operation using SkRegion to verify that the results are nearly the same. When visualizing the pathops work using tools/pathops_visualizer.htm, set DEBUG_DUMP_ALIGNMENT to see the curves after they've been aligned for coincidence. Other bugs fixed include detecting when a section of a pair of curves have devolved into lines and are coincident. TBR=reed@google.com Review URL: https://codereview.chromium.org/1394503003
Diffstat (limited to 'tests/PathOpsCubicIntersectionTest.cpp')
-rw-r--r--tests/PathOpsCubicIntersectionTest.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index 6186ec8170..dd7a7f7e2f 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -437,6 +437,12 @@ static void newOneOff(skiatest::Reporter* reporter, int outer, int inner) {
oneOff(reporter, cubic1, cubic2, false);
}
+static void testsOneOff(skiatest::Reporter* reporter, int index) {
+ const SkDCubic& cubic1 = tests[index][0];
+ const SkDCubic& cubic2 = tests[index][1];
+ oneOff(reporter, cubic1, cubic2, false);
+}
+
static void oneOffTests(skiatest::Reporter* reporter) {
for (int outer = 0; outer < testSetCount - 1; ++outer) {
for (int inner = outer + 1; inner < testSetCount; ++inner) {
@@ -654,6 +660,11 @@ static void cubicIntersectionSelfTest(skiatest::Reporter* reporter) {
}
static const SkDCubic coinSet[] = {
+ {{{72.350448608398438, 27.966041564941406}, {72.58441162109375, 27.861515045166016},
+ {72.818222045898437, 27.756658554077148}, {73.394996643066406, 27.49799919128418}}},
+ {{{73.394996643066406, 27.49799919128418}, {72.818222045898437, 27.756658554077148},
+ {72.58441162109375, 27.861515045166016}, {72.350448608398438, 27.966041564941406}}},
+
{{{297.04998779296875, 43.928997039794922}, {297.04998779296875, 43.928997039794922},
{300.69699096679688, 45.391998291015625}, {306.92498779296875, 43.08599853515625}}},
{{{297.04998779296875, 43.928997039794922}, {297.04998779296875, 43.928997039794922},
@@ -687,7 +698,11 @@ DEF_TEST(PathOpsCubicCoinOneOff, reporter) {
}
DEF_TEST(PathOpsCubicIntersectionOneOff, reporter) {
- newOneOff(reporter, 0, 1);
+ newOneOff(reporter, 66, 70);
+}
+
+DEF_TEST(PathOpsCubicIntersectionTestsOneOff, reporter) {
+ testsOneOff(reporter, 10);
}
DEF_TEST(PathOpsCubicSelfOneOff, reporter) {