aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkDQuadLineIntersection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pathops/SkDQuadLineIntersection.cpp')
-rw-r--r--src/pathops/SkDQuadLineIntersection.cpp47
1 files changed, 6 insertions, 41 deletions
diff --git a/src/pathops/SkDQuadLineIntersection.cpp b/src/pathops/SkDQuadLineIntersection.cpp
index bae003c184..45daa10dbd 100644
--- a/src/pathops/SkDQuadLineIntersection.cpp
+++ b/src/pathops/SkDQuadLineIntersection.cpp
@@ -86,7 +86,6 @@ Thus, if the slope of the line tends towards vertical, we use:
C = ( (a ) - g'*(d ) - h' )
*/
-
class LineQuadraticIntersections {
public:
enum PinTPoint {
@@ -311,10 +310,10 @@ protected:
}
bool pinTs(double* quadT, double* lineT, SkDPoint* pt, PinTPoint ptSet) {
- if (!approximately_one_or_less(*lineT)) {
+ if (!approximately_one_or_less_double(*lineT)) {
return false;
}
- if (!approximately_zero_or_more(*lineT)) {
+ if (!approximately_zero_or_more_double(*lineT)) {
return false;
}
double qT = *quadT = SkPinT(*quadT);
@@ -326,13 +325,17 @@ protected:
}
SkPoint gridPt = pt->asSkPoint();
if (gridPt == fLine[0].asSkPoint()) {
+ *pt = fLine[0];
*lineT = 0;
} else if (gridPt == fLine[1].asSkPoint()) {
+ *pt = fLine[1];
*lineT = 1;
}
if (gridPt == fQuad[0].asSkPoint()) {
+ *pt = fQuad[0];
*quadT = 0;
} else if (gridPt == fQuad[2].asSkPoint()) {
+ *pt = fQuad[2];
*quadT = 1;
}
return true;
@@ -345,44 +348,6 @@ private:
bool fAllowNear;
};
-// utility for pairs of coincident quads
-static double horizontalIntersect(const SkDQuad& quad, const SkDPoint& pt) {
- LineQuadraticIntersections q(quad, *(static_cast<SkDLine*>(0)),
- static_cast<SkIntersections*>(0));
- double rootVals[2];
- int roots = q.horizontalIntersect(pt.fY, rootVals);
- for (int index = 0; index < roots; ++index) {
- double t = rootVals[index];
- SkDPoint qPt = quad.ptAtT(t);
- if (AlmostEqualUlps(qPt.fX, pt.fX)) {
- return t;
- }
- }
- return -1;
-}
-
-static double verticalIntersect(const SkDQuad& quad, const SkDPoint& pt) {
- LineQuadraticIntersections q(quad, *(static_cast<SkDLine*>(0)),
- static_cast<SkIntersections*>(0));
- double rootVals[2];
- int roots = q.verticalIntersect(pt.fX, rootVals);
- for (int index = 0; index < roots; ++index) {
- double t = rootVals[index];
- SkDPoint qPt = quad.ptAtT(t);
- if (AlmostEqualUlps(qPt.fY, pt.fY)) {
- return t;
- }
- }
- return -1;
-}
-
-double SkIntersections::Axial(const SkDQuad& q1, const SkDPoint& p, bool vertical) {
- if (vertical) {
- return verticalIntersect(q1, p);
- }
- return horizontalIntersect(q1, p);
-}
-
int SkIntersections::horizontal(const SkDQuad& quad, double left, double right, double y,
bool flipped) {
SkDLine line = {{{ left, y }, { right, y }}};