fix pathops quad line intersection

git-svn-id: http://skia.googlecode.com/svn/trunk@12374 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pathops/SkDQuadLineIntersection.cpp b/src/pathops/SkDQuadLineIntersection.cpp
index 8fce7a0..bae003c 100644
--- a/src/pathops/SkDQuadLineIntersection.cpp
+++ b/src/pathops/SkDQuadLineIntersection.cpp
@@ -304,15 +304,10 @@
         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) {
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index 93d75d9..66fe087 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -3946,9 +3946,23 @@
     testSimplify(reporter, path);
 }
 
+static void testQuad11(skiatest::Reporter* reporter) {
+    SkPath path;
+    path.moveTo(2, 0);

+    path.quadTo(0, 1, 1, 2);

+    path.lineTo(1, 2);

+    path.close();

+    path.moveTo(0, 0);

+    path.lineTo(1, 1);

+    path.quadTo(1, 3, 3, 3);

+    path.close();

+    testSimplify(reporter, path);
+}

+
 static void (*firstTest)(skiatest::Reporter* ) = 0;
 
 static TestDesc tests[] = {
+    TEST(testQuad11),
     TEST(testQuad10),
     TEST(testQuad9),
     TEST(testTriangles4x),