Migrate SkImage::MakeFromTexture to GrRecordingContext
Android migration landed in Android CL 12234077
Chrome migration is landing in Chrome CL 2335812
Note: makeFromCompressedTexture is not used by Chrome.
Bug: skia:104662
Change-Id: Ibbe6d412cf22e87188926383d10b21f780208e48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305102
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
diff --git a/tests/BackendSurfaceMutableStateTest.cpp b/tests/BackendSurfaceMutableStateTest.cpp
index 9576c20..89b7a19 100644
--- a/tests/BackendSurfaceMutableStateTest.cpp
+++ b/tests/BackendSurfaceMutableStateTest.cpp
@@ -20,10 +20,10 @@
#include "src/gpu/vk/GrVkTexture.h"
DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendSurfaceMutableStateTest, reporter, ctxInfo) {
- auto context = ctxInfo.directContext();
+ auto dContext = ctxInfo.directContext();
GrBackendFormat format = GrBackendFormat::MakeVk(VK_FORMAT_R8G8B8A8_UNORM);
- GrBackendTexture backendTex = context->createBackendTexture(
+ GrBackendTexture backendTex = dContext->createBackendTexture(
32, 32, format, GrMipmapped::kNo, GrRenderable::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, backendTex.isValid());
@@ -56,12 +56,12 @@
// Setting back to the init state since we didn't actually change it
backendTex.setMutableState(initState);
- sk_sp<SkImage> wrappedImage = SkImage::MakeFromTexture(context, backendTex,
+ sk_sp<SkImage> wrappedImage = SkImage::MakeFromTexture(dContext, backendTex,
kTopLeft_GrSurfaceOrigin,
kRGBA_8888_SkColorType,
kPremul_SkAlphaType, nullptr);
- const GrSurfaceProxyView* view = as_IB(wrappedImage)->view(context);
+ const GrSurfaceProxyView* view = as_IB(wrappedImage)->view(dContext);
REPORTER_ASSERT(reporter, view);
REPORTER_ASSERT(reporter, view->proxy()->isInstantiated());
GrTexture* texture = view->proxy()->peekTexture();
@@ -105,9 +105,9 @@
// Test using the setBackendTextureStateAPI. Unlike the previous test this will actually add
// real transitions to the image so we need to be careful about doing actual valid transitions.
- GrVkGpu* gpu = static_cast<GrVkGpu*>(context->priv().getGpu());
+ GrVkGpu* gpu = static_cast<GrVkGpu*>(dContext->priv().getGpu());
- context->setBackendTextureState(backendTex, newState);
+ dContext->setBackendTextureState(backendTex, newState);
REPORTER_ASSERT(reporter, backendTex.getVkImageInfo(&info));
REPORTER_ASSERT(reporter, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL == info.fImageLayout);
@@ -119,16 +119,16 @@
GrBackendSurfaceMutableState externalState(VK_IMAGE_LAYOUT_GENERAL,
VK_QUEUE_FAMILY_EXTERNAL);
- context->setBackendTextureState(backendTex, externalState);
+ dContext->setBackendTextureState(backendTex, externalState);
REPORTER_ASSERT(reporter, backendTex.getVkImageInfo(&info));
REPORTER_ASSERT(reporter, VK_IMAGE_LAYOUT_GENERAL == info.fImageLayout);
REPORTER_ASSERT(reporter, VK_QUEUE_FAMILY_EXTERNAL == info.fCurrentQueueFamily);
- context->submit();
+ dContext->submit();
GrBackendSurfaceMutableState externalState2(VK_IMAGE_LAYOUT_GENERAL, initQueue);
- context->setBackendTextureState(backendTex, externalState2);
+ dContext->setBackendTextureState(backendTex, externalState2);
REPORTER_ASSERT(reporter, backendTex.getVkImageInfo(&info));
REPORTER_ASSERT(reporter, VK_IMAGE_LAYOUT_GENERAL == info.fImageLayout);
@@ -136,9 +136,9 @@
}
// We must submit this work before we try to delete the backend texture.
- context->submit(true);
+ dContext->submit(true);
- context->deleteBackendTexture(backendTex);
+ dContext->deleteBackendTexture(backendTex);
}
#endif