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

Unified Diff: src/pathops/SkDQuadLineIntersection.cpp

Issue 131103009: update pathops to circle sort (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: disable old test that still fails on linux 32 release Created 6 years, 8 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
« no previous file with comments | « src/pathops/SkDQuadIntersection.cpp ('k') | src/pathops/SkIntersectionHelper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkDQuadLineIntersection.cpp
diff --git a/src/pathops/SkDQuadLineIntersection.cpp b/src/pathops/SkDQuadLineIntersection.cpp
index bae003c18421355a0bc7e41390f72755a230d229..45daa10dbdd35a3cb4ebc1ce4a852935fa8e1890 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 }}};
« no previous file with comments | « src/pathops/SkDQuadIntersection.cpp ('k') | src/pathops/SkIntersectionHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698