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

Unified Diff: src/pathops/SkDConicLineIntersection.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/SkDConicLineIntersection.cpp
diff --git a/src/pathops/SkDConicLineIntersection.cpp b/src/pathops/SkDConicLineIntersection.cpp
index 710647236cb56c2565ece34bba060c066bad7f35..be55567f2c730466e859e628ba0b90128c94524b 100644
--- a/src/pathops/SkDConicLineIntersection.cpp
+++ b/src/pathops/SkDConicLineIntersection.cpp
@@ -6,6 +6,7 @@
*/
#include "SkIntersections.h"
#include "SkPathOpsConic.h"
+#include "SkPathOpsCurve.h"
#include "SkPathOpsLine.h"
class LineConicIntersections {
@@ -199,7 +200,22 @@ protected:
}
fIntersections->insert(conicT, lineT, fConic[cIndex]);
}
- // FIXME: see if line end is nearly on conic
+ addLineNearEndPoints();
+ }
+
+ void addLineNearEndPoints() {
+ for (int lIndex = 0; lIndex < 2; ++lIndex) {
+ double lineT = (double) lIndex;
+ if (fIntersections->hasOppT(lineT)) {
+ continue;
+ }
+ double conicT = ((SkDCurve*) &fConic)->nearPoint(SkPath::kConic_Verb,
+ (*fLine)[lIndex], (*fLine)[!lIndex]);
+ if (conicT < 0) {
+ continue;
+ }
+ fIntersections->insert(conicT, lineT, (*fLine)[lIndex]);
+ }
}
void addExactHorizontalEndPoints(double left, double right, double y) {
@@ -225,7 +241,7 @@ protected:
}
fIntersections->insert(conicT, lineT, fConic[cIndex]);
}
- // FIXME: see if line end is nearly on conic
+ addLineNearEndPoints();
herb_g 2016/07/18 15:13:38 this->?
caryclark 2016/07/18 15:55:49 Done.
}
void addExactVerticalEndPoints(double top, double bottom, double x) {
@@ -251,7 +267,7 @@ protected:
}
fIntersections->insert(conicT, lineT, fConic[cIndex]);
}
- // FIXME: see if line end is nearly on conic
+ addLineNearEndPoints();
}
double findLineT(double t) {

Powered by Google App Engine
This is Rietveld 408576698