diff options
author | Robert Phillips <robertphillips@google.com> | 2018-04-04 15:54:55 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-04 20:34:28 +0000 |
commit | c5509955b98daa0643da7fcd7ad356a9aa5a42da (patch) | |
tree | b8f9628b518b8efb5c4de5fd566ca4cc10be7b07 /include/core | |
parent | 1fda0247a77e5c7af57163750a3f7a04fddffdd5 (diff) |
Add GrBackendTexture accessor to SkImage (take 2)
This makes accessing the GPU resource behind an SkImage a lot more typesafe. Additionally, the GrBackendObject is being deprecated so this is the path forward.
I split the controversial stuff off into https://skia-review.googlesource.com/c/skia/+/118575 (Add SkImage::setLayout call).
Change-Id: I297e72770e8fb360fac7c7cd74f050ae759ae133
Reviewed-on: https://skia-review.googlesource.com/118571
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkImage.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h index aed0843e06..216844bc7c 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -533,7 +533,7 @@ public: /** Retrieves the back-end API handle of texture. If flushPendingGrContextIO is true, complete deferred I/O operations. - If origin in not nullptr, copies location of content drawn into SkImage. + If origin is not nullptr, copies location of content drawn into SkImage. @param flushPendingGrContextIO flag to flush outstanding requests @param origin storage for one of: kTopLeft_GrSurfaceOrigin, @@ -543,6 +543,21 @@ public: GrBackendObject getTextureHandle(bool flushPendingGrContextIO, GrSurfaceOrigin* origin = nullptr) const; +#if GR_TEST_UTILS + /** Retrieves the backend texture. If there is none an invalid object will be returned. + If flushPendingGrContextIO is true, complete deferred I/O operations. + + If origin is not nullptr, copies location of content drawn into SkImage. + + @param flushPendingGrContextIO flag to flush outstanding requests + @param origin storage for one of: kTopLeft_GrSurfaceOrigin, + kBottomLeft_GrSurfaceOrigin; or nullptr + @return back-end API texture handle. Invalid on failure. + */ + GrBackendTexture getBackendTexture(bool flushPendingGrContextIO, + GrSurfaceOrigin* origin = nullptr) const; +#endif + /** \enum SkImage::CachingHint CachingHint selects whether Skia may internally cache SkBitmap generated by decoding SkImage, or by copying SkImage from GPU to CPU. The default behavior |