Index: gm/resizeimagefilter.cpp |
diff --git a/gm/resizeimagefilter.cpp b/gm/resizeimagefilter.cpp |
index ca7f554fdbd9bad18047cf4ba23c63a6192f4f48..9a684a28597252c8722652ac63c638a99ae65a98 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, |