| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 SkScalar* fIntervals; //!< Length of on/off intervals for dash
ed lines | 125 SkScalar* fIntervals; //!< Length of on/off intervals for dash
ed lines |
| 126 // Even values represent ons, and odds
offs | 126 // Even values represent ons, and odds
offs |
| 127 int32_t fCount; //!< Number of intervals in the dash. Sh
ould be even number | 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 | 128 SkScalar fPhase; //!< Offset into the dashed interval pat
tern |
| 129 // mod the sum of all intervals | 129 // mod the sum of all intervals |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 virtual DashType asADash(DashInfo* info) const; | 132 virtual DashType asADash(DashInfo* info) const; |
| 133 | 133 |
| 134 SK_TO_STRING_PUREVIRT() |
| 134 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) | 135 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) |
| 135 | 136 |
| 136 protected: | 137 protected: |
| 137 SkPathEffect() {} | 138 SkPathEffect() {} |
| 138 | 139 |
| 139 private: | 140 private: |
| 140 // illegal | 141 // illegal |
| 141 SkPathEffect(const SkPathEffect&); | 142 SkPathEffect(const SkPathEffect&); |
| 142 SkPathEffect& operator=(const SkPathEffect&); | 143 SkPathEffect& operator=(const SkPathEffect&); |
| 143 | 144 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 155 virtual ~SkPairPathEffect(); | 156 virtual ~SkPairPathEffect(); |
| 156 | 157 |
| 157 protected: | 158 protected: |
| 158 SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1); | 159 SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1); |
| 159 | 160 |
| 160 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 161 void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 161 | 162 |
| 162 // these are visible to our subclasses | 163 // these are visible to our subclasses |
| 163 SkPathEffect* fPE0, *fPE1; | 164 SkPathEffect* fPE0, *fPE1; |
| 164 | 165 |
| 166 SK_TO_STRING_OVERRIDE() |
| 167 |
| 165 private: | 168 private: |
| 166 typedef SkPathEffect INHERITED; | 169 typedef SkPathEffect INHERITED; |
| 167 }; | 170 }; |
| 168 | 171 |
| 169 /** \class SkComposePathEffect | 172 /** \class SkComposePathEffect |
| 170 | 173 |
| 171 This subclass of SkPathEffect composes its two arguments, to create | 174 This subclass of SkPathEffect composes its two arguments, to create |
| 172 a compound pathEffect. | 175 a compound pathEffect. |
| 173 */ | 176 */ |
| 174 class SkComposePathEffect : public SkPairPathEffect { | 177 class SkComposePathEffect : public SkPairPathEffect { |
| 175 public: | 178 public: |
| 176 /** Construct a pathEffect whose effect is to apply first the inner pathEffe
ct | 179 /** Construct a pathEffect whose effect is to apply first the inner pathEffe
ct |
| 177 and the the outer pathEffect (e.g. outer(inner(path))) | 180 and the the outer pathEffect (e.g. outer(inner(path))) |
| 178 The reference counts for outer and inner are both incremented in the con
structor, | 181 The reference counts for outer and inner are both incremented in the con
structor, |
| 179 and decremented in the destructor. | 182 and decremented in the destructor. |
| 180 */ | 183 */ |
| 181 static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner)
{ | 184 static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner)
{ |
| 182 return SkNEW_ARGS(SkComposePathEffect, (outer, inner)); | 185 return SkNEW_ARGS(SkComposePathEffect, (outer, inner)); |
| 183 } | 186 } |
| 184 | 187 |
| 185 virtual bool filterPath(SkPath* dst, const SkPath& src, | 188 virtual bool filterPath(SkPath* dst, const SkPath& src, |
| 186 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 189 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
| 187 | 190 |
| 191 SK_TO_STRING_OVERRIDE() |
| 188 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) | 192 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) |
| 189 | 193 |
| 190 protected: | 194 protected: |
| 191 SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) | 195 SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) : INHERITED(ou
ter, inner) {} |
| 192 : INHERITED(outer, inner) {} | |
| 193 | 196 |
| 194 private: | 197 private: |
| 195 // illegal | 198 // illegal |
| 196 SkComposePathEffect(const SkComposePathEffect&); | 199 SkComposePathEffect(const SkComposePathEffect&); |
| 197 SkComposePathEffect& operator=(const SkComposePathEffect&); | 200 SkComposePathEffect& operator=(const SkComposePathEffect&); |
| 198 | 201 |
| 199 typedef SkPairPathEffect INHERITED; | 202 typedef SkPairPathEffect INHERITED; |
| 200 }; | 203 }; |
| 201 | 204 |
| 202 /** \class SkSumPathEffect | 205 /** \class SkSumPathEffect |
| 203 | 206 |
| 204 This subclass of SkPathEffect applies two pathEffects, one after the other. | 207 This subclass of SkPathEffect applies two pathEffects, one after the other. |
| 205 Its filterPath() returns true if either of the effects succeeded. | 208 Its filterPath() returns true if either of the effects succeeded. |
| 206 */ | 209 */ |
| 207 class SkSumPathEffect : public SkPairPathEffect { | 210 class SkSumPathEffect : public SkPairPathEffect { |
| 208 public: | 211 public: |
| 209 /** Construct a pathEffect whose effect is to apply two effects, in sequence
. | 212 /** Construct a pathEffect whose effect is to apply two effects, in sequence
. |
| 210 (e.g. first(path) + second(path)) | 213 (e.g. first(path) + second(path)) |
| 211 The reference counts for first and second are both incremented in the co
nstructor, | 214 The reference counts for first and second are both incremented in the co
nstructor, |
| 212 and decremented in the destructor. | 215 and decremented in the destructor. |
| 213 */ | 216 */ |
| 214 static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { | 217 static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { |
| 215 return SkNEW_ARGS(SkSumPathEffect, (first, second)); | 218 return SkNEW_ARGS(SkSumPathEffect, (first, second)); |
| 216 } | 219 } |
| 217 | 220 |
| 218 virtual bool filterPath(SkPath* dst, const SkPath& src, | 221 virtual bool filterPath(SkPath* dst, const SkPath& src, |
| 219 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 222 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
| 220 | 223 |
| 224 SK_TO_STRING_OVERRIDE() |
| 221 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) | 225 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) |
| 222 | 226 |
| 223 protected: | 227 protected: |
| 224 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) | 228 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) : INHERITED(first
, second) {} |
| 225 : INHERITED(first, second) {} | |
| 226 | 229 |
| 227 private: | 230 private: |
| 228 // illegal | 231 // illegal |
| 229 SkSumPathEffect(const SkSumPathEffect&); | 232 SkSumPathEffect(const SkSumPathEffect&); |
| 230 SkSumPathEffect& operator=(const SkSumPathEffect&); | 233 SkSumPathEffect& operator=(const SkSumPathEffect&); |
| 231 | 234 |
| 232 typedef SkPairPathEffect INHERITED; | 235 typedef SkPairPathEffect INHERITED; |
| 233 }; | 236 }; |
| 234 | 237 |
| 235 #endif | 238 #endif |
| OLD | NEW |