Index: src/pathops/SkDQuadIntersection.cpp |
diff --git a/src/pathops/SkDQuadIntersection.cpp b/src/pathops/SkDQuadIntersection.cpp |
index 685a01f70fc6bead88541952cd9880f3580a1ccc..14ccac61869f89d7fddeff364001e6a2e17042a9 100644 |
--- a/src/pathops/SkDQuadIntersection.cpp |
+++ b/src/pathops/SkDQuadIntersection.cpp |
@@ -4,7 +4,6 @@ |
// The downside of this approach is that early rejects are difficult to come by. |
// http://planetmath.org/encyclopedia/GaloisTheoreticDerivationOfTheQuarticFormula.html#step |
- |
#include "SkDQuadImplicit.h" |
#include "SkIntersections.h" |
#include "SkPathOpsLine.h" |
@@ -159,10 +158,13 @@ static bool is_linear_inner(const SkDQuad& q1, double t1s, double t1e, const SkD |
int roots = rootTs.intersect(q2, *testLines[index]); |
for (int idx2 = 0; idx2 < roots; ++idx2) { |
double t = rootTs[0][idx2]; |
-#ifdef SK_DEBUG |
+#if 0 // def SK_DEBUG // FIXME : accurate for error = 16, error of 17.5 seen |
+// {{{136.08723965397621, 1648.2814535211637}, {593.49031197259478, 1190.8784277439891}, {593.49031197259478, 544.0128173828125}}} |
+// {{{-968.181396484375, 544.0128173828125}, {592.2825927734375, 870.552490234375}, {593.435302734375, 557.8828125}}} |
+ |
SkDPoint qPt = q2.ptAtT(t); |
SkDPoint lPt = testLines[index]->ptAtT(rootTs[1][idx2]); |
- SkASSERT(qPt.approximatelyPEqual(lPt)); |
+ SkASSERT(qPt.approximatelyDEqual(lPt)); |
#endif |
if (approximately_negative(t - t2s) || approximately_positive(t - t2e)) { |
continue; |
@@ -305,10 +307,10 @@ static bool binary_search(const SkDQuad& quad1, const SkDQuad& quad2, double* t1 |
#endif |
return true; |
} |
- if (calcMask & (1 << 0)) t1[0] = quad1.ptAtT(*t1Seed - tStep); |
- if (calcMask & (1 << 2)) t1[2] = quad1.ptAtT(*t1Seed + tStep); |
- if (calcMask & (1 << 3)) t2[0] = quad2.ptAtT(*t2Seed - tStep); |
- if (calcMask & (1 << 5)) t2[2] = quad2.ptAtT(*t2Seed + tStep); |
+ if (calcMask & (1 << 0)) t1[0] = quad1.ptAtT(SkTMax(0., *t1Seed - tStep)); |
+ if (calcMask & (1 << 2)) t1[2] = quad1.ptAtT(SkTMin(1., *t1Seed + tStep)); |
+ if (calcMask & (1 << 3)) t2[0] = quad2.ptAtT(SkTMax(0., *t2Seed - tStep)); |
+ if (calcMask & (1 << 5)) t2[2] = quad2.ptAtT(SkTMin(1., *t2Seed + tStep)); |
double dist[3][3]; |
// OPTIMIZE: using calcMask value permits skipping some distance calcuations |
// if prior loop's results are moved to correct slot for reuse |
@@ -383,7 +385,7 @@ static void lookNearEnd(const SkDQuad& q1, const SkDQuad& q2, int testT, |
impTs.intersectRay(q1, tmpLine); |
for (int index = 0; index < impTs.used(); ++index) { |
SkDPoint realPt = impTs.pt(index); |
- if (!tmpLine[0].approximatelyEqual(realPt)) { |
+ if (!tmpLine[0].approximatelyPEqual(realPt)) { |
continue; |
} |
if (swap) { |