Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: src/effects/SkRectShaderImageFilter.cpp

Issue 920513003: Make filters use SkImage instead of SkBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/effects/SkRectShaderImageFilter.cpp
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index a00994e75b64ffe5b5145822ac9a6c8db054a467..04060f102442523162de7e5074b86fd261fc1bd4 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -50,9 +50,9 @@ SkRectShaderImageFilter::~SkRectShaderImageFilter() {
}
bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
- const SkBitmap& source,
+ const SkImage* source,
const Context& ctx,
- SkBitmap* result,
+ SkAutoTUnref<const SkImage>& result,
SkIPoint* offset) const {
SkIRect bounds;
if (!this->applyCropRect(ctx, source, SkIPoint::Make(0, 0), &bounds)) {
@@ -73,8 +73,12 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bounds.height()));
canvas.drawRect(rect, paint);
+ SkImage* image = device->newImageSnapshot();
+ if (NULL == image) {
+ return false;
+ }
+ result.reset(image);
- *result = device.get()->accessBitmap(false);
offset->fX = bounds.fLeft;
offset->fY = bounds.fTop;
return true;

Powered by Google App Engine
This is Rietveld 408576698