add serialization to SkLayerRasterizer

git-svn-id: http://skia.googlecode.com/svn/trunk@2088 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-08-09 19:01:50 +00:00
Родитель 18dc47731f
Коммит 43e9f20f4b
3 изменённых файлов: 14 добавлений и 16 удалений

Просмотреть файл

@ -36,6 +36,8 @@ public:
virtual Factory getFactory();
virtual void flatten(SkFlattenableWriteBuffer&);
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
protected:
SkLayerRasterizer(SkFlattenableReadBuffer&);
@ -46,8 +48,6 @@ protected:
private:
SkDeque fLayers;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
typedef SkRasterizer INHERITED;
};

Просмотреть файл

@ -94,23 +94,18 @@ static void discrete_pe(SkPaint* paint) {
paint->setPathEffect(new SkDiscretePathEffect(10, 4))->unref();
}
class TilePathEffect : public Sk2DPathEffect {
static SkMatrix make_mat() {
SkMatrix m;
m.setScale(12, 12);
return m;
}
public:
TilePathEffect() : Sk2DPathEffect(make_mat()) {}
static SkPathEffect* MakeTileEffect() {
SkMatrix m;
m.setScale(SkIntToScalar(12), SkIntToScalar(12));
protected:
virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) {
dst->addCircle(loc.fX, loc.fY, 5);
}
};
SkPath path;
path.addCircle(0, 0, SkIntToScalar(5));
return new SkPath2DPathEffect(m, path);
}
static void tile_pe(SkPaint* paint) {
paint->setPathEffect(new TilePathEffect)->unref();
paint->setPathEffect(MakeTileEffect())->unref();
}
static const PE_Proc gPE2[] = { fill_pe, discrete_pe, tile_pe };

Просмотреть файл

@ -223,3 +223,6 @@ SkFlattenable::Factory SkLayerRasterizer::getFactory() {
return CreateProc;
}
static SkFlattenable::Registrar gReg("SkLayerRasterizer",
SkLayerRasterizer::CreateProc);