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

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: Flatten Updates 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
Index: include/core/SkPathEffect.h
diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h
index 86ccf86a9223eedb59dfb7361102bfb067177868..25175d5d5aaf40e37c1e81740deead9a6502170c 100644
--- a/include/core/SkPathEffect.h
+++ b/include/core/SkPathEffect.h
@@ -104,6 +104,37 @@ public:
const SkStrokeRec&, const SkMatrix&,
const SkRect* cullR) const;
+ /**
bsalomon 2014/03/28 14:57:22 Maybe I'm alone in this but I'd feel better about
+ * If the PathEffect is a DashedPathEffect 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 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.
bsalomon 2014/03/28 14:57:22 asAGradient -> asADash
+ *
+ * None:
reed1 2014/03/28 14:52:53 This part of the dox could be attached/associated
+ * info is ignored.
+ * Dash:
+ * uses all info.
+ */
+
+ enum DashType {
+ kNone_DashType,
+ kDash_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 fPhase; //!< Offset into the dashed interval pattern
+ // mod the sum of all intervals
+ bool fScaleToFit;
bsalomon 2014/03/28 14:57:22 Of all the fields, this one needs a comment :) I'm
+ };
+
+ virtual DashType asADash(DashInfo* info) const;
+
SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect)
protected:

Powered by Google App Engine
This is Rietveld 408576698