diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-07 15:31:40 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-07 15:31:40 +0000 |
commit | 2db7fe7d3b7ee875e1099a22f0af17520696f5d7 (patch) | |
tree | 81988bda1bd4af551230aa03966589f97ebcadbe /tests/PathOpsOpTest.cpp | |
parent | 2d91efffdb57646a495de5bf859ff281ef86dd12 (diff) |
When solving the cubic line intersection directly fails, use binary search as a fallback.
The cubic line intersection math empirically works 99.99% of the time (fails 3100 out of 1B random tests) but when it fails, an intersection may be missed altogether.
The binary search is may not find a solution if the cubic line failed to find any solutions at all, but so far that case hasn't arisen.
BUG=skia:2504
TBR=reed@google.com
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/266063003
git-svn-id: http://skia.googlecode.com/svn/trunk@14614 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PathOpsOpTest.cpp')
-rw-r--r-- | tests/PathOpsOpTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp index 86baea423c..75b6030aa5 100644 --- a/tests/PathOpsOpTest.cpp +++ b/tests/PathOpsOpTest.cpp @@ -3329,10 +3329,30 @@ static void kari1(skiatest::Reporter* reporter, const char* filename) { testPathOp(reporter, path1, path2, kDifference_PathOp, filename); } +static void issue2504(skiatest::Reporter* reporter, const char* filename) { + SkPath path1; + path1.moveTo(34.2421875, -5.976562976837158203125); + path1.lineTo(35.453121185302734375, 0); + path1.lineTo(31.9375, 0); + path1.close(); + + SkPath path2; + path2.moveTo(36.71843719482421875, 0.8886508941650390625); + path2.cubicTo(36.71843719482421875, 0.8886508941650390625, + 35.123386383056640625, 0.554015457630157470703125, + 34.511409759521484375, -0.1152553558349609375); + path2.cubicTo(33.899425506591796875, -0.7845261096954345703125, + 34.53484344482421875, -5.6777553558349609375, + 34.53484344482421875, -5.6777553558349609375); + path2.close(); + testPathOp(reporter, path1, path2, kUnion_PathOp, filename); +} + static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; static struct TestDesc tests[] = { + TEST(issue2504), TEST(kari1), TEST(quadOp10i), #if 0 // FIXME: serpentine curve is ordered the wrong way |