| 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 |
| 11 #define SkLayerRasterizer_DEFINED | 11 #define SkLayerRasterizer_DEFINED |
| 12 | 12 |
| 13 #include "SkRasterizer.h" | 13 #include "SkRasterizer.h" |
| 14 #include "SkDeque.h" | 14 #include "SkDeque.h" |
| 15 #include "SkScalar.h" | 15 #include "SkScalar.h" |
| 16 | 16 |
| 17 class SkPaint; | 17 class SkPaint; |
| 18 | 18 |
| 19 class SK_API SkLayerRasterizer : public SkRasterizer { | 19 class SK_API SkLayerRasterizer : public SkRasterizer { |
| 20 typedef SkRasterizer INHERITED; |
| 21 |
| 20 public: | 22 public: |
| 21 SkLayerRasterizer(); | 23 SkLayerRasterizer(); |
| 22 virtual ~SkLayerRasterizer(); | 24 virtual ~SkLayerRasterizer(); |
| 23 | 25 |
| 24 void addLayer(const SkPaint& paint) { | 26 void addLayer(const SkPaint& paint) { |
| 25 this->addLayer(paint, 0, 0); | 27 this->addLayer(paint, 0, 0); |
| 26 } | 28 } |
| 27 | 29 |
| 28 /** Add a new layer (above any previous layers) to the rasterizer. | 30 /** Add a new layer (above any previous layers) to the rasterizer. |
| 29 The layer will extract those fields that affect the mask from | 31 The layer will extract those fields that affect the mask from |
| 30 the specified paint, but will not retain a reference to the paint | 32 the specified paint, but will not retain a reference to the paint |
| 31 object itself, so it may be reused without danger of side-effects. | 33 object itself, so it may be reused without danger of side-effects. |
| 32 */ | 34 */ |
| 33 void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy); | 35 void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy); |
| 34 | 36 |
| 35 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer) | 37 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer) |
| 36 | 38 |
| 37 protected: | 39 protected: |
| 38 SkLayerRasterizer(SkFlattenableReadBuffer&); | 40 SkLayerRasterizer(SkFlattenableReadBuffer&); |
| 39 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 41 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 40 | 42 |
| 41 // override from SkRasterizer | 43 // override from SkRasterizer |
| 42 virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, | 44 virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, |
| 43 const SkIRect* clipBounds, | 45 const SkIRect* clipBounds, |
| 44 SkMask* mask, SkMask::CreateMode mode) const; | 46 SkMask* mask, SkMask::CreateMode mode) const; |
| 45 | 47 |
| 46 private: | 48 private: |
| 47 SkDeque fLayers; | 49 SkDeque fLayers; |
| 48 | |
| 49 typedef SkRasterizer INHERITED; | |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 #endif | 52 #endif |
| OLD | NEW |