Index: src/effects/SkPictureImageFilter.cpp |
diff --git a/src/effects/SkPictureImageFilter.cpp b/src/effects/SkPictureImageFilter.cpp |
index baae6f8c674c9fc22b9eafbf4d5f68f7015eea80..dfedc37e7045e459fc4a1968f8d13f78f8b489ca 100644 |
--- a/src/effects/SkPictureImageFilter.cpp |
+++ b/src/effects/SkPictureImageFilter.cpp |
@@ -90,8 +90,8 @@ void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const { |
} |
} |
-bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const Context& ctx, |
- SkBitmap* result, SkIPoint* offset) const { |
+bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkImage*, const Context& ctx, |
+ SkAutoTUnref<const SkImage>& result, SkIPoint* offset) const { |
if (!fPicture) { |
offset->fX = offset->fY = 0; |
return true; |
@@ -121,7 +121,12 @@ bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const Co |
drawPictureAtLocalResolution(proxy, device.get(), bounds, ctx); |
} |
- *result = device.get()->accessBitmap(false); |
+ SkImage* snapshot = device->newImageSnapshot(); |
+ if (NULL == snapshot) { |
+ return false; |
+ } |
+ result.reset(snapshot); |
+ |
offset->fX = bounds.fLeft; |
offset->fY = bounds.fTop; |
return true; |
@@ -160,6 +165,10 @@ void SkPictureImageFilter::drawPictureAtLocalResolution(Proxy* proxy, SkBaseDevi |
localCanvas.translate(-SkIntToScalar(localIBounds.fLeft), -SkIntToScalar(localIBounds.fTop)); |
localCanvas.drawPicture(fPicture); |
+ SkAutoTUnref<SkImage> image(localDevice->newImageSnapshot()); |
+ if (NULL == image) { |
+ return; |
+ } |
// Pass explicit surface props, as the simplified canvas constructor discards device properties. |
// FIXME: switch back to the public constructor (and unfriend) after |
// https://code.google.com/p/skia/issues/detail?id=3142 is fixed. |
@@ -169,8 +178,8 @@ void SkPictureImageFilter::drawPictureAtLocalResolution(Proxy* proxy, SkBaseDevi |
canvas.concat(ctx.ctm()); |
SkPaint paint; |
paint.setFilterQuality(fFilterQuality); |
- canvas.drawBitmap(localDevice.get()->accessBitmap(false), SkIntToScalar(localIBounds.fLeft), |
- SkIntToScalar(localIBounds.fTop), &paint); |
+ canvas.drawImage(image, SkIntToScalar(localIBounds.fLeft), |
+ SkIntToScalar(localIBounds.fTop), &paint); |
//canvas.drawPicture(fPicture); |
} |