Convert more tests to GrDirectContext/GrRecordingContext pair
TBR=bsalomon@google.com
Change-Id: I5bb78f4e36c4037669e7907cbe818da743480ef4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305009
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
index d57ffd7..c271861 100644
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ b/tests/GrTestingBackendTextureUploadTest.cpp
@@ -14,13 +14,9 @@
#include "tests/Test.h"
#include "tests/TestUtils.h"
-void testing_only_texture_test(skiatest::Reporter* reporter, GrContext* context, SkColorType ct,
- GrRenderable renderable, bool doDataUpload, GrMipmapped mipMapped) {
- auto direct = context->asDirectContext();
- if (!direct) {
- return;
- }
-
+static void testing_only_texture_test(skiatest::Reporter* reporter, GrDirectContext* dContext,
+ SkColorType ct, GrRenderable renderable, bool doDataUpload,
+ GrMipmapped mipMapped) {
const int kWidth = 16;
const int kHeight = 16;
@@ -30,11 +26,11 @@
expectedPixels.alloc(ii);
actualPixels.alloc(ii);
- const GrCaps* caps = direct->priv().caps();
+ const GrCaps* caps = dContext->priv().caps();
GrColorType grCT = SkColorTypeToGrColorType(ct);
- GrBackendFormat backendFormat = direct->defaultBackendFormat(ct, renderable);
+ GrBackendFormat backendFormat = dContext->defaultBackendFormat(ct, renderable);
if (!backendFormat.isValid()) {
return;
}
@@ -46,11 +42,11 @@
FillPixelData(kWidth, kHeight, expectedPixels.writable_addr32(0, 0));
- backendTex = direct->createBackendTexture(&expectedPixels, 1,
- renderable, GrProtected::kNo);
+ backendTex = dContext->createBackendTexture(&expectedPixels, 1,
+ renderable, GrProtected::kNo);
} else {
- backendTex = direct->createBackendTexture(kWidth, kHeight, ct, SkColors::kTransparent,
- mipMapped, renderable, GrProtected::kNo);
+ backendTex = dContext->createBackendTexture(kWidth, kHeight, ct, SkColors::kTransparent,
+ mipMapped, renderable, GrProtected::kNo);
size_t allocSize = SkAutoPixmapStorage::AllocSize(ii, nullptr);
// createBackendTexture will fill the texture with 0's if no data is provided, so
@@ -69,23 +65,24 @@
sk_sp<GrTextureProxy> wrappedProxy;
if (GrRenderable::kYes == renderable) {
- wrappedProxy = direct->priv().proxyProvider()->wrapRenderableBackendTexture(
+ wrappedProxy = dContext->priv().proxyProvider()->wrapRenderableBackendTexture(
backendTex, 1, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo, nullptr);
} else {
- wrappedProxy = direct->priv().proxyProvider()->wrapBackendTexture(
+ wrappedProxy = dContext->priv().proxyProvider()->wrapBackendTexture(
backendTex, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo, GrIOType::kRW_GrIOType);
}
REPORTER_ASSERT(reporter, wrappedProxy);
- GrSwizzle swizzle = direct->priv().caps()->getReadSwizzle(wrappedProxy->backendFormat(), grCT);
+ GrSwizzle swizzle = dContext->priv().caps()->getReadSwizzle(wrappedProxy->backendFormat(),
+ grCT);
GrSurfaceProxyView view(std::move(wrappedProxy), kTopLeft_GrSurfaceOrigin, swizzle);
- auto surfaceContext = GrSurfaceContext::Make(direct, std::move(view), grCT,
+ auto surfaceContext = GrSurfaceContext::Make(dContext, std::move(view), grCT,
kPremul_SkAlphaType, nullptr);
REPORTER_ASSERT(reporter, surfaceContext);
bool result = surfaceContext->readPixels({grCT, kPremul_SkAlphaType, nullptr, kWidth, kHeight},
actualPixels.writable_addr(), actualPixels.rowBytes(),
- {0, 0}, direct);
+ {0, 0}, dContext);
REPORTER_ASSERT(reporter, result);
REPORTER_ASSERT(reporter,