| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 /** \class SkPathEffect | 22 /** \class SkPathEffect |
| 23 | 23 |
| 24 SkPathEffect is the base class for objects in the SkPaint that affect | 24 SkPathEffect is the base class for objects in the SkPaint that affect |
| 25 the geometry of a drawing primitive before it is transformed by the | 25 the geometry of a drawing primitive before it is transformed by the |
| 26 canvas' matrix and drawn. | 26 canvas' matrix and drawn. |
| 27 | 27 |
| 28 Dashing is implemented as a subclass of SkPathEffect. | 28 Dashing is implemented as a subclass of SkPathEffect. |
| 29 */ | 29 */ |
| 30 class SK_API SkPathEffect : public SkFlattenable { | 30 class SK_API SkPathEffect : public SkFlattenable { |
| 31 typedef SkFlattenable INHERITED; |
| 32 |
| 31 public: | 33 public: |
| 32 SK_DECLARE_INST_COUNT(SkPathEffect) | 34 SK_DECLARE_INST_COUNT(SkPathEffect) |
| 33 | 35 |
| 34 SkPathEffect() {} | 36 SkPathEffect() {} |
| 35 | 37 |
| 36 /** | 38 /** |
| 37 * Given a src path (input) and a stroke-rec (input and output), apply | 39 * Given a src path (input) and a stroke-rec (input and output), apply |
| 38 * this effect to the src path, returning the new path in dst, and return | 40 * this effect to the src path, returning the new path in dst, and return |
| 39 * true. If this effect cannot be applied, return false and ignore dst | 41 * true. If this effect cannot be applied, return false and ignore dst |
| 40 * and stroke-rec. | 42 * and stroke-rec. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const SkStrokeRec&, const SkMatrix&, | 108 const SkStrokeRec&, const SkMatrix&, |
| 107 const SkRect* cullR) const; | 109 const SkRect* cullR) const; |
| 108 | 110 |
| 109 protected: | 111 protected: |
| 110 SkPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} | 112 SkPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} |
| 111 | 113 |
| 112 private: | 114 private: |
| 113 // illegal | 115 // illegal |
| 114 SkPathEffect(const SkPathEffect&); | 116 SkPathEffect(const SkPathEffect&); |
| 115 SkPathEffect& operator=(const SkPathEffect&); | 117 SkPathEffect& operator=(const SkPathEffect&); |
| 116 | |
| 117 typedef SkFlattenable INHERITED; | |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 /** \class SkPairPathEffect | 120 /** \class SkPairPathEffect |
| 121 | 121 |
| 122 Common baseclass for Compose and Sum. This subclass manages two pathEffects, | 122 Common baseclass for Compose and Sum. This subclass manages two pathEffects, |
| 123 including flattening them. It does nothing in filterPath, and is only useful | 123 including flattening them. It does nothing in filterPath, and is only useful |
| 124 for managing the lifetimes of its two arguments. | 124 for managing the lifetimes of its two arguments. |
| 125 */ | 125 */ |
| 126 class SkPairPathEffect : public SkPathEffect { | 126 class SkPairPathEffect : public SkPathEffect { |
| 127 typedef SkPathEffect INHERITED; |
| 128 |
| 127 public: | 129 public: |
| 128 SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1); | 130 SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1); |
| 129 virtual ~SkPairPathEffect(); | 131 virtual ~SkPairPathEffect(); |
| 130 | 132 |
| 131 protected: | 133 protected: |
| 132 SkPairPathEffect(SkFlattenableReadBuffer&); | 134 SkPairPathEffect(SkFlattenableReadBuffer&); |
| 133 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 135 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 134 | 136 |
| 135 // these are visible to our subclasses | 137 // these are visible to our subclasses |
| 136 SkPathEffect* fPE0, *fPE1; | 138 SkPathEffect* fPE0, *fPE1; |
| 137 | |
| 138 private: | |
| 139 typedef SkPathEffect INHERITED; | |
| 140 }; | 139 }; |
| 141 | 140 |
| 142 /** \class SkComposePathEffect | 141 /** \class SkComposePathEffect |
| 143 | 142 |
| 144 This subclass of SkPathEffect composes its two arguments, to create | 143 This subclass of SkPathEffect composes its two arguments, to create |
| 145 a compound pathEffect. | 144 a compound pathEffect. |
| 146 */ | 145 */ |
| 147 class SkComposePathEffect : public SkPairPathEffect { | 146 class SkComposePathEffect : public SkPairPathEffect { |
| 147 typedef SkPairPathEffect INHERITED; |
| 148 |
| 148 public: | 149 public: |
| 149 /** Construct a pathEffect whose effect is to apply first the inner pathEffe
ct | 150 /** Construct a pathEffect whose effect is to apply first the inner pathEffe
ct |
| 150 and the the outer pathEffect (e.g. outer(inner(path))) | 151 and the the outer pathEffect (e.g. outer(inner(path))) |
| 151 The reference counts for outer and inner are both incremented in the con
structor, | 152 The reference counts for outer and inner are both incremented in the con
structor, |
| 152 and decremented in the destructor. | 153 and decremented in the destructor. |
| 153 */ | 154 */ |
| 154 SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) | 155 SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) |
| 155 : INHERITED(outer, inner) {} | 156 : INHERITED(outer, inner) {} |
| 156 | 157 |
| 157 virtual bool filterPath(SkPath* dst, const SkPath& src, | 158 virtual bool filterPath(SkPath* dst, const SkPath& src, |
| 158 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 159 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
| 159 | 160 |
| 160 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) | 161 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) |
| 161 | 162 |
| 162 protected: | 163 protected: |
| 163 SkComposePathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} | 164 SkComposePathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} |
| 164 | 165 |
| 165 private: | 166 private: |
| 166 // illegal | 167 // illegal |
| 167 SkComposePathEffect(const SkComposePathEffect&); | 168 SkComposePathEffect(const SkComposePathEffect&); |
| 168 SkComposePathEffect& operator=(const SkComposePathEffect&); | 169 SkComposePathEffect& operator=(const SkComposePathEffect&); |
| 169 | |
| 170 typedef SkPairPathEffect INHERITED; | |
| 171 }; | 170 }; |
| 172 | 171 |
| 173 /** \class SkSumPathEffect | 172 /** \class SkSumPathEffect |
| 174 | 173 |
| 175 This subclass of SkPathEffect applies two pathEffects, one after the other. | 174 This subclass of SkPathEffect applies two pathEffects, one after the other. |
| 176 Its filterPath() returns true if either of the effects succeeded. | 175 Its filterPath() returns true if either of the effects succeeded. |
| 177 */ | 176 */ |
| 178 class SkSumPathEffect : public SkPairPathEffect { | 177 class SkSumPathEffect : public SkPairPathEffect { |
| 178 typedef SkPairPathEffect INHERITED; |
| 179 |
| 179 public: | 180 public: |
| 180 /** Construct a pathEffect whose effect is to apply two effects, in sequence
. | 181 /** Construct a pathEffect whose effect is to apply two effects, in sequence
. |
| 181 (e.g. first(path) + second(path)) | 182 (e.g. first(path) + second(path)) |
| 182 The reference counts for first and second are both incremented in the co
nstructor, | 183 The reference counts for first and second are both incremented in the co
nstructor, |
| 183 and decremented in the destructor. | 184 and decremented in the destructor. |
| 184 */ | 185 */ |
| 185 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) | 186 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) |
| 186 : INHERITED(first, second) {} | 187 : INHERITED(first, second) {} |
| 187 | 188 |
| 188 virtual bool filterPath(SkPath* dst, const SkPath& src, | 189 virtual bool filterPath(SkPath* dst, const SkPath& src, |
| 189 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 190 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
| 190 | 191 |
| 191 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) | 192 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) |
| 192 | 193 |
| 193 protected: | 194 protected: |
| 194 SkSumPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} | 195 SkSumPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} |
| 195 | 196 |
| 196 private: | 197 private: |
| 197 // illegal | 198 // illegal |
| 198 SkSumPathEffect(const SkSumPathEffect&); | 199 SkSumPathEffect(const SkSumPathEffect&); |
| 199 SkSumPathEffect& operator=(const SkSumPathEffect&); | 200 SkSumPathEffect& operator=(const SkSumPathEffect&); |
| 200 | |
| 201 typedef SkPairPathEffect INHERITED; | |
| 202 }; | 201 }; |
| 203 | 202 |
| 204 #endif | 203 #endif |
| OLD | NEW |