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

Unified Diff: src/core/SkImageFilter.cpp

Issue 1874763002: Force upload to VRAM in filterImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 4af335ef4104b3b8c7da93b7f2932b9b7f494372..6cbdf625fbd868c14aaae6a7a71c0b9396039237 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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698