diff options
author | 2012-09-27 21:57:45 +0000 | |
---|---|---|
committer | 2012-09-27 21:57:45 +0000 | |
commit | 9c39744a00573b7133fc765b0a9d50a0ceace7b8 (patch) | |
tree | f416a1bf3e821884974ec2cf4e0d383ad75d16e2 /src/effects | |
parent | 200e53fa5fe7dae717a73224064a2fc37302e003 (diff) |
Fix recursive GPU processing for SkImageFilter. Plumb through the
SkImageFilter::Proxy parameter to the GPU recursion path. Extract
DeviceImageFilterProxy from SkCanvas.cpp into its own .h, and rename it.
https://codereview.appspot.com/6575059/
git-svn-id: http://skia.googlecode.com/svn/trunk@5720 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkBlendImageFilter.cpp | 13 | ||||
-rw-r--r-- | src/effects/SkBlurImageFilter.cpp | 4 | ||||
-rw-r--r-- | src/effects/SkMorphologyImageFilter.cpp | 8 | ||||
-rw-r--r-- | src/effects/SkSingleInputImageFilter.cpp | 9 |
4 files changed, 18 insertions, 16 deletions
diff --git a/src/effects/SkBlendImageFilter.cpp b/src/effects/SkBlendImageFilter.cpp index 2328d95aec..b604bc2dfe 100644 --- a/src/effects/SkBlendImageFilter.cpp +++ b/src/effects/SkBlendImageFilter.cpp @@ -165,7 +165,8 @@ private: }; // FIXME: This should be refactored with SkSingleInputImageFilter's version. -static GrTexture* getInputResultAsTexture(SkImageFilter* input, +static GrTexture* getInputResultAsTexture(SkImageFilter::Proxy* proxy, + SkImageFilter* input, GrTexture* src, const SkRect& rect) { GrTexture* resultTex; @@ -173,13 +174,13 @@ static GrTexture* getInputResultAsTexture(SkImageFilter* input, resultTex = src; } else if (input->canFilterImageGPU()) { // onFilterImageGPU() already refs the result, so just return it here. - return input->onFilterImageGPU(src, rect); + return input->onFilterImageGPU(proxy, src, rect); } else { SkBitmap srcBitmap, result; srcBitmap.setConfig(SkBitmap::kARGB_8888_Config, src->width(), src->height()); srcBitmap.setPixelRef(new SkGrPixelRef(src))->unref(); SkIPoint offset; - if (input->filterImage(NULL, srcBitmap, SkMatrix(), &result, &offset)) { + if (input->filterImage(proxy, srcBitmap, SkMatrix(), &result, &offset)) { if (result.getTexture()) { resultTex = (GrTexture*) result.getTexture(); } else { @@ -196,9 +197,9 @@ static GrTexture* getInputResultAsTexture(SkImageFilter* input, return resultTex; } -GrTexture* SkBlendImageFilter::onFilterImageGPU(GrTexture* src, const SkRect& rect) { - SkAutoTUnref<GrTexture> background(getInputResultAsTexture(fBackground, src, rect)); - SkAutoTUnref<GrTexture> foreground(getInputResultAsTexture(fForeground, src, rect)); +GrTexture* SkBlendImageFilter::onFilterImageGPU(Proxy* proxy, GrTexture* src, const SkRect& rect) { + SkAutoTUnref<GrTexture> background(getInputResultAsTexture(proxy, fBackground, src, rect)); + SkAutoTUnref<GrTexture> foreground(getInputResultAsTexture(proxy, fForeground, src, rect)); GrContext* context = src->getContext(); GrTextureDesc desc; diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp index 2a61460788..fb76269823 100644 --- a/src/effects/SkBlurImageFilter.cpp +++ b/src/effects/SkBlurImageFilter.cpp @@ -187,9 +187,9 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy, return true; } -GrTexture* SkBlurImageFilter::onFilterImageGPU(GrTexture* src, const SkRect& rect) { +GrTexture* SkBlurImageFilter::onFilterImageGPU(Proxy* proxy, GrTexture* src, const SkRect& rect) { #if SK_SUPPORT_GPU - SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(src, rect)); + SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(proxy, src, rect)); return src->getContext()->gaussianBlur(input.get(), false, rect, fSigma.width(), fSigma.height()); #else diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 5bf9a99786..b1ee602b25 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -478,13 +478,13 @@ GrTexture* apply_morphology(GrTexture* srcTexture, }; -GrTexture* SkDilateImageFilter::onFilterImageGPU(GrTexture* src, const SkRect& rect) { - SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(src, rect)); +GrTexture* SkDilateImageFilter::onFilterImageGPU(Proxy* proxy, GrTexture* src, const SkRect& rect) { + SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(proxy, src, rect)); return apply_morphology(src, rect, GrMorphologyEffect::kDilate_MorphologyType, radius()); } -GrTexture* SkErodeImageFilter::onFilterImageGPU(GrTexture* src, const SkRect& rect) { - SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(src, rect)); +GrTexture* SkErodeImageFilter::onFilterImageGPU(Proxy* proxy, GrTexture* src, const SkRect& rect) { + SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(proxy, src, rect)); return apply_morphology(src, rect, GrMorphologyEffect::kErode_MorphologyType, radius()); } diff --git a/src/effects/SkSingleInputImageFilter.cpp b/src/effects/SkSingleInputImageFilter.cpp index a1c4292fae..3dd9ef9c90 100644 --- a/src/effects/SkSingleInputImageFilter.cpp +++ b/src/effects/SkSingleInputImageFilter.cpp @@ -51,20 +51,21 @@ SkBitmap SkSingleInputImageFilter::getInputResult(Proxy* proxy, } #if SK_SUPPORT_GPU -GrTexture* SkSingleInputImageFilter::getInputResultAsTexture(GrTexture* src, +GrTexture* SkSingleInputImageFilter::getInputResultAsTexture(Proxy* proxy, + GrTexture* src, const SkRect& rect) { - GrTexture* resultTex; + GrTexture* resultTex = NULL; if (!fInput) { resultTex = src; } else if (fInput->canFilterImageGPU()) { // onFilterImageGPU() already refs the result, so just return it here. - return fInput->onFilterImageGPU(src, rect); + return fInput->onFilterImageGPU(proxy, src, rect); } else { SkBitmap srcBitmap, result; srcBitmap.setConfig(SkBitmap::kARGB_8888_Config, src->width(), src->height()); srcBitmap.setPixelRef(new SkGrPixelRef(src))->unref(); SkIPoint offset; - if (fInput->filterImage(NULL, srcBitmap, SkMatrix(), &result, &offset)) { + if (fInput->filterImage(proxy, srcBitmap, SkMatrix(), &result, &offset)) { if (result.getTexture()) { resultTex = (GrTexture*) result.getTexture(); } else { |