Pass description of GrSurface to GrSurfaceProxy lazy callbacks.

Also make GrDynamicAtlas directly use the GrSurface callback type rather
than go through a springboard.

Change-Id: I3e3c155bbc1e2e794e0d6828b0ea3c64c6a7f3e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283226
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 4e603f3..08e5f52 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -117,8 +117,6 @@
     AHardwareBuffer* hardwareBuffer = fHardwareBuffer;
     AHardwareBuffer_acquire(hardwareBuffer);
 
-    const bool isProtectedContent = fIsProtectedContent;
-
     class AutoAHBRelease {
     public:
         AutoAHBRelease(AHardwareBuffer* ahb) : fAhb(ahb) {}
@@ -140,21 +138,25 @@
     };
 
     sk_sp<GrTextureProxy> texProxy = proxyProvider->createLazyProxy(
-            [direct, buffer = AutoAHBRelease(hardwareBuffer), width, height, isProtectedContent,
-             backendFormat](
-                    GrResourceProvider* resourceProvider) -> GrSurfaceProxy::LazyCallbackResult {
+            [direct, buffer = AutoAHBRelease(hardwareBuffer)](
+                    GrResourceProvider* resourceProvider,
+                    const GrSurfaceProxy::LazySurfaceDesc& desc)
+                    -> GrSurfaceProxy::LazyCallbackResult {
                 GrAHardwareBufferUtils::DeleteImageProc deleteImageProc = nullptr;
                 GrAHardwareBufferUtils::UpdateImageProc updateImageProc = nullptr;
                 GrAHardwareBufferUtils::TexImageCtx texImageCtx = nullptr;
 
+                bool isProtected = desc.fProtected == GrProtected::kYes;
                 GrBackendTexture backendTex =
-                        GrAHardwareBufferUtils::MakeBackendTexture(direct, buffer.get(),
-                                                                   width, height,
+                        GrAHardwareBufferUtils::MakeBackendTexture(direct,
+                                                                   buffer.get(),
+                                                                   desc.fDimensions.width(),
+                                                                   desc.fDimensions.height(),
                                                                    &deleteImageProc,
                                                                    &updateImageProc,
                                                                    &texImageCtx,
-                                                                   isProtectedContent,
-                                                                   backendFormat,
+                                                                   isProtected,
+                                                                   desc.fFormat,
                                                                    false);
                 if (!backendTex.isValid()) {
                     return {};
@@ -179,7 +181,7 @@
             },
             backendFormat, {width, height}, GrRenderable::kNo, 1, GrMipMapped::kNo,
             GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
-            SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
+            SkBudgeted::kNo, GrProtected(fIsProtectedContent), GrSurfaceProxy::UseAllocator::kYes);
 
     GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, grColorType);