aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkImageFilter.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-11 10:20:24 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-11 10:20:24 -0700
commit29feef80de0af74eb24b703d6675aea1bc17e655 (patch)
treeca1f5ed7afaa5a52b735d52d5d97f2cfcde3519f /src/core/SkImageFilter.cpp
parent48b88cc1f6658350d7905e7dca3ba5c53adbba00 (diff)
Force upload to VRAM in filterImage
This forces the conversion of image filter result to VRAM (if it is required) prior to the filtered result being put into the ImageFilter cache. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1874763002 Review URL: https://codereview.chromium.org/1874763002
Diffstat (limited to 'src/core/SkImageFilter.cpp')
-rw-r--r--src/core/SkImageFilter.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 4af335ef41..6cbdf625fb 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -251,6 +251,16 @@ sk_sp<SkSpecialImage> SkImageFilter::filterImage(SkSpecialImage* src, const Cont
}
sk_sp<SkSpecialImage> result(this->onFilterImage(src, context, offset));
+
+#if SK_SUPPORT_GPU
+ if (src->isTextureBacked() && result && !result->isTextureBacked()) {
+ // Keep the result on the GPU - this is still required for some
+ // image filters that don't support GPU in all cases
+ GrContext* context = src->getContext();
+ result = result->makeTextureImage(src->internal_getProxy(), context);
+ }
+#endif
+
if (result && context.cache()) {
context.cache()->set(key, result.get(), *offset);
SkAutoMutexAcquire mutex(fMutex);
@@ -602,14 +612,7 @@ sk_sp<SkSpecialImage> SkImageFilter::filterInput(int index,
sk_sp<SkSpecialImage> result(input->filterImage(src, this->mapContext(ctx), offset));
-#if SK_SUPPORT_GPU
- if (src->isTextureBacked() && result && !result->isTextureBacked()) {
- // Keep the result on the GPU - this is still required for some
- // image filters that don't support GPU in all cases
- GrContext* context = src->getContext();
- return result->makeTextureImage(src->internal_getProxy(), context);
- }
-#endif
+ SkASSERT(!result || src->isTextureBacked() == result->isTextureBacked());
return result;
}