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
This commit is contained in:
caryclark 2016-07-21 10:44:07 -07:00 committed by Commit bot
parent 85f0e63ca4
commit 81681949d3
3 changed files with 8 additions and 10 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -7,11 +7,9 @@
<div style="height:0">
<div id="angle">
{{{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
</div>
<div id="ref">