Chromium Code Reviews| Index: include/core/SkPathEffect.h |
| diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h |
| index 86ccf86a9223eedb59dfb7361102bfb067177868..9ccedc39739e77ca088ef0afbe5d4b16eae5f00c 100644 |
| --- a/include/core/SkPathEffect.h |
| +++ b/include/core/SkPathEffect.h |
| @@ -104,6 +104,42 @@ public: |
| const SkStrokeRec&, const SkMatrix&, |
| const SkRect* cullR) const; |
| + /** |
| + * If the PathEffect is a DashedPath effect asADash will return TwoInterval if there is a |
| + * single on and a single off interval. If there are additional intervals in the dash then |
| + * it will return Other. If a non NULL info is passed in the various DashInfo will be filled |
|
reed1
2014/03/27 15:56:07
s/Other/MultipleInterval
|
| + * in if the PathEffect is a DashedPathEffect. If passed in info has an fCount equal or |
| + * greater to that of the effect, it will memcpy the values of fIntervals into the info. |
| + * Thus the general approach will be call asADash once with default info to get DashType |
| + * and fCount. If it is a DashPathEffect, allocate space for the intervals in info, then call |
| + * asAGradient again with the same info and fIntervals will get copied in. |
| + * |
| + * None: |
| + * info is ignored. |
| + * TwoInterval: |
| + * uses all info. |
| + * MultipleInterval: |
| + * uses all info. |
| + */ |
| + |
| + enum DashType { |
| + kNone_DashType, |
| + kTwoInterval_DashType, |
| + kMultipleInterval_DashType, |
| + }; |
| + |
| + struct DashInfo { |
| + SkScalar* fIntervals; //!< Length of on/off intervals for dashed lines |
| + // Even values represent ons, and odds offs |
| + int32_t fCount; //!< Number of intervals in the dash. Should be even number |
| + SkScalar fInitialDashLength; //!< Length of possibly shortened initial interval |
| + int32_t fInitialDashIndex; //!< Which interval in fIntervals are we starting at |
| + SkScalar fIntervalLength; //!< Length of all intervals |
| + bool fScaleToFit; |
| + }; |
| + |
| + virtual DashType asADash(DashInfo* info) const; |
| + |
| SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) |
| protected: |