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>
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 40daa6f..4f8fe74 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -167,6 +167,13 @@
     return as_IB(this)->onGetTextureHandle(flushPendingGrContextIO, origin);
 }
 
+#if GR_TEST_UTILS
+GrBackendTexture SkImage::getBackendTexture(bool flushPendingGrContextIO,
+                                            GrSurfaceOrigin* origin) const {
+    return as_IB(this)->onGetBackendTexture(flushPendingGrContextIO, origin);
+}
+#endif
+
 bool SkImage::isValid(GrContext* context) const {
     if (context && context->contextPriv().abandoned()) {
         return false;
@@ -182,6 +189,11 @@
 
 GrBackendObject SkImage::getTextureHandle(bool, GrSurfaceOrigin*) const { return 0; }
 
+GrBackendTexture SkImage::getBackendTexture(bool flushPendingGrContextIO,
+                                            GrSurfaceOrigin* origin) const {
+    return GrBackendTexture(); // invalid
+}
+
 bool SkImage::isValid(GrContext* context) const {
     if (context) {
         return false;