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

Side by Side 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 unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPathEffect_DEFINED 10 #ifndef SkPathEffect_DEFINED
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 }; 97 };
98 98
99 /** 99 /**
100 * Does applying this path effect to 'src' yield a set of points? If so, 100 * Does applying this path effect to 'src' yield a set of points? If so,
101 * optionally return the points in 'results'. 101 * optionally return the points in 'results'.
102 */ 102 */
103 virtual bool asPoints(PointData* results, const SkPath& src, 103 virtual bool asPoints(PointData* results, const SkPath& src,
104 const SkStrokeRec&, const SkMatrix&, 104 const SkStrokeRec&, const SkMatrix&,
105 const SkRect* cullR) const; 105 const SkRect* cullR) const;
106 106
107 /**
bsalomon 2014/03/28 14:57:22 Maybe I'm alone in this but I'd feel better about
108 * If the PathEffect is a DashedPathEffect asADash will return kDash_DashTy pe and None
109 * otherwise. If a non NULL info is passed in the various DashInfo will be filled
110 * in if the PathEffect is a DashedPathEffect. If passed in info has an fCo unt equal or
111 * greater to that of the effect, it will memcpy the values of fIntervals i nto the info.
112 * Thus the general approach will be call asADash once with default info to get DashType
113 * and fCount. If it is a DashPathEffect, allocate space for the intervals in info, then call
114 * asAGradient again with the same info and fIntervals will get copied in.
bsalomon 2014/03/28 14:57:22 asAGradient -> asADash
115 *
116 * None:
reed1 2014/03/28 14:52:53 This part of the dox could be attached/associated
117 * info is ignored.
118 * Dash:
119 * uses all info.
120 */
121
122 enum DashType {
123 kNone_DashType,
124 kDash_DashType,
125 };
126
127 struct DashInfo {
128 SkScalar* fIntervals; //!< Length of on/off intervals for dash ed lines
129 // Even values represent ons, and odds offs
130 int32_t fCount; //!< Number of intervals in the dash. Sh ould be even number
131 SkScalar fPhase; //!< Offset into the dashed interval pat tern
132 // mod the sum of all intervals
133 bool fScaleToFit;
bsalomon 2014/03/28 14:57:22 Of all the fields, this one needs a comment :) I'm
134 };
135
136 virtual DashType asADash(DashInfo* info) const;
137
107 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) 138 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect)
108 139
109 protected: 140 protected:
110 SkPathEffect() {} 141 SkPathEffect() {}
111 SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {} 142 SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
112 143
113 private: 144 private:
114 // illegal 145 // illegal
115 SkPathEffect(const SkPathEffect&); 146 SkPathEffect(const SkPathEffect&);
116 SkPathEffect& operator=(const SkPathEffect&); 147 SkPathEffect& operator=(const SkPathEffect&);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 241
211 private: 242 private:
212 // illegal 243 // illegal
213 SkSumPathEffect(const SkSumPathEffect&); 244 SkSumPathEffect(const SkSumPathEffect&);
214 SkSumPathEffect& operator=(const SkSumPathEffect&); 245 SkSumPathEffect& operator=(const SkSumPathEffect&);
215 246
216 typedef SkPairPathEffect INHERITED; 247 typedef SkPairPathEffect INHERITED;
217 }; 248 };
218 249
219 #endif 250 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698