aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageGenerator.h
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-03-03 11:10:18 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-03 17:40:52 +0000
commit4447b64a88ea141161fca772c2fec28b6141bbc3 (patch)
treefce75d30623892dfe7271acdd671623240302e10 /include/core/SkImageGenerator.h
parent3c6d5b0daa8c9ff1137bb2ef9b00a712bb3a47c2 (diff)
Switch SkImageGenerator over to generating GrTextureProxies
It does not seem irrational for generateTexture to always receive a valid GrContext. lockAsBitmap can do as it pleases. This is split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors) Change-Id: I8aebc813a8a3a7d694b7369c2c9810e2164fe16e Reviewed-on: https://skia-review.googlesource.com/9191 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/core/SkImageGenerator.h')
-rw-r--r--include/core/SkImageGenerator.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index b193f48f01..6263dee574 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -16,7 +16,7 @@
class GrContext;
class GrContextThreadSafeProxy;
-class GrTexture;
+class GrTextureProxy;
class GrSamplerParams;
class SkBitmap;
class SkData;
@@ -112,6 +112,7 @@ public:
*/
bool getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]);
+#if SK_SUPPORT_GPU
/**
* 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.
@@ -130,16 +131,13 @@ public:
*
* Regarding the GrContext parameter:
*
- * The caller may pass NULL for the context. In that case the generator may assume that its
- * internal context is current. If it has no internal context, then it should just return
- * null.
- *
- * If the caller passes a non-null context, then the generator should only succeed if:
- * - it has no intrinsic context, and will use the caller's
+ * It must be non-NULL. The generator should only succeed if:
* - its internal context is the same
* - it can somehow convert its texture into one that is valid for the provided context.
*/
- GrTexture* generateTexture(GrContext*, const SkImageInfo& info, const SkIPoint& origin);
+ sk_sp<GrTextureProxy> generateTexture(GrContext*, const SkImageInfo& info,
+ const SkIPoint& origin);
+#endif
/**
* If the default image decoder system can interpret the specified (encoded) data, then
@@ -179,9 +177,10 @@ protected:
return false;
}
- virtual GrTexture* onGenerateTexture(GrContext*, const SkImageInfo&, const SkIPoint&) {
- return nullptr;
- }
+#if SK_SUPPORT_GPU
+ virtual sk_sp<GrTextureProxy> onGenerateTexture(GrContext*, const SkImageInfo&,
+ const SkIPoint&);
+#endif
private:
const SkImageInfo fInfo;