OLD | NEW |
| 1 |
1 /* | 2 /* |
2 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
3 * | 4 * |
4 * 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 |
5 * found in the LICENSE file. | 6 * found in the LICENSE file. |
6 */ | 7 */ |
7 | 8 |
| 9 |
8 #ifndef SkLayerRasterizer_DEFINED | 10 #ifndef SkLayerRasterizer_DEFINED |
9 #define SkLayerRasterizer_DEFINED | 11 #define SkLayerRasterizer_DEFINED |
10 | 12 |
11 #include "SkRasterizer.h" | 13 #include "SkRasterizer.h" |
12 #include "SkDeque.h" | 14 #include "SkDeque.h" |
13 #include "SkScalar.h" | 15 #include "SkScalar.h" |
14 | 16 |
15 class SkPaint; | 17 class SkPaint; |
16 | 18 |
17 class SK_API SkLayerRasterizer : public SkRasterizer { | 19 class SK_API SkLayerRasterizer : public SkRasterizer { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 * 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. |
56 * | 58 * |
57 * 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. |
58 */ | 60 */ |
59 SkLayerRasterizer* snapshotRasterizer() const; | 61 SkLayerRasterizer* snapshotRasterizer() const; |
60 | 62 |
61 private: | 63 private: |
62 SkDeque* fLayers; | 64 SkDeque* fLayers; |
63 }; | 65 }; |
64 | 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 |
65 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer) | 80 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer) |
66 | 81 |
67 protected: | 82 protected: |
| 83 SkLayerRasterizer(SkDeque* layers); |
| 84 SkLayerRasterizer(SkReadBuffer&); |
68 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 85 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
69 | 86 |
70 // override from SkRasterizer | 87 // override from SkRasterizer |
71 virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, | 88 virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, |
72 const SkIRect* clipBounds, | 89 const SkIRect* clipBounds, |
73 SkMask* mask, SkMask::CreateMode mode) const; | 90 SkMask* mask, SkMask::CreateMode mode) const; |
74 | 91 |
| 92 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API |
| 93 public: |
| 94 #endif |
| 95 SkLayerRasterizer(); |
| 96 |
75 private: | 97 private: |
| 98 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API |
| 99 SkDeque* fLayers; |
| 100 #else |
76 const SkDeque* const fLayers; | 101 const SkDeque* const fLayers; |
77 | 102 #endif |
78 SkLayerRasterizer(); | |
79 SkLayerRasterizer(SkDeque* layers); | |
80 SkLayerRasterizer(SkReadBuffer&); | |
81 | 103 |
82 static SkDeque* ReadLayers(SkReadBuffer& buffer); | 104 static SkDeque* ReadLayers(SkReadBuffer& buffer); |
83 | 105 |
84 friend class LayerRasterizerTester; | 106 friend class LayerRasterizerTester; |
85 | 107 |
86 typedef SkRasterizer INHERITED; | 108 typedef SkRasterizer INHERITED; |
87 }; | 109 }; |
88 | 110 |
89 #endif | 111 #endif |
OLD | NEW |