aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-30 13:37:48 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-30 13:37:48 +0000
commit91fc81c972c5ac4090f106d3b3fd9b26a3235ce1 (patch)
tree977d8c67df4ec1096a30bc08ddc09763342d4cc5 /src/pathops
parenta90c6803865766d28e92091f56f718f5e41fe80f (diff)
fix cubic/line intersection; add skp tests
BUG=skia:2488 TBR=reed Author: caryclark@google.com Review URL: https://codereview.chromium.org/252243003 git-svn-id: http://skia.googlecode.com/svn/trunk@14458 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pathops')
-rw-r--r--src/pathops/SkDCubicLineIntersection.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/pathops/SkDCubicLineIntersection.cpp b/src/pathops/SkDCubicLineIntersection.cpp
index abbc4e32b2..be38ddbfcf 100644
--- a/src/pathops/SkDCubicLineIntersection.cpp
+++ b/src/pathops/SkDCubicLineIntersection.cpp
@@ -302,10 +302,17 @@ public:
}
double cT = *cubicT = SkPinT(*cubicT);
double lT = *lineT = SkPinT(*lineT);
+ SkDPoint lPt = fLine.ptAtT(lT);
+ SkDPoint cPt = fCubic.ptAtT(cT);
+ if (!lPt.moreRoughlyEqual(cPt)) {
+ return false;
+ }
+ // FIXME: if points are roughly equal but not approximately equal, need to do
+ // a binary search like quad/quad intersection to find more precise t values
if (lT == 0 || lT == 1 || (ptSet == kPointUninitialized && cT != 0 && cT != 1)) {
- *pt = fLine.ptAtT(lT);
+ *pt = lPt;
} else if (ptSet == kPointUninitialized) {
- *pt = fCubic.ptAtT(cT);
+ *pt = cPt;
}
SkPoint gridPt = pt->asSkPoint();
if (gridPt == fLine[0].asSkPoint()) {