OLD | NEW |
---|---|
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 Loading... | |
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 is a DashedPath effect asADash will return TwoInterval if there is a | |
109 * single on and a single off interval. If there are additional intervals i n the dash then | |
110 * it will return Other. If a non NULL info is passed in the various DashIn fo will be filled | |
reed1
2014/03/27 15:56:07
s/Other/MultipleInterval
| |
111 * in if the PathEffect is a DashedPathEffect. If passed in info has an fCo unt equal or | |
112 * greater to that of the effect, it will memcpy the values of fIntervals i nto the info. | |
113 * Thus the general approach will be call asADash once with default info to get DashType | |
114 * and fCount. If it is a DashPathEffect, allocate space for the intervals in info, then call | |
115 * asAGradient again with the same info and fIntervals will get copied in. | |
116 * | |
117 * None: | |
118 * info is ignored. | |
119 * TwoInterval: | |
120 * uses all info. | |
121 * MultipleInterval: | |
122 * uses all info. | |
123 */ | |
124 | |
125 enum DashType { | |
126 kNone_DashType, | |
127 kTwoInterval_DashType, | |
128 kMultipleInterval_DashType, | |
129 }; | |
130 | |
131 struct DashInfo { | |
132 SkScalar* fIntervals; //!< Length of on/off intervals for dash ed lines | |
133 // Even values represent ons, and odds offs | |
134 int32_t fCount; //!< Number of intervals in the dash. Sh ould be even number | |
135 SkScalar fInitialDashLength; //!< Length of possibly shortened initia l interval | |
136 int32_t fInitialDashIndex; //!< Which interval in fIntervals are we starting at | |
137 SkScalar fIntervalLength; //!< Length of all intervals | |
138 bool fScaleToFit; | |
139 }; | |
140 | |
141 virtual DashType asADash(DashInfo* info) const; | |
142 | |
107 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) | 143 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) |
108 | 144 |
109 protected: | 145 protected: |
110 SkPathEffect() {} | 146 SkPathEffect() {} |
111 SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {} | 147 SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {} |
112 | 148 |
113 private: | 149 private: |
114 // illegal | 150 // illegal |
115 SkPathEffect(const SkPathEffect&); | 151 SkPathEffect(const SkPathEffect&); |
116 SkPathEffect& operator=(const SkPathEffect&); | 152 SkPathEffect& operator=(const SkPathEffect&); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 | 246 |
211 private: | 247 private: |
212 // illegal | 248 // illegal |
213 SkSumPathEffect(const SkSumPathEffect&); | 249 SkSumPathEffect(const SkSumPathEffect&); |
214 SkSumPathEffect& operator=(const SkSumPathEffect&); | 250 SkSumPathEffect& operator=(const SkSumPathEffect&); |
215 | 251 |
216 typedef SkPairPathEffect INHERITED; | 252 typedef SkPairPathEffect INHERITED; |
217 }; | 253 }; |
218 | 254 |
219 #endif | 255 #endif |
OLD | NEW |