OLD | NEW |
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 Sk2DPathEffect_DEFINED | 8 #ifndef Sk2DPathEffect_DEFINED |
9 #define Sk2DPathEffect_DEFINED | 9 #define Sk2DPathEffect_DEFINED |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // illegal | 48 // illegal |
49 Sk2DPathEffect(const Sk2DPathEffect&); | 49 Sk2DPathEffect(const Sk2DPathEffect&); |
50 Sk2DPathEffect& operator=(const Sk2DPathEffect&); | 50 Sk2DPathEffect& operator=(const Sk2DPathEffect&); |
51 | 51 |
52 friend class Sk2DPathEffectBlitter; | 52 friend class Sk2DPathEffectBlitter; |
53 typedef SkPathEffect INHERITED; | 53 typedef SkPathEffect INHERITED; |
54 }; | 54 }; |
55 | 55 |
56 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { | 56 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { |
57 public: | 57 public: |
58 static SkPathEffect* Create(SkScalar width, const SkMatrix& matrix) { | 58 static sk_sp<SkPathEffect> Make(SkScalar width, const SkMatrix& matrix) { |
59 return new SkLine2DPathEffect(width, matrix); | 59 return sk_sp<SkPathEffect>(new SkLine2DPathEffect(width, matrix)); |
60 } | 60 } |
61 | 61 |
62 virtual bool filterPath(SkPath* dst, const SkPath& src, | 62 virtual bool filterPath(SkPath* dst, const SkPath& src, |
63 SkStrokeRec*, const SkRect*) const override; | 63 SkStrokeRec*, const SkRect*) const override; |
64 | 64 |
65 SK_TO_STRING_OVERRIDE() | 65 SK_TO_STRING_OVERRIDE() |
66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) | 66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) |
67 | 67 |
68 protected: | 68 protected: |
69 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) | 69 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) |
70 : Sk2DPathEffect(matrix), fWidth(width) {} | 70 : Sk2DPathEffect(matrix), fWidth(width) {} |
71 void flatten(SkWriteBuffer&) const override; | 71 void flatten(SkWriteBuffer&) const override; |
72 | 72 |
73 void nextSpan(int u, int v, int ucount, SkPath*) const override; | 73 void nextSpan(int u, int v, int ucount, SkPath*) const override; |
74 | 74 |
75 private: | 75 private: |
76 SkScalar fWidth; | 76 SkScalar fWidth; |
77 | 77 |
78 typedef Sk2DPathEffect INHERITED; | 78 typedef Sk2DPathEffect INHERITED; |
79 }; | 79 }; |
80 | 80 |
81 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { | 81 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { |
82 public: | 82 public: |
83 /** | 83 /** |
84 * Stamp the specified path to fill the shape, using the matrix to define | 84 * Stamp the specified path to fill the shape, using the matrix to define |
85 * the latice. | 85 * the latice. |
86 */ | 86 */ |
87 static SkPathEffect* Create(const SkMatrix& matrix, const SkPath& path) { | 87 static sk_sp<SkPathEffect> Make(const SkMatrix& matrix, const SkPath& path)
{ |
88 return new SkPath2DPathEffect(matrix, path); | 88 return sk_sp<SkPathEffect>(new SkPath2DPathEffect(matrix, path)); |
89 } | 89 } |
90 | 90 |
91 SK_TO_STRING_OVERRIDE() | 91 SK_TO_STRING_OVERRIDE() |
92 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) | 92 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) |
93 | 93 |
94 protected: | 94 protected: |
95 SkPath2DPathEffect(const SkMatrix&, const SkPath&); | 95 SkPath2DPathEffect(const SkMatrix&, const SkPath&); |
96 void flatten(SkWriteBuffer&) const override; | 96 void flatten(SkWriteBuffer&) const override; |
97 | 97 |
98 void next(const SkPoint&, int u, int v, SkPath*) const override; | 98 void next(const SkPoint&, int u, int v, SkPath*) const override; |
99 | 99 |
100 private: | 100 private: |
101 SkPath fPath; | 101 SkPath fPath; |
102 | 102 |
103 typedef Sk2DPathEffect INHERITED; | 103 typedef Sk2DPathEffect INHERITED; |
104 }; | 104 }; |
105 | 105 |
106 #endif | 106 #endif |
OLD | NEW |