diff options
author | 2017-05-09 13:19:50 -0400 | |
---|---|---|
committer | 2017-05-09 18:45:04 +0000 | |
commit | 13dddce65fd87a8175a209a49f35615735a2886a (patch) | |
tree | 0f7d85e7ba8db0b3acc7c0ac2dccd839808856cf /include/core | |
parent | 3734c7d9e39cce682c5095a8f187d41223955f5c (diff) |
Added SkImage::MakeCrossContextFromEncoded
Designed for Flutter's threading architecture, with
an eye to being useful to other clients. Under the
hood, uses a new image generator class to lazily wrap
a texture for multiple GrContexts.
Re-land of https://skia-review.googlesource.com/c/14180/
Bug: skia:
Change-Id: I3dd382640629b79b3058f18fee68d043566e43e5
Reviewed-on: https://skia-review.googlesource.com/15895
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkImage.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h index e7cb3f3e33..2ba67619fe 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -159,6 +159,21 @@ public: SkAlphaType, sk_sp<SkColorSpace>, TextureReleaseProc, ReleaseContext); + /** + * Decodes and uploads the encoded data to a GPU backed image using the supplied GrContext. + * That image can be safely used by other GrContexts, across thread boundaries. The GrContext + * used here, and the ones used to draw this image later must be in the same GL share group, + * or otherwise be able to share resources. + * + * When the image's ref count reaches zero, the original GrContext will destroy the texture, + * asynchronously. + * + * The texture will be decoded and uploaded to be suitable for use with surfaces that have the + * supplied destination color space. The color space of the image itself will be determined + * from the encoded data. + */ + static sk_sp<SkImage> MakeCrossContextFromEncoded(GrContext*, sk_sp<SkData>, bool buildMips, + SkColorSpace* dstColorSpace); /** * Create a new image from the specified descriptor. Note - Skia will delete or recycle the |