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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 /** Low-level virtual called per span of locations in the u-direction. | 37 /** Low-level virtual called per span of locations in the u-direction. |
38 The default implementation calls next() repeatedly with each | 38 The default implementation calls next() repeatedly with each |
39 location. | 39 location. |
40 */ | 40 */ |
41 virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const; | 41 virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const; |
42 | 42 |
43 const SkMatrix& getMatrix() const { return fMatrix; } | 43 const SkMatrix& getMatrix() const { return fMatrix; } |
44 | 44 |
45 // protected so that subclasses can call this during unflattening | 45 // protected so that subclasses can call this during unflattening |
46 Sk2DPathEffect(SkReadBuffer&); | 46 explicit Sk2DPathEffect(const SkMatrix& mat); |
| 47 explicit Sk2DPathEffect(SkReadBuffer&); |
47 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 48 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
48 | 49 |
49 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | |
50 public: | |
51 #endif | |
52 Sk2DPathEffect(const SkMatrix& mat); | |
53 | |
54 private: | 50 private: |
55 SkMatrix fMatrix, fInverse; | 51 SkMatrix fMatrix, fInverse; |
56 bool fMatrixIsInvertible; | 52 bool fMatrixIsInvertible; |
57 | 53 |
58 // illegal | 54 // illegal |
59 Sk2DPathEffect(const Sk2DPathEffect&); | 55 Sk2DPathEffect(const Sk2DPathEffect&); |
60 Sk2DPathEffect& operator=(const Sk2DPathEffect&); | 56 Sk2DPathEffect& operator=(const Sk2DPathEffect&); |
61 | 57 |
62 friend class Sk2DPathEffectBlitter; | 58 friend class Sk2DPathEffectBlitter; |
63 typedef SkPathEffect INHERITED; | 59 typedef SkPathEffect INHERITED; |
64 }; | 60 }; |
65 | 61 |
66 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { | 62 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { |
67 public: | 63 public: |
68 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { | 64 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { |
69 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); | 65 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); |
70 } | 66 } |
71 | 67 |
72 virtual bool filterPath(SkPath* dst, const SkPath& src, | 68 virtual bool filterPath(SkPath* dst, const SkPath& src, |
73 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 69 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
74 | 70 |
75 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) | 71 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) |
76 | 72 |
77 protected: | 73 protected: |
78 virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE; | 74 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) |
79 | 75 : Sk2DPathEffect(matrix), fWidth(width) {} |
80 SkLine2DPathEffect(SkReadBuffer&); | 76 explicit SkLine2DPathEffect(SkReadBuffer&); |
81 | 77 |
82 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 78 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
83 | 79 |
84 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | 80 virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE; |
85 public: | |
86 #endif | |
87 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) | |
88 : Sk2DPathEffect(matrix), fWidth(width) {} | |
89 | 81 |
90 private: | 82 private: |
91 SkScalar fWidth; | 83 SkScalar fWidth; |
92 | 84 |
93 typedef Sk2DPathEffect INHERITED; | 85 typedef Sk2DPathEffect INHERITED; |
94 }; | 86 }; |
95 | 87 |
96 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { | 88 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { |
97 public: | 89 public: |
98 /** | 90 /** |
99 * Stamp the specified path to fill the shape, using the matrix to define | 91 * Stamp the specified path to fill the shape, using the matrix to define |
100 * the latice. | 92 * the latice. |
101 */ | 93 */ |
102 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path
) { | 94 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path
) { |
103 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); | 95 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); |
104 } | 96 } |
105 | 97 |
106 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) | 98 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) |
107 | 99 |
108 protected: | 100 protected: |
109 SkPath2DPathEffect(SkReadBuffer& buffer); | 101 SkPath2DPathEffect(const SkMatrix&, const SkPath&); |
| 102 explicit SkPath2DPathEffect(SkReadBuffer& buffer); |
110 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 103 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
111 | 104 |
112 virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE; | 105 virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE; |
113 | 106 |
114 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | |
115 public: | |
116 #endif | |
117 SkPath2DPathEffect(const SkMatrix&, const SkPath&); | |
118 | |
119 private: | 107 private: |
120 SkPath fPath; | 108 SkPath fPath; |
121 | 109 |
122 typedef Sk2DPathEffect INHERITED; | 110 typedef Sk2DPathEffect INHERITED; |
123 }; | 111 }; |
124 | 112 |
125 #endif | 113 #endif |
OLD | NEW |