diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-25 13:39:12 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-25 13:39:12 +0000 |
commit | 28d219c5682af6dfacea2460b5ba2f9e98702de6 (patch) | |
tree | c2df00bd4d9c30852afb90942e2a598e838349ca /src/pathops/SkDQuadLineIntersection.cpp | |
parent | 27346f52cb0d5094732cb8154814b3b4d6c70cef (diff) |
fix pathops quad line intersection
git-svn-id: http://skia.googlecode.com/svn/trunk@12374 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pathops/SkDQuadLineIntersection.cpp')
-rw-r--r-- | src/pathops/SkDQuadLineIntersection.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/pathops/SkDQuadLineIntersection.cpp b/src/pathops/SkDQuadLineIntersection.cpp index 8fce7a089f..bae003c184 100644 --- a/src/pathops/SkDQuadLineIntersection.cpp +++ b/src/pathops/SkDQuadLineIntersection.cpp @@ -304,15 +304,10 @@ protected: SkDPoint xy = fQuad.ptAtT(t); double dx = fLine[1].fX - fLine[0].fX; double dy = fLine[1].fY - fLine[0].fY; - double dxT = (xy.fX - fLine[0].fX) / dx; - double dyT = (xy.fY - fLine[0].fY) / dy; - if (!between(FLT_EPSILON, dxT, 1 - FLT_EPSILON) && between(0, dyT, 1)) { - return dyT; + if (fabs(dx) > fabs(dy)) { + return (xy.fX - fLine[0].fX) / dx; } - if (!between(FLT_EPSILON, dyT, 1 - FLT_EPSILON) && between(0, dxT, 1)) { - return dxT; - } - return fabs(dx) > fabs(dy) ? dxT : dyT; + return (xy.fY - fLine[0].fY) / dy; } bool pinTs(double* quadT, double* lineT, SkDPoint* pt, PinTPoint ptSet) { |