Revert "Revert "Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage.""

This reverts commit 839fb228ac44d101a09306a9b62a96e116cc10b1.

Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-arm-Debug-Chromebook_GLES
Bug: skia:10632
Change-Id: I7c9fc21f03dfd0537fed6074e550dd8a500a12b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327623
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tools/gpu/ManagedBackendTexture.cpp b/tools/gpu/ManagedBackendTexture.cpp
index 192a57c..a1a7449 100644
--- a/tools/gpu/ManagedBackendTexture.cpp
+++ b/tools/gpu/ManagedBackendTexture.cpp
@@ -14,9 +14,9 @@
 namespace {
 
 struct Context {
-    sk_sp<sk_gpu_test::ManagedBackendTexture> fMBET;
     GrGpuFinishedProc fWrappedProc = nullptr;
     GrGpuFinishedContext fWrappedContext = nullptr;
+    sk_sp<sk_gpu_test::ManagedBackendTexture> fMBETs[SkYUVAInfo::kMaxPlanes];
 };
 
 }  // anonymous namespace
@@ -40,7 +40,16 @@
                                             GrGpuFinishedContext wrappedCtx) const {
     // Make sure we don't get a wrapped ctx without a wrapped proc
     SkASSERT(!wrappedCtx || wrappedProc);
-    return new Context{sk_ref_sp(this), wrappedProc, wrappedCtx};
+    return new Context{wrappedProc, wrappedCtx, {sk_ref_sp(this)}};
+}
+
+void* ManagedBackendTexture::MakeYUVAReleaseContext(
+        const sk_sp<ManagedBackendTexture> mbets[SkYUVAInfo::kMaxPlanes]) {
+    auto context = new Context;
+    for (int i = 0; i < SkYUVAInfo::kMaxPlanes; ++i) {
+        context->fMBETs[i] = mbets[i];
+    }
+    return context;
 }
 
 sk_sp<GrRefCntedCallback> ManagedBackendTexture::refCountedCallback() const {