Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: include/core/SkPathEffect.h

Issue 212103010: Add asADash entry point into SkPathEffect to allow extracting Dash info from PathEffects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/effects/SkDashPathEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « no previous file | include/effects/SkDashPathEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698