aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-04-30 07:47:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-30 07:47:13 -0700
commitdc3088570f945ed0ede84f0af0016eedc267dda3 (patch)
treed502affda882bef7083b6cf3cce68c1029596a0e /src/pathops
parent30297c53bd233a6d9af7b422ad8a17912f1ef5e6 (diff)
use pathops utils to improve precision of cubic chopping in scan converter
Diffstat (limited to 'src/pathops')
-rw-r--r--src/pathops/SkDCubicLineIntersection.cpp10
-rw-r--r--src/pathops/SkPathOpsCubic.h11
2 files changed, 21 insertions, 0 deletions
diff --git a/src/pathops/SkDCubicLineIntersection.cpp b/src/pathops/SkDCubicLineIntersection.cpp
index f658b09f0b..ee1e3d3a34 100644
--- a/src/pathops/SkDCubicLineIntersection.cpp
+++ b/src/pathops/SkDCubicLineIntersection.cpp
@@ -425,3 +425,13 @@ int SkIntersections::intersectRay(const SkDCubic& cubic, const SkDLine& line) {
}
return fUsed;
}
+
+// SkDCubic accessors to Intersection utilities
+
+int SkDCubic::horizontalIntersect(double yIntercept, double roots[3]) const {
+ return LineCubicIntersections::HorizontalIntersect(*this, yIntercept, roots);
+}
+
+int SkDCubic::verticalIntersect(double xIntercept, double roots[3]) const {
+ return LineCubicIntersections::VerticalIntersect(*this, xIntercept, roots);
+}
diff --git a/src/pathops/SkPathOpsCubic.h b/src/pathops/SkPathOpsCubic.h
index f9d291056e..3d68151852 100644
--- a/src/pathops/SkPathOpsCubic.h
+++ b/src/pathops/SkPathOpsCubic.h
@@ -97,6 +97,17 @@ struct SkDCubic {
int searchRoots(double extremes[6], int extrema, double axisIntercept,
SearchAxis xAxis, double* validRoots) const;
+ /**
+ * Return the number of valid roots (0 < root < 1) for this cubic intersecting the
+ * specified horizontal line.
+ */
+ int horizontalIntersect(double yIntercept, double roots[3]) const;
+ /**
+ * Return the number of valid roots (0 < root < 1) for this cubic intersecting the
+ * specified vertical line.
+ */
+ int verticalIntersect(double xIntercept, double roots[3]) const;
+
const SkDCubic& set(const SkPoint pts[kPointCount]) {
fPts[0] = pts[0];
fPts[1] = pts[1];