diff options
author | Stan Iliev <stani@google.com> | 2017-06-02 10:29:21 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-02 14:51:24 +0000 |
commit | 7e910df7f133e80293117bdd069ed25998d10f8c (patch) | |
tree | 5bfeea96c4904ba67fa551a76def78f17470ad73 /include | |
parent | affa6a3da87e9ea85f1d4fe3137b5bccbbc56f92 (diff) |
Implement an SkImage backed by a Android hardware buffer
Create a new SkImage public API to make an image from an Android
hardware buffer. Implementation is using a SkImageGenerator
derived class GrAndroidBufferImageGenerator.
A new EGLImage texture is created, which is then wrapped with
GrTextureProxy.
Bug: skia:
Change-Id: I610a4c5a58198686ce7c03e9a0adad3f9d2342e0
Reviewed-on: https://skia-review.googlesource.com/17789
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stan Iliev <stani@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkImage.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 2b0a164833..bc0597c300 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -29,6 +29,10 @@ class GrContext; class GrContextThreadSafeProxy; class GrTexture; +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK +struct AHardwareBuffer; +#endif + /** * SkImage is an abstraction for drawing a rectagle of pixels, though the * particular type of image could be actually storing its data on the GPU, or @@ -232,6 +236,16 @@ public: const SkMatrix*, const SkPaint*, BitDepth, sk_sp<SkColorSpace>); +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK + /** + * Create a new image from the an Android hardware buffer. + * The new image takes a reference on the buffer. + */ + static sk_sp<SkImage> MakeFromAHardwareBuffer(AHardwareBuffer*, + SkAlphaType = kPremul_SkAlphaType, + sk_sp<SkColorSpace> = nullptr); +#endif + /////////////////////////////////////////////////////////////////////////////////////////////// int width() const { return fWidth; } |