OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkLayerRasterizer_DEFINED | 10 #ifndef SkLayerRasterizer_DEFINED |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 * Future calls to addLayer will not affect rasterizers previously ret
urned by this call. | 57 * Future calls to addLayer will not affect rasterizers previously ret
urned by this call. |
58 * | 58 * |
59 * The caller is responsible for calling unref() on the returned objec
t, if non NULL. | 59 * The caller is responsible for calling unref() on the returned objec
t, if non NULL. |
60 */ | 60 */ |
61 SkLayerRasterizer* snapshotRasterizer() const; | 61 SkLayerRasterizer* snapshotRasterizer() const; |
62 | 62 |
63 private: | 63 private: |
64 SkDeque* fLayers; | 64 SkDeque* fLayers; |
65 }; | 65 }; |
66 | 66 |
67 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API | |
68 void addLayer(const SkPaint& paint) { | |
69 this->addLayer(paint, 0, 0); | |
70 } | |
71 | |
72 /** Add a new layer (above any previous layers) to the rasterizer. | |
73 The layer will extract those fields that affect the mask from | |
74 the specified paint, but will not retain a reference to the paint | |
75 object itself, so it may be reused without danger of side-effects. | |
76 */ | |
77 void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy); | |
78 #endif | |
79 | |
80 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer) | 67 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer) |
81 | 68 |
82 protected: | 69 protected: |
| 70 SkLayerRasterizer(); |
83 SkLayerRasterizer(SkDeque* layers); | 71 SkLayerRasterizer(SkDeque* layers); |
84 SkLayerRasterizer(SkReadBuffer&); | 72 SkLayerRasterizer(SkReadBuffer&); |
85 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 73 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
86 | 74 |
87 // override from SkRasterizer | 75 // override from SkRasterizer |
88 virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, | 76 virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, |
89 const SkIRect* clipBounds, | 77 const SkIRect* clipBounds, |
90 SkMask* mask, SkMask::CreateMode mode) const; | 78 SkMask* mask, SkMask::CreateMode mode) const; |
91 | 79 |
92 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API | |
93 public: | |
94 #endif | |
95 SkLayerRasterizer(); | |
96 | |
97 private: | 80 private: |
98 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API | |
99 SkDeque* fLayers; | |
100 #else | |
101 const SkDeque* const fLayers; | 81 const SkDeque* const fLayers; |
102 #endif | |
103 | 82 |
104 static SkDeque* ReadLayers(SkReadBuffer& buffer); | 83 static SkDeque* ReadLayers(SkReadBuffer& buffer); |
105 | 84 |
106 friend class LayerRasterizerTester; | 85 friend class LayerRasterizerTester; |
107 | 86 |
108 typedef SkRasterizer INHERITED; | 87 typedef SkRasterizer INHERITED; |
109 }; | 88 }; |
110 | 89 |
111 #endif | 90 #endif |
OLD | NEW |