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

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

Issue 1713383002: fix misc asserts and checks found by fuzzer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | include/effects/Sk1DPathEffect.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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 This subclass of SkPathEffect composes its two arguments, to create 176 This subclass of SkPathEffect composes its two arguments, to create
177 a compound pathEffect. 177 a compound pathEffect.
178 */ 178 */
179 class SkComposePathEffect : public SkPairPathEffect { 179 class SkComposePathEffect : public SkPairPathEffect {
180 public: 180 public:
181 /** Construct a pathEffect whose effect is to apply first the inner pathEffe ct 181 /** Construct a pathEffect whose effect is to apply first the inner pathEffe ct
182 and the the outer pathEffect (e.g. outer(inner(path))) 182 and the the outer pathEffect (e.g. outer(inner(path)))
183 The reference counts for outer and inner are both incremented in the con structor, 183 The reference counts for outer and inner are both incremented in the con structor,
184 and decremented in the destructor. 184 and decremented in the destructor.
185 */ 185 */
186 static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) { 186 static SkPathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
187 if (!outer) {
188 return SkSafeRef(inner);
189 }
190 if (!inner) {
191 return SkSafeRef(outer);
192 }
187 return new SkComposePathEffect(outer, inner); 193 return new SkComposePathEffect(outer, inner);
188 } 194 }
189 195
190 virtual bool filterPath(SkPath* dst, const SkPath& src, 196 virtual bool filterPath(SkPath* dst, const SkPath& src,
191 SkStrokeRec*, const SkRect*) const override; 197 SkStrokeRec*, const SkRect*) const override;
192 198
193 SK_TO_STRING_OVERRIDE() 199 SK_TO_STRING_OVERRIDE()
194 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) 200 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
195 201
196 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 202 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
(...skipping 16 matching lines...) Expand all
213 This subclass of SkPathEffect applies two pathEffects, one after the other. 219 This subclass of SkPathEffect applies two pathEffects, one after the other.
214 Its filterPath() returns true if either of the effects succeeded. 220 Its filterPath() returns true if either of the effects succeeded.
215 */ 221 */
216 class SkSumPathEffect : public SkPairPathEffect { 222 class SkSumPathEffect : public SkPairPathEffect {
217 public: 223 public:
218 /** Construct a pathEffect whose effect is to apply two effects, in sequence . 224 /** Construct a pathEffect whose effect is to apply two effects, in sequence .
219 (e.g. first(path) + second(path)) 225 (e.g. first(path) + second(path))
220 The reference counts for first and second are both incremented in the co nstructor, 226 The reference counts for first and second are both incremented in the co nstructor,
221 and decremented in the destructor. 227 and decremented in the destructor.
222 */ 228 */
223 static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { 229 static SkPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
230 if (!first) {
231 return SkSafeRef(second);
232 }
233 if (!second) {
234 return SkSafeRef(first);
235 }
224 return new SkSumPathEffect(first, second); 236 return new SkSumPathEffect(first, second);
225 } 237 }
226 238
227 virtual bool filterPath(SkPath* dst, const SkPath& src, 239 virtual bool filterPath(SkPath* dst, const SkPath& src,
228 SkStrokeRec*, const SkRect*) const override; 240 SkStrokeRec*, const SkRect*) const override;
229 241
230 SK_TO_STRING_OVERRIDE() 242 SK_TO_STRING_OVERRIDE()
231 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) 243 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
232 244
233 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 245 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
234 bool exposedInAndroidJavaAPI() const override { return true; } 246 bool exposedInAndroidJavaAPI() const override { return true; }
235 #endif 247 #endif
236 248
237 protected: 249 protected:
238 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) : INHERITED(first , second) {} 250 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) : INHERITED(first , second) {}
239 251
240 private: 252 private:
241 // illegal 253 // illegal
242 SkSumPathEffect(const SkSumPathEffect&); 254 SkSumPathEffect(const SkSumPathEffect&);
243 SkSumPathEffect& operator=(const SkSumPathEffect&); 255 SkSumPathEffect& operator=(const SkSumPathEffect&);
244 256
245 typedef SkPairPathEffect INHERITED; 257 typedef SkPairPathEffect INHERITED;
246 }; 258 };
247 259
248 #endif 260 #endif
OLDNEW
« no previous file with comments | « no previous file | include/effects/Sk1DPathEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698