Index: src/pathops/SkPathOpsCurve.h |
diff --git a/src/pathops/SkPathOpsCurve.h b/src/pathops/SkPathOpsCurve.h |
index 97e20be2b138b5501532403e76fceb70d591709e..dc9cec97e46c569a6aa76b47f7d012942fbbd37a 100644 |
--- a/src/pathops/SkPathOpsCurve.h |
+++ b/src/pathops/SkPathOpsCurve.h |
@@ -64,14 +64,17 @@ struct SkDCurve { |
return fCubic[n]; |
} |
- SkDPoint conicTop(const SkPoint curve[3], SkScalar curveWeight, |
+ SkDPoint conicTop(const SkPoint curve[3], SkScalar curveWeight, |
double s, double e, double* topT); |
SkDPoint cubicTop(const SkPoint curve[4], SkScalar , double s, double e, double* topT); |
+ void dump() const; |
void dumpID(int ) const; |
SkDPoint lineTop(const SkPoint[2], SkScalar , double , double , double* topT); |
+ double nearPoint(SkPath::Verb verb, const SkDPoint& xy, const SkDPoint& opp) const; |
+ void offset(SkPath::Verb verb, const SkDVector& ); |
SkDPoint quadTop(const SkPoint curve[3], SkScalar , double s, double e, double* topT); |
- void setConicBounds(const SkPoint curve[3], SkScalar curveWeight, |
+ void setConicBounds(const SkPoint curve[3], SkScalar curveWeight, |
double s, double e, SkPathOpsBounds* ); |
void setCubicBounds(const SkPoint curve[4], SkScalar , |
double s, double e, SkPathOpsBounds* ); |
@@ -115,6 +118,30 @@ static SkDPoint (* const CurveDPointAtT[])(const SkPoint[], SkScalar , double ) |
dcubic_xy_at_t |
}; |
+static SkDPoint ddline_xy_at_t(const SkDCurve& c, double t) { |
+ return c.fLine.ptAtT(t); |
+} |
+ |
+static SkDPoint ddquad_xy_at_t(const SkDCurve& c, double t) { |
+ return c.fQuad.ptAtT(t); |
+} |
+ |
+static SkDPoint ddconic_xy_at_t(const SkDCurve& c, double t) { |
+ return c.fConic.ptAtT(t); |
+} |
+ |
+static SkDPoint ddcubic_xy_at_t(const SkDCurve& c, double t) { |
+ return c.fCubic.ptAtT(t); |
+} |
+ |
+static SkDPoint (* const CurveDDPointAtT[])(const SkDCurve& , double ) = { |
herb_g
2016/07/18 15:13:39
Space before ","
caryclark
2016/07/18 15:55:49
The Skia style guide https://skia.org/dev/contrib/
|
+ nullptr, |
+ ddline_xy_at_t, |
+ ddquad_xy_at_t, |
+ ddconic_xy_at_t, |
+ ddcubic_xy_at_t |
+}; |
+ |
static SkPoint fline_xy_at_t(const SkPoint a[2], SkScalar weight, double t) { |
return dline_xy_at_t(a, weight, t).asSkPoint(); |
} |
@@ -171,6 +198,30 @@ static SkDVector (* const CurveDSlopeAtT[])(const SkPoint[], SkScalar , double ) |
dcubic_dxdy_at_t |
}; |
+static SkDVector ddline_dxdy_at_t(const SkDCurve& c, double ) { |
+ return c.fLine.fPts[1] - c.fLine.fPts[0]; |
+} |
+ |
+static SkDVector ddquad_dxdy_at_t(const SkDCurve& c, double t) { |
+ return c.fQuad.dxdyAtT(t); |
+} |
+ |
+static SkDVector ddconic_dxdy_at_t(const SkDCurve& c, double t) { |
+ return c.fConic.dxdyAtT(t); |
+} |
+ |
+static SkDVector ddcubic_dxdy_at_t(const SkDCurve& c, double t) { |
+ return c.fCubic.dxdyAtT(t); |
+} |
+ |
+static SkDVector (* const CurveDDSlopeAtT[])(const SkDCurve& , double ) = { |
+ nullptr, |
+ ddline_dxdy_at_t, |
+ ddquad_dxdy_at_t, |
+ ddconic_dxdy_at_t, |
+ ddcubic_dxdy_at_t |
+}; |
+ |
static SkVector fline_dxdy_at_t(const SkPoint a[2], SkScalar , double ) { |
return a[1] - a[0]; |
} |
@@ -269,6 +320,30 @@ static void (* const CurveIntersectRay[])(const SkPoint[] , SkScalar , const SkD |
cubic_intersect_ray |
}; |
+static void dline_intersect_ray(const SkDCurve& c, const SkDLine& ray, SkIntersections* i) { |
+ i->intersectRay(c.fLine, ray); |
+} |
+ |
+static void dquad_intersect_ray(const SkDCurve& c, const SkDLine& ray, SkIntersections* i) { |
+ i->intersectRay(c.fQuad, ray); |
+} |
+ |
+static void dconic_intersect_ray(const SkDCurve& c, const SkDLine& ray, SkIntersections* i) { |
+ i->intersectRay(c.fConic, ray); |
+} |
+ |
+static void dcubic_intersect_ray(const SkDCurve& c, const SkDLine& ray, SkIntersections* i) { |
+ i->intersectRay(c.fCubic, ray); |
+} |
+ |
+static void (* const CurveDIntersectRay[])(const SkDCurve& , const SkDLine& , SkIntersections* ) = { |
+ nullptr, |
+ dline_intersect_ray, |
+ dquad_intersect_ray, |
+ dconic_intersect_ray, |
+ dcubic_intersect_ray |
+}; |
+ |
static int line_intercept_h(const SkPoint a[2], SkScalar , SkScalar y, double* roots) { |
SkDLine line; |
roots[0] = SkIntersections::HorizontalIntercept(line.set(a), y); |