diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-08-09 19:01:50 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-08-09 19:01:50 +0000 |
commit | 43e9f20f4b5eecb2335e26461b5c4c84f2e3bcd2 (patch) | |
tree | 25a2574e33fa0b67d4f2aaf00fff1b819921930c /samplecode | |
parent | 18dc47731f4b37d8896b51f1b92ab31abd78b5a0 (diff) |
add serialization to SkLayerRasterizer
git-svn-id: http://skia.googlecode.com/svn/trunk@2088 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleSlides.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp index 5fab682545..fc26016a3b 100644 --- a/samplecode/SampleSlides.cpp +++ b/samplecode/SampleSlides.cpp @@ -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 }; |