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