aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkBlurImageFilter.cpp
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-30 19:08:47 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-30 19:08:47 +0000
commitc2594f41066102d7a8a73effd3c574142a018b9a (patch)
treec37909d256544ee2932e9fbf2733b2a7c62d813c /src/effects/SkBlurImageFilter.cpp
parent74749cd45c29b4f5300e2518f2c2c765ce8ae208 (diff)
This changes the signature of SkImageFilter::filterImageGPU() to use SkBitmaps for input and output, and removes the rect param. This allows us to return textures which are larger than the actual result, such as when GrAutoScratchTextures are used. The SkBitmap's size represents the active region, while the GrTexture's size is the full texture size.
This fixes the bicubic image filter GM on the GPU, which otherwise draws garbage outside the filtered region. It also moves us closer to unifying the signatures of SkImageFilter::onFilterImage() and SkImageFilter::filterImageGPU(). Review URL: https://codereview.appspot.com/7180048 git-svn-id: http://skia.googlecode.com/svn/trunk@7467 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects/SkBlurImageFilter.cpp')
-rw-r--r--src/effects/SkBlurImageFilter.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index 38111d0fbd..78359d2130 100644
--- a/src/effects/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -11,6 +11,7 @@
#include "SkFlattenableBuffers.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
+#include "SkImageFilterUtils.h"
#endif
SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer)
@@ -187,13 +188,20 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
return true;
}
-GrTexture* SkBlurImageFilter::filterImageGPU(Proxy* proxy, GrTexture* src, const SkRect& rect) {
+bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBitmap* result) {
#if SK_SUPPORT_GPU
- SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(proxy, src, rect));
- return src->getContext()->gaussianBlur(input.get(), false, rect,
- fSigma.width(), fSigma.height());
+ SkBitmap input;
+ if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &input)) {
+ return false;
+ }
+ GrTexture* source = (GrTexture*) input.getTexture();
+ SkRect rect;
+ src.getBounds(&rect);
+ SkAutoTUnref<GrTexture> tex(source->getContext()->gaussianBlur(source, false, rect,
+ fSigma.width(), fSigma.height()));
+ return SkImageFilterUtils::WrapTexture(tex, src.width(), src.height(), result);
#else
SkDEBUGFAIL("Should not call in GPU-less build");
- return NULL;
+ return false;
#endif
}