Index: include/core/SkPath.h |
diff --git a/include/core/SkPath.h b/include/core/SkPath.h |
index 65612cbc938c63d643aefe8a6c0c39d5dca9021b..9300863c80a74e22e76425a499930bb73bb8fa46 100644 |
--- a/include/core/SkPath.h |
+++ b/include/core/SkPath.h |
@@ -413,6 +413,14 @@ public: |
*/ |
void rQuadTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2); |
+ void conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, |
+ SkScalar w); |
+ void conicTo(const SkPoint& p1, const SkPoint& p2, SkScalar w) { |
+ this->conicTo(p1.fX, p1.fY, p2.fX, p2.fY, w); |
+ } |
+ void rConicTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2, |
+ SkScalar w); |
+ |
/** Add a cubic bezier from the last point, approaching control points |
(x1,y1) and (x2,y2), and ending at (x3,y3). If no moveTo() call has been |
made for this contour, the first point is automatically set to (0,0). |
@@ -779,7 +787,8 @@ public: |
enum SegmentMask { |
kLine_SegmentMask = 1 << 0, |
kQuad_SegmentMask = 1 << 1, |
- kCubic_SegmentMask = 1 << 2 |
+ kConic_SegmentMask = 1 << 2, |
+ kCubic_SegmentMask = 1 << 3, |
}; |
/** |
@@ -793,9 +802,10 @@ public: |
kMove_Verb, //!< iter.next returns 1 point |
kLine_Verb, //!< iter.next returns 2 points |
kQuad_Verb, //!< iter.next returns 3 points |
+ kConic_Verb, //!< iter.next returns 3 points + iter.conicWeight() |
kCubic_Verb, //!< iter.next returns 4 points |
kClose_Verb, //!< iter.next returns 1 point (contour's moveTo pt) |
- kDone_Verb //!< iter.next returns 0 points |
+ kDone_Verb, //!< iter.next returns 0 points |
}; |
/** Iterate through all of the segments (lines, quadratics, cubics) of |
@@ -829,6 +839,12 @@ public: |
return this->doNext(pts); |
} |
+ /** |
+ * Return the weight for the current conic. Only valid if the current |
+ * segment return by next() was a conic. |
+ */ |
+ SkScalar conicWeight() const { return *fConicWeights; } |
+ |
/** If next() returns kLine_Verb, then this query returns true if the |
line was the result of a close() command (i.e. the end point is the |
initial moveto for this contour). If next() returned a different |
@@ -848,6 +864,7 @@ public: |
const SkPoint* fPts; |
const uint8_t* fVerbs; |
const uint8_t* fVerbStop; |
+ const SkScalar* fConicWeights; |
SkPoint fMoveTo; |
SkPoint fLastPt; |
SkBool8 fForceClose; |
@@ -879,10 +896,13 @@ public: |
*/ |
Verb next(SkPoint pts[4]); |
+ SkScalar conicWeight() const { return *fConicWeights; } |
+ |
private: |
const SkPoint* fPts; |
const uint8_t* fVerbs; |
const uint8_t* fVerbStop; |
+ const SkScalar* fConicWeights; |
SkPoint fMoveTo; |
SkPoint fLastPt; |
}; |
@@ -922,7 +942,7 @@ private: |
kIsOval_SerializationShift = 24, // requires 1 bit |
kConvexity_SerializationShift = 16, // requires 2 bits |
kFillType_SerializationShift = 8, // requires 2 bits |
- kSegmentMask_SerializationShift = 0 // requires 3 bits |
+ kSegmentMask_SerializationShift = 0 // requires 4 bits |
}; |
#if SK_DEBUG_PATH_REF |