Index: gm/imagefiltersgraph.cpp |
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp |
index 4fa59a876683dc787a34c2e13d152e77da1ee645..8ecb77a74bc086f86e035bdcc16ec206a83cdf2a 100644 |
--- a/gm/imagefiltersgraph.cpp |
+++ b/gm/imagefiltersgraph.cpp |
@@ -8,7 +8,7 @@ |
#include "gm.h" |
#include "SkArithmeticMode.h" |
-#include "SkDevice.h" |
+#include "SkSurface.h" |
#include "SkBitmapSource.h" |
#include "SkBlurImageFilter.h" |
#include "SkColorFilter.h" |
@@ -37,26 +37,30 @@ public: |
return SkNEW_ARGS(SimpleOffsetFilter, (dx, dy, input)); |
} |
- virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx, |
- SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE { |
- SkBitmap source = src; |
+ virtual bool onFilterImage(Proxy* proxy, SkImage& src, const Context& ctx, |
+ SkAutoTUnref<SkImage>& dst, SkIPoint* offset) const SK_OVERRIDE { |
+ SkAutoTUnref<SkImage> source(SkRef(&src)); |
SkImageFilter* input = getInput(0); |
SkIPoint srcOffset = SkIPoint::Make(0, 0); |
- if (input && !input->filterImage(proxy, src, ctx, &source, &srcOffset)) { |
+ if (input && !input->filterImage(proxy, src, ctx, source, &srcOffset)) { |
return false; |
} |
SkIRect bounds; |
- if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &source)) { |
+ if (!this->applyCropRect(ctx, proxy, *source, &srcOffset, &bounds, source)) { |
return false; |
} |
- SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height())); |
- SkCanvas canvas(device); |
+ SkAutoTUnref<SkSurface> surface(proxy->createSurface(bounds.width(), bounds.height())); |
+ SkCanvas* canvas = surface->getCanvas(); |
SkPaint paint; |
paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
- canvas.drawBitmap(source, fDX - bounds.left(), fDY - bounds.top(), &paint); |
- *dst = device->accessBitmap(false); |
+ canvas->drawImage(source, fDX - bounds.left(), fDY - bounds.top(), &paint); |
+ SkImage* image = surface->newImageSnapshot(SkSurface::kYes_Budgeted); |
+ if (NULL == image) { |
+ return false; |
+ } |
+ dst.reset(image); |
offset->fX += bounds.left(); |
offset->fY += bounds.top(); |
return true; |