| Index: src/pathops/SkDCubicLineIntersection.cpp
|
| diff --git a/src/pathops/SkDCubicLineIntersection.cpp b/src/pathops/SkDCubicLineIntersection.cpp
|
| index a891abec66f6bc4479760415715d56f18240b4bb..0abb75b394984476cfcf644ff6e4e0a0a513cf47 100644
|
| --- a/src/pathops/SkDCubicLineIntersection.cpp
|
| +++ b/src/pathops/SkDCubicLineIntersection.cpp
|
| @@ -107,6 +107,9 @@ public:
|
|
|
| int intersect() {
|
| addExactEndPoints();
|
| + if (fAllowNear) {
|
| + addNearEndPoints();
|
| + }
|
| double rootVals[3];
|
| int roots = intersectRay(rootVals);
|
| for (int index = 0; index < roots; ++index) {
|
| @@ -122,9 +125,6 @@ public:
|
| fIntersections->insert(cubicT, lineT, pt);
|
| }
|
| }
|
| - if (fAllowNear) {
|
| - addNearEndPoints();
|
| - }
|
| return fIntersections->used();
|
| }
|
|
|
| @@ -137,6 +137,9 @@ public:
|
|
|
| int horizontalIntersect(double axisIntercept, double left, double right, bool flipped) {
|
| addExactHorizontalEndPoints(left, right, axisIntercept);
|
| + if (fAllowNear) {
|
| + addNearHorizontalEndPoints(left, right, axisIntercept);
|
| + }
|
| double rootVals[3];
|
| int roots = horizontalIntersect(axisIntercept, rootVals);
|
| for (int index = 0; index < roots; ++index) {
|
| @@ -147,9 +150,6 @@ public:
|
| fIntersections->insert(cubicT, lineT, pt);
|
| }
|
| }
|
| - if (fAllowNear) {
|
| - addNearHorizontalEndPoints(left, right, axisIntercept);
|
| - }
|
| if (flipped) {
|
| fIntersections->flip();
|
| }
|
| @@ -165,6 +165,9 @@ public:
|
|
|
| int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped) {
|
| addExactVerticalEndPoints(top, bottom, axisIntercept);
|
| + if (fAllowNear) {
|
| + addNearVerticalEndPoints(top, bottom, axisIntercept);
|
| + }
|
| double rootVals[3];
|
| int roots = verticalIntersect(axisIntercept, rootVals);
|
| for (int index = 0; index < roots; ++index) {
|
| @@ -175,9 +178,6 @@ public:
|
| fIntersections->insert(cubicT, lineT, pt);
|
| }
|
| }
|
| - if (fAllowNear) {
|
| - addNearVerticalEndPoints(top, bottom, axisIntercept);
|
| - }
|
| if (flipped) {
|
| fIntersections->flip();
|
| }
|
| @@ -287,6 +287,17 @@ public:
|
| } else if (ptSet == kPointUninitialized) {
|
| *pt = fCubic.ptAtT(cT);
|
| }
|
| + SkPoint gridPt = pt->asSkPoint();
|
| + if (gridPt == fLine[0].asSkPoint()) {
|
| + *lineT = 0;
|
| + } else if (gridPt == fLine[1].asSkPoint()) {
|
| + *lineT = 1;
|
| + }
|
| + if (gridPt == fCubic[0].asSkPoint() && approximately_equal(*cubicT, 0)) {
|
| + *cubicT = 0;
|
| + } else if (gridPt == fCubic[3].asSkPoint() && approximately_equal(*cubicT, 1)) {
|
| + *cubicT = 1;
|
| + }
|
| return true;
|
| }
|
|
|
|
|