Chromium Code Reviews| Index: include/core/SkPathEffect.h |
| diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h |
| index 86ccf86a9223eedb59dfb7361102bfb067177868..e6462e6aa349545201445ae388de365e8fa961ee 100644 |
| --- a/include/core/SkPathEffect.h |
| +++ b/include/core/SkPathEffect.h |
| @@ -104,6 +104,33 @@ public: |
| const SkStrokeRec&, const SkMatrix&, |
| const SkRect* cullR) const; |
| + /** |
| + * If the PathEffect can be represented as a dash pattern, asADash will return kDash_DashType |
| + * and None otherwise. If a non NULL info is passed in, the various DashInfo will be filled |
| + * in if the PathEffect can be a dash pattern. If passed in info has an fCount equal or |
| + * greater to that of the effect, it will memcpy the values of the dash intervals into the |
| + * info. Thus the general approach will be call asADash once with default info to get DashType |
| + * and fCount. If effect can be represented as a dash pattern, allocate space for the intervals |
| + * in info, then call asADash again with the same info and the intervals will get copied in. |
| + */ |
| + |
| + enum DashType { |
| + kNone_DashType, //!< ignores the info parameter |
| + kDash_DashType, //!< fills in all of the info parameter |
| + }; |
| + |
| + struct DashInfo { |
| + DashInfo() : fIntervals(0), fCount(0), fPhase(0.0) {} |
|
reed1
2014/04/22 13:49:01
fPhase(0) is fine.
Sometimes saying 0.0 will make
|
| + |
| + 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 fPhase; //!< Offset into the dashed interval pattern |
| + // mod the sum of all intervals |
| + }; |
| + |
| + virtual DashType asADash(DashInfo* info) const; |
| + |
| SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) |
| protected: |