2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkLayerRasterizer_DEFINED
|
|
|
|
#define SkLayerRasterizer_DEFINED
|
|
|
|
|
|
|
|
#include "SkRasterizer.h"
|
|
|
|
#include "SkDeque.h"
|
|
|
|
#include "SkScalar.h"
|
|
|
|
|
|
|
|
class SkPaint;
|
|
|
|
|
2012-10-12 14:41:39 +00:00
|
|
|
class SK_API SkLayerRasterizer : public SkRasterizer {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
|
|
|
SkLayerRasterizer();
|
|
|
|
virtual ~SkLayerRasterizer();
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-04-20 11:17:30 +00:00
|
|
|
void addLayer(const SkPaint& paint) {
|
2008-12-17 15:59:43 +00:00
|
|
|
this->addLayer(paint, 0, 0);
|
|
|
|
}
|
|
|
|
|
2012-08-23 18:09:54 +00:00
|
|
|
/** Add a new layer (above any previous layers) to the rasterizer.
|
|
|
|
The layer will extract those fields that affect the mask from
|
|
|
|
the specified paint, but will not retain a reference to the paint
|
|
|
|
object itself, so it may be reused without danger of side-effects.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy);
|
|
|
|
|
2012-03-26 17:57:35 +00:00
|
|
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer)
|
2011-08-09 19:01:50 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
protected:
|
|
|
|
SkLayerRasterizer(SkFlattenableReadBuffer&);
|
2012-03-29 15:18:04 +00:00
|
|
|
virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
// override from SkRasterizer
|
|
|
|
virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix,
|
|
|
|
const SkIRect* clipBounds,
|
2012-12-18 16:57:03 +00:00
|
|
|
SkMask* mask, SkMask::CreateMode mode) const;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkDeque fLayers;
|
|
|
|
|
|
|
|
typedef SkRasterizer INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|