From 81681949d363f777809af167c70912ca2a612036 Mon Sep 17 00:00:00 2001 From: caryclark Date: Thu, 21 Jul 2016 10:44:07 -0700 Subject: [PATCH] allow curves on side of lines to be very small Increase the precision of the 'all on one side' pathops angle test to reduce the number of unorderable segments found by the cubics_d3 test. This allows pathsops_unittest release build with -v -V -x to run without error. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2168163002 Review-Url: https://codereview.chromium.org/2168163002 --- src/pathops/SkOpAngle.cpp | 8 ++++---- tests/PathOpsOpTest.cpp | 2 +- tools/pathops_sorter.htm | 8 +++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/pathops/SkOpAngle.cpp b/src/pathops/SkOpAngle.cpp index 479a6f6..2da8357 100644 --- a/src/pathops/SkOpAngle.cpp +++ b/src/pathops/SkOpAngle.cpp @@ -181,15 +181,15 @@ int SkOpAngle::allOnOneSide(const SkOpAngle* test) { SkASSERT(test->fIsCurve); SkDPoint origin = fCurvePart[0]; SkDVector line = fCurvePart[1] - origin; - float crosses[3]; + double crosses[3]; SkPath::Verb testVerb = test->segment()->verb(); int iMax = SkPathOpsVerbToPoints(testVerb); // SkASSERT(origin == test.fCurveHalf[0]); const SkDCurve& testCurve = test->fCurvePart; for (int index = 1; index <= iMax; ++index) { - float xy1 = (float) (line.fX * (testCurve[index].fY - origin.fY)); - float xy2 = (float) (line.fY * (testCurve[index].fX - origin.fX)); - crosses[index - 1] = AlmostEqualUlps(xy1, xy2) ? 0 : xy1 - xy2; + double xy1 = line.fX * (testCurve[index].fY - origin.fY); + double xy2 = line.fY * (testCurve[index].fX - origin.fX); + crosses[index - 1] = AlmostBequalUlps(xy1, xy2) ? 0 : xy1 - xy2; } if (crosses[0] * crosses[1] < 0) { return -1; diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp index 2cc9f28..e964349 100644 --- a/tests/PathOpsOpTest.cpp +++ b/tests/PathOpsOpTest.cpp @@ -5348,7 +5348,7 @@ static void cubics_d3(skiatest::Reporter* reporter, const char* filename) { pathB.close(); // DEBUG_UNDER_DEVELOPMENT cubics_d3 disable expectation check for now // fails because segment 3 is marked as unorderable ? - testPathOpCheck(reporter, path, pathB, kDifference_SkPathOp, filename, !FLAGS_runFail); + testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); } static void cubics_o(skiatest::Reporter* reporter, const char* filename) { diff --git a/tools/pathops_sorter.htm b/tools/pathops_sorter.htm index 65868cd..c83067c 100644 --- a/tools/pathops_sorter.htm +++ b/tools/pathops_sorter.htm @@ -7,11 +7,9 @@
-{{{2, 6, 1, 2, 7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f}}} -{{{1, 2, 7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f, 2, 6}}} -{{{1.995156049728393555, 5.980457782745361328}, {2.08147298604749853, 5.917692615073925744}, {2.164281118403629023, 5.850987095630077128}, {2.242042064666748047, 5.780299663543701172}}} -{{{1.995156049728393555, 5.980457782745361328}, {1.82665117196054072, 6.185735619599722845}, {1.80264212281170999, 5.19703332512428684}, {1.994958639144897461, 5.979661464691162109}}} -{{{1.995156049728393555, 5.980457782745361328}, {1.825196881732315868, 6.187507280789372288}, {1.801190554235020613, 5.204762216940081565}, {2, 6}}} +{{{3.501392364501953125, 2.997215032577514648}, {3.501457691192626953, 2.997084617614746094}}} id=3 +{{{3.501392364501953125, 2.997215032577514648}, {3.503357251861000776, 2.995228720876561113}, {3.505322801636163721, 2.993241595853745718}, {3.507288694381713867, 2.99125361442565918}}} id=5 +{{{3.501392364501953125, 2.997215032577514648}, {3.373685992255707422, 3.126313863770498358}, {3.248105895472682469, 3.251894104527315754}, {3.125, 3.375}}} id=5
-- 2.7.4