Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Unified Diff: src/pathops/SkDQuadLineIntersection.cpp

Issue 2128633003: pathops coincidence and security rewrite (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: require resulting t to be between 0 and 1 Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/pathops/SkDQuadLineIntersection.cpp
diff --git a/src/pathops/SkDQuadLineIntersection.cpp b/src/pathops/SkDQuadLineIntersection.cpp
index a3d10bc9ff108a09bedba6ae4c2dace2bee7b487..088a75c8bbc58a80bd6b804e47965157aef700e3 100644
--- a/src/pathops/SkDQuadLineIntersection.cpp
+++ b/src/pathops/SkDQuadLineIntersection.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "SkIntersections.h"
+#include "SkPathOpsCurve.h"
#include "SkPathOpsLine.h"
#include "SkPathOpsQuad.h"
@@ -98,11 +99,11 @@ public:
, fLine(&l)
, fIntersections(i)
, fAllowNear(true) {
- i->setMax(3); // allow short partial coincidence plus discrete intersection
+ i->setMax(4); // allow short partial coincidence plus discrete intersections
}
LineQuadraticIntersections(const SkDQuad& q)
- : fQuad(q)
+ : fQuad(q)
SkDEBUGPARAMS(fLine(nullptr))
SkDEBUGPARAMS(fIntersections(nullptr))
SkDEBUGPARAMS(fAllowNear(false)) {
@@ -297,7 +298,22 @@ protected:
}
fIntersections->insert(quadT, lineT, fQuad[qIndex]);
}
- // FIXME: see if line end is nearly on quad
+ addLineNearEndPoints();
+ }
+
+ void addLineNearEndPoints() {
+ for (int lIndex = 0; lIndex < 2; ++lIndex) {
+ double lineT = (double) lIndex;
+ if (fIntersections->hasOppT(lineT)) {
+ continue;
+ }
+ double quadT = ((SkDCurve*) &fQuad)->nearPoint(SkPath::kQuad_Verb,
+ (*fLine)[lIndex], (*fLine)[!lIndex]);
+ if (quadT < 0) {
+ continue;
+ }
+ fIntersections->insert(quadT, lineT, (*fLine)[lIndex]);
+ }
}
void addExactHorizontalEndPoints(double left, double right, double y) {
@@ -323,7 +339,7 @@ protected:
}
fIntersections->insert(quadT, lineT, fQuad[qIndex]);
}
- // FIXME: see if line end is nearly on quad
+ addLineNearEndPoints();
herb_g 2016/07/18 15:13:39 this->
caryclark 2016/07/18 15:55:49 Done.
}
void addExactVerticalEndPoints(double top, double bottom, double x) {
@@ -349,7 +365,7 @@ protected:
}
fIntersections->insert(quadT, lineT, fQuad[qIndex]);
}
- // FIXME: see if line end is nearly on quad
+ addLineNearEndPoints();
}
double findLineT(double t) {

Powered by Google App Engine
This is Rietveld 408576698