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

Side by Side Diff: include/effects/Sk1DPathEffect.h

Issue 166583002: Factory methods for heap-allocated SkPathEffect and SkXfermode objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move comments from constructors to factory methods. Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef Sk1DPathEffect_DEFINED 8 #ifndef Sk1DPathEffect_DEFINED
9 #define Sk1DPathEffect_DEFINED 9 #define Sk1DPathEffect_DEFINED
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 kStyleCount 45 kStyleCount
46 }; 46 };
47 47
48 /** Dash by replicating the specified path. 48 /** Dash by replicating the specified path.
49 @param path The path to replicate (dash) 49 @param path The path to replicate (dash)
50 @param advance The space between instances of path 50 @param advance The space between instances of path
51 @param phase distance (mod advance) along path for its initial position 51 @param phase distance (mod advance) along path for its initial position
52 @param style how to transform path at each point (based on the current 52 @param style how to transform path at each point (based on the current
53 position and tangent) 53 position and tangent)
54 */ 54 */
55 SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Sty le); 55 static SkPath1DPathEffect* Create(const SkPath& path, SkScalar advance, SkSc alar phase,
56 Style style) {
57 return SkNEW_ARGS(SkPath1DPathEffect, (path, advance, phase, style));
58 }
56 59
57 virtual bool filterPath(SkPath*, const SkPath&, 60 virtual bool filterPath(SkPath*, const SkPath&,
58 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; 61 SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
59 62
60 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect) 63 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect)
61 64
62 protected: 65 protected:
66 SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Sty le);
scroggo 2014/02/19 00:37:13 This constructor is used by Android. It would be h
63 SkPath1DPathEffect(SkReadBuffer& buffer); 67 SkPath1DPathEffect(SkReadBuffer& buffer);
64 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 68 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
65 69
66 // overrides from Sk1DPathEffect 70 // overrides from Sk1DPathEffect
67 virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE; 71 virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE;
68 virtual SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const SK_OVERRIDE; 72 virtual SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const SK_OVERRIDE;
69 73
70 private: 74 private:
71 SkPath fPath; // copied from constructor 75 SkPath fPath; // copied from constructor
72 SkScalar fAdvance; // copied from constructor 76 SkScalar fAdvance; // copied from constructor
73 SkScalar fInitialOffset; // computed from phase 77 SkScalar fInitialOffset; // computed from phase
74 Style fStyle; // copied from constructor 78 Style fStyle; // copied from constructor
75 79
76 typedef Sk1DPathEffect INHERITED; 80 typedef Sk1DPathEffect INHERITED;
77 }; 81 };
78 82
79 #endif 83 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698