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

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: Nits Created 6 years, 8 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
« no previous file with comments | « gyp/tests.gypi ('k') | include/core/SkPicture.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /**
108 * If the PathEffect can be represented as a dash pattern, asADash will ret urn kDash_DashType
109 * and None otherwise. If a non NULL info is passed in, the various DashInf o will be filled
110 * in if the PathEffect can be a dash pattern. If passed in info has an fCo unt equal or
111 * greater to that of the effect, it will memcpy the values of the dash int ervals into the
112 * info. Thus the general approach will be call asADash once with default i nfo to get DashType
113 * and fCount. If effect can be represented as a dash pattern, allocate spa ce for the intervals
114 * in info, then call asADash again with the same info and the intervals wi ll get copied in.
115 */
116
117 enum DashType {
118 kNone_DashType, //!< ignores the info parameter
119 kDash_DashType, //!< fills in all of the info parameter
120 };
121
122 struct DashInfo {
123 DashInfo() : fIntervals(NULL), fCount(0), fPhase(0) {}
124
125 SkScalar* fIntervals; //!< Length of on/off intervals for dash ed lines
126 // Even values represent ons, and odds offs
127 int32_t fCount; //!< Number of intervals in the dash. Sh ould be even number
128 SkScalar fPhase; //!< Offset into the dashed interval pat tern
129 // mod the sum of all intervals
130 };
131
132 virtual DashType asADash(DashInfo* info) const;
133
107 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) 134 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect)
108 135
109 protected: 136 protected:
110 SkPathEffect() {} 137 SkPathEffect() {}
111 SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {} 138 SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
112 139
113 private: 140 private:
114 // illegal 141 // illegal
115 SkPathEffect(const SkPathEffect&); 142 SkPathEffect(const SkPathEffect&);
116 SkPathEffect& operator=(const SkPathEffect&); 143 SkPathEffect& operator=(const SkPathEffect&);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 237
211 private: 238 private:
212 // illegal 239 // illegal
213 SkSumPathEffect(const SkSumPathEffect&); 240 SkSumPathEffect(const SkSumPathEffect&);
214 SkSumPathEffect& operator=(const SkSumPathEffect&); 241 SkSumPathEffect& operator=(const SkSumPathEffect&);
215 242
216 typedef SkPairPathEffect INHERITED; 243 typedef SkPairPathEffect INHERITED;
217 }; 244 };
218 245
219 #endif 246 #endif
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | include/core/SkPicture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698