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

Side by Side Diff: include/core/SkPathEffect.h

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: New serialization method Created 7 years, 3 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 | Annotate | Revision Log
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 10 matching lines...) Expand all
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 }; 101 };
100 102
101 /** 103 /**
102 * Does applying this path effect to 'src' yield a set of points? If so, 104 * Does applying this path effect to 'src' yield a set of points? If so,
103 * optionally return the points in 'results'. 105 * optionally return the points in 'results'.
104 */ 106 */
105 virtual bool asPoints(PointData* results, const SkPath& src, 107 virtual bool asPoints(PointData* results, const SkPath& src,
106 const SkStrokeRec&, const SkMatrix&, 108 const SkStrokeRec&, const SkMatrix&,
107 const SkRect* cullR) const; 109 const SkRect* cullR) const;
108 110
111 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect)
112
109 protected: 113 protected:
110 SkPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} 114 SkPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
111 115
112 private: 116 private:
113 // illegal 117 // illegal
114 SkPathEffect(const SkPathEffect&); 118 SkPathEffect(const SkPathEffect&);
115 SkPathEffect& operator=(const SkPathEffect&); 119 SkPathEffect& operator=(const SkPathEffect&);
116
117 typedef SkFlattenable INHERITED;
118 }; 120 };
119 121
120 /** \class SkPairPathEffect 122 /** \class SkPairPathEffect
121 123
122 Common baseclass for Compose and Sum. This subclass manages two pathEffects, 124 Common baseclass for Compose and Sum. This subclass manages two pathEffects,
123 including flattening them. It does nothing in filterPath, and is only useful 125 including flattening them. It does nothing in filterPath, and is only useful
124 for managing the lifetimes of its two arguments. 126 for managing the lifetimes of its two arguments.
125 */ 127 */
126 class SkPairPathEffect : public SkPathEffect { 128 class SkPairPathEffect : public SkPathEffect {
129 typedef SkPathEffect INHERITED;
130
127 public: 131 public:
128 SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1); 132 SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1);
129 virtual ~SkPairPathEffect(); 133 virtual ~SkPairPathEffect();
130 134
131 protected: 135 protected:
132 SkPairPathEffect(SkFlattenableReadBuffer&); 136 SkPairPathEffect(SkFlattenableReadBuffer&);
133 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 137 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
134 138
135 // these are visible to our subclasses 139 // these are visible to our subclasses
136 SkPathEffect* fPE0, *fPE1; 140 SkPathEffect* fPE0, *fPE1;
137
138 private:
139 typedef SkPathEffect INHERITED;
140 }; 141 };
141 142
142 /** \class SkComposePathEffect 143 /** \class SkComposePathEffect
143 144
144 This subclass of SkPathEffect composes its two arguments, to create 145 This subclass of SkPathEffect composes its two arguments, to create
145 a compound pathEffect. 146 a compound pathEffect.
146 */ 147 */
147 class SkComposePathEffect : public SkPairPathEffect { 148 class SkComposePathEffect : public SkPairPathEffect {
149 typedef SkPairPathEffect INHERITED;
150
148 public: 151 public:
149 /** Construct a pathEffect whose effect is to apply first the inner pathEffe ct 152 /** Construct a pathEffect whose effect is to apply first the inner pathEffe ct
150 and the the outer pathEffect (e.g. outer(inner(path))) 153 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, 154 The reference counts for outer and inner are both incremented in the con structor,
152 and decremented in the destructor. 155 and decremented in the destructor.
153 */ 156 */
154 SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) 157 SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
155 : INHERITED(outer, inner) {} 158 : INHERITED(outer, inner) {}
156 159
157 virtual bool filterPath(SkPath* dst, const SkPath& src, 160 virtual bool filterPath(SkPath* dst, const SkPath& src,
158 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; 161 SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
159 162
160 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) 163 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
161 164
162 protected: 165 protected:
163 SkComposePathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} 166 SkComposePathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
164 167
165 private: 168 private:
166 // illegal 169 // illegal
167 SkComposePathEffect(const SkComposePathEffect&); 170 SkComposePathEffect(const SkComposePathEffect&);
168 SkComposePathEffect& operator=(const SkComposePathEffect&); 171 SkComposePathEffect& operator=(const SkComposePathEffect&);
169
170 typedef SkPairPathEffect INHERITED;
171 }; 172 };
172 173
173 /** \class SkSumPathEffect 174 /** \class SkSumPathEffect
174 175
175 This subclass of SkPathEffect applies two pathEffects, one after the other. 176 This subclass of SkPathEffect applies two pathEffects, one after the other.
176 Its filterPath() returns true if either of the effects succeeded. 177 Its filterPath() returns true if either of the effects succeeded.
177 */ 178 */
178 class SkSumPathEffect : public SkPairPathEffect { 179 class SkSumPathEffect : public SkPairPathEffect {
180 typedef SkPairPathEffect INHERITED;
181
179 public: 182 public:
180 /** Construct a pathEffect whose effect is to apply two effects, in sequence . 183 /** Construct a pathEffect whose effect is to apply two effects, in sequence .
181 (e.g. first(path) + second(path)) 184 (e.g. first(path) + second(path))
182 The reference counts for first and second are both incremented in the co nstructor, 185 The reference counts for first and second are both incremented in the co nstructor,
183 and decremented in the destructor. 186 and decremented in the destructor.
184 */ 187 */
185 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) 188 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
186 : INHERITED(first, second) {} 189 : INHERITED(first, second) {}
187 190
188 virtual bool filterPath(SkPath* dst, const SkPath& src, 191 virtual bool filterPath(SkPath* dst, const SkPath& src,
189 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; 192 SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
190 193
191 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) 194 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
192 195
193 protected: 196 protected:
194 SkSumPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} 197 SkSumPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
195 198
196 private: 199 private:
197 // illegal 200 // illegal
198 SkSumPathEffect(const SkSumPathEffect&); 201 SkSumPathEffect(const SkSumPathEffect&);
199 SkSumPathEffect& operator=(const SkSumPathEffect&); 202 SkSumPathEffect& operator=(const SkSumPathEffect&);
200
201 typedef SkPairPathEffect INHERITED;
202 }; 203 };
203 204
204 #endif 205 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698