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 |
42 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 45 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
43 | 46 |
44 private: | 47 private: |
45 SkMatrix fMatrix, fInverse; | 48 SkMatrix fMatrix, fInverse; |
46 bool fMatrixIsInvertible; | 49 bool fMatrixIsInvertible; |
47 | 50 |
48 // illegal | 51 // illegal |
49 Sk2DPathEffect(const Sk2DPathEffect&); | 52 Sk2DPathEffect(const Sk2DPathEffect&); |
50 Sk2DPathEffect& operator=(const Sk2DPathEffect&); | 53 Sk2DPathEffect& operator=(const Sk2DPathEffect&); |
51 | 54 |
52 friend class Sk2DPathEffectBlitter; | 55 friend class Sk2DPathEffectBlitter; |
53 typedef SkPathEffect INHERITED; | 56 typedef SkPathEffect INHERITED; |
54 }; | 57 }; |
55 | 58 |
56 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { | 59 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { |
57 public: | 60 public: |
58 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { | 61 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { |
59 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); | 62 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); |
60 } | 63 } |
61 | 64 |
62 virtual bool filterPath(SkPath* dst, const SkPath& src, | 65 virtual bool filterPath(SkPath* dst, const SkPath& src, |
63 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 66 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
64 | 67 |
65 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) | 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) |
66 | 69 |
67 protected: | 70 protected: |
68 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) | 71 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) |
69 : Sk2DPathEffect(matrix), fWidth(width) {} | 72 : Sk2DPathEffect(matrix), fWidth(width) {} |
| 73 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 74 explicit SkLine2DPathEffect(SkReadBuffer&); |
| 75 #endif |
| 76 |
70 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 77 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
71 | 78 |
72 virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE; | 79 virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE; |
73 | 80 |
74 private: | 81 private: |
75 SkScalar fWidth; | 82 SkScalar fWidth; |
76 | 83 |
77 typedef Sk2DPathEffect INHERITED; | 84 typedef Sk2DPathEffect INHERITED; |
78 }; | 85 }; |
79 | 86 |
80 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { | 87 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { |
81 public: | 88 public: |
82 /** | 89 /** |
83 * Stamp the specified path to fill the shape, using the matrix to define | 90 * Stamp the specified path to fill the shape, using the matrix to define |
84 * the latice. | 91 * the latice. |
85 */ | 92 */ |
86 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path
) { | 93 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path
) { |
87 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); | 94 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); |
88 } | 95 } |
89 | 96 |
90 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) | 97 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) |
91 | 98 |
92 protected: | 99 protected: |
93 SkPath2DPathEffect(const SkMatrix&, const SkPath&); | 100 SkPath2DPathEffect(const SkMatrix&, const SkPath&); |
| 101 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 102 explicit SkPath2DPathEffect(SkReadBuffer& buffer); |
| 103 #endif |
94 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 104 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
95 | 105 |
96 virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE; | 106 virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE; |
97 | 107 |
98 private: | 108 private: |
99 SkPath fPath; | 109 SkPath fPath; |
100 | 110 |
101 typedef Sk2DPathEffect INHERITED; | 111 typedef Sk2DPathEffect INHERITED; |
102 }; | 112 }; |
103 | 113 |
104 #endif | 114 #endif |
OLD | NEW |