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