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

Unified Diff: gm/imagefiltersgraph.cpp

Issue 920513003: Make filters use SkImage instead of SkBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « gm/imagefiltersbase.cpp ('k') | gyp/effects.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefiltersgraph.cpp
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index 4fa59a876683dc787a34c2e13d152e77da1ee645..f080ff3857a8bb850a876416e13a604eb47f6f86 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -37,17 +37,17 @@ 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, const SkImage* src, const Context& ctx,
+ SkAutoTUnref<const SkImage>& dst, SkIPoint* offset) const SK_OVERRIDE {
+ SkAutoTUnref<const 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;
}
@@ -55,8 +55,12 @@ public:
SkCanvas canvas(device);
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 = device->newImageSnapshot();
+ if (NULL == image) {
+ return false;
+ }
+ dst.reset(image);
offset->fX += bounds.left();
offset->fY += bounds.top();
return true;
« no previous file with comments | « gm/imagefiltersbase.cpp ('k') | gyp/effects.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698