aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageGenerator.h
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-05-08 11:07:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-08 15:36:00 +0000
commit5bbd076c52a6cebff4a2d63edd027b0f31624287 (patch)
tree691feeb664b4ef630434d2db0a541b9375e6193c /include/core/SkImageGenerator.h
parentbb33833ed25c30007e4ea3cd3de6df728407f94e (diff)
SkImage::isValid
Lets clients know if an image is drawable to a particular GrContext (or to CPU). Checks for abandoned GrContexts beneath GPU backed images, as well as context mis-match. Bug: skia: Change-Id: Ibe88c7ce8091f965c14f6023a3597be4b70c3f99 Reviewed-on: https://skia-review.googlesource.com/15801 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/core/SkImageGenerator.h')
-rw-r--r--include/core/SkImageGenerator.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index a899c44d92..348f281965 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -51,6 +51,14 @@ public:
const SkImageInfo& getInfo() const { return fInfo; }
/**
+ * Can this generator be used to produce images that will be drawable to the specified context
+ * (or to CPU, if context is nullptr)?
+ */
+ bool isValid(GrContext* context) const {
+ return this->onIsValid(context);
+ }
+
+ /**
* Decode into the given pixels, a block of memory of size at
* least (info.fHeight - 1) * rowBytes + (info.fWidth *
* bytesPerPixel)
@@ -166,6 +174,8 @@ protected:
virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount);
+ virtual bool onIsValid(GrContext*) const;
+
virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const {
return false;
}