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

Unified Diff: src/effects/SkOffsetImageFilter.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 | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/effects/SkPictureImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkOffsetImageFilter.cpp
diff --git a/src/effects/SkOffsetImageFilter.cpp b/src/effects/SkOffsetImageFilter.cpp
index 1944e58922d3e4e1f5adca05039ebb693c227204..1b5f06765b83b8e230cb7a438ea507c9baa68b91 100644
--- a/src/effects/SkOffsetImageFilter.cpp
+++ b/src/effects/SkOffsetImageFilter.cpp
@@ -14,19 +14,19 @@
#include "SkMatrix.h"
#include "SkPaint.h"
-bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source,
+bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkImage* source,
const Context& ctx,
- SkBitmap* result,
+ SkAutoTUnref<const SkImage>& result,
SkIPoint* offset) const {
SkImageFilter* input = getInput(0);
- SkBitmap src = source;
+ SkAutoTUnref<const SkImage> src(SkRef(source));
SkIPoint srcOffset = SkIPoint::Make(0, 0);
#ifdef SK_DISABLE_OFFSETIMAGEFILTER_OPTIMIZATION
if (false) {
#else
if (!cropRectIsSet()) {
#endif
- if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) {
+ if (input && !input->filterImage(proxy, source, ctx, src, &srcOffset)) {
return false;
}
@@ -35,9 +35,9 @@ bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source,
offset->fX = srcOffset.fX + SkScalarRoundToInt(vec.fX);
offset->fY = srcOffset.fY + SkScalarRoundToInt(vec.fY);
- *result = src;
+ result.swap(&src);
} else {
- if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) {
+ if (input && !input->filterImage(proxy, source, ctx, src, &srcOffset)) {
return false;
}
@@ -57,8 +57,13 @@ bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source,
SkIntToScalar(srcOffset.fY - bounds.fTop));
SkVector vec;
ctx.ctm().mapVectors(&vec, &fOffset, 1);
- canvas.drawBitmap(src, vec.x(), vec.y(), &paint);
- *result = device->accessBitmap(false);
+ canvas.drawImage(src, vec.x(), vec.y(), &paint);
+ SkImage* image = device->newImageSnapshot();
+ if (NULL == image) {
+ return false;
+ }
+ result.reset(image);
+
offset->fX = bounds.fLeft;
offset->fY = bounds.fTop;
}
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/effects/SkPictureImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698