aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageGenerator.h
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-10-20 15:37:41 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-20 20:09:18 +0000
commit34a2ca1747ae0e9cc1d1e46cdfefe574fc0dbe8e (patch)
tree28c1d4d0cb4b93c6d8a4a411c8286a95a3318ae6 /include/core/SkImageGenerator.h
parent78a37a53365c24670b050acf993818c435922745 (diff)
Add query to imagegenerator if it can efficiently generate a texture
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3780 Change-Id: If5fb6ee82e47f0d007b4ad7c46ac73574eccd8c5 Reviewed-on: https://skia-review.googlesource.com/3780 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core/SkImageGenerator.h')
-rw-r--r--include/core/SkImageGenerator.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index 3712a924a5..f815898392 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -14,6 +14,7 @@
#include "SkYUVSizeInfo.h"
class GrContext;
+class GrContextThreadSafeProxy;
class GrTexture;
class GrTextureParams;
class SkBitmap;
@@ -152,6 +153,15 @@ public:
bool getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]);
/**
+ * Returns true if the generate can efficiently return a texture (given the properties of the
+ * proxy). By default, simple codecs will usually return false, since they must be decoded
+ * on the CPU and then uploaded to become a texture.
+ */
+ bool canGenerateTexture(const GrContextThreadSafeProxy& proxy) {
+ return this->onCanGenerateTexture(proxy);
+ }
+
+ /**
* If the generator can natively/efficiently return its pixels as a GPU image (backed by a
* texture) this will return that image. If not, this will return NULL.
*
@@ -269,6 +279,9 @@ protected:
return false;
}
+ virtual bool onCanGenerateTexture(const GrContextThreadSafeProxy&) {
+ return false;
+ }
virtual GrTexture* onGenerateTexture(GrContext*, const SkIRect*) {
return nullptr;
}