diff options
author | fmalita <fmalita@chromium.org> | 2015-09-15 11:26:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-15 11:26:14 -0700 |
commit | 5598b63cd2443a608a74a222d0206bb2455383b7 (patch) | |
tree | 1e661b0510b7deeadea831d5288989598a66a3a8 /gm/resizeimagefilter.cpp | |
parent | 30c4cae7d3a26252e7e45adf6e5722b34adf6848 (diff) |
Convert unit tests, GMs from SkBitmapSource to SkImagesource
This removes SkBitmapSource clients within Skia.
http://crrev.com/1334173004 does the same for Blink, so we should be
able to remove SkBitmapSource in a follow-up.
R=reed@google.com,robertphillips@google.com,mtklein@google.com
Review URL: https://codereview.chromium.org/1343123002
Diffstat (limited to 'gm/resizeimagefilter.cpp')
-rw-r--r-- | gm/resizeimagefilter.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gm/resizeimagefilter.cpp b/gm/resizeimagefilter.cpp index ca7f554fdb..9a684a2859 100644 --- a/gm/resizeimagefilter.cpp +++ b/gm/resizeimagefilter.cpp @@ -6,9 +6,10 @@ */ #include "gm.h" -#include "SkBitmapSource.h" #include "SkColor.h" +#include "SkImageSource.h" #include "SkRefCnt.h" +#include "SkSurface.h" namespace skiagm { @@ -86,20 +87,21 @@ protected: deviceSize, kHigh_SkFilterQuality); - SkBitmap bitmap; - bitmap.allocN32Pixels(16, 16); - bitmap.eraseARGB(0x00, 0x00, 0x00, 0x00); + SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(16, 16)); + SkCanvas* surfaceCanvas = surface->getCanvas(); + surfaceCanvas->clear(0x000000); { - SkCanvas bitmapCanvas(bitmap); SkPaint paint; paint.setColor(0xFF00FF00); SkRect ovalRect = SkRect::MakeWH(16, 16); ovalRect.inset(SkIntToScalar(2)/3, SkIntToScalar(2)/3); - bitmapCanvas.drawOval(ovalRect, paint); + surfaceCanvas->drawOval(ovalRect, paint); } + SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); SkRect inRect = SkRect::MakeXYWH(-4, -4, 20, 20); SkRect outRect = SkRect::MakeXYWH(-24, -24, 120, 120); - SkAutoTUnref<SkBitmapSource> source(SkBitmapSource::Create(bitmap, inRect, outRect)); + SkAutoTUnref<SkImageFilter> source( + SkImageSource::Create(image, inRect, outRect, kHigh_SkFilterQuality)); canvas->translate(srcRect.width() + SkIntToScalar(10), 0); draw(canvas, srcRect, |