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

Unified Diff: src/pathops/SkDCubicLineIntersection.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/SkDCubicLineIntersection.cpp
diff --git a/src/pathops/SkDCubicLineIntersection.cpp b/src/pathops/SkDCubicLineIntersection.cpp
index cbdce7789a800964d699393c0ec8d29f1b2951f5..b80b406e446eff923e5724638447032c14370085 100644
--- a/src/pathops/SkDCubicLineIntersection.cpp
+++ b/src/pathops/SkDCubicLineIntersection.cpp
@@ -6,6 +6,7 @@
*/
#include "SkIntersections.h"
#include "SkPathOpsCubic.h"
+#include "SkPathOpsCurve.h"
#include "SkPathOpsLine.h"
/*
@@ -291,6 +292,22 @@ public:
}
fIntersections->insert(cubicT, lineT, fCubic[cIndex]);
}
+ addLineNearEndPoints();
+ }
+
+ void addLineNearEndPoints() {
+ for (int lIndex = 0; lIndex < 2; ++lIndex) {
+ double lineT = (double) lIndex;
+ if (fIntersections->hasOppT(lineT)) {
+ continue;
+ }
+ double cubicT = ((SkDCurve*) &fCubic)->nearPoint(SkPath::kCubic_Verb,
+ fLine[lIndex], fLine[!lIndex]);
+ if (cubicT < 0) {
+ continue;
+ }
+ fIntersections->insert(cubicT, lineT, fLine[lIndex]);
+ }
}
void addExactHorizontalEndPoints(double left, double right, double y) {
@@ -316,7 +333,7 @@ public:
}
fIntersections->insert(cubicT, lineT, fCubic[cIndex]);
}
- // FIXME: see if line end is nearly on cubic
+ 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) {
@@ -342,7 +359,7 @@ public:
}
fIntersections->insert(cubicT, lineT, fCubic[cIndex]);
}
- // FIXME: see if line end is nearly on cubic
+ addLineNearEndPoints();
}
double findLineT(double t) {

Powered by Google App Engine
This is Rietveld 408576698