Avoid using GrGpu::readPixels in GrTestingBackendTextureUploadTest.
Change-Id: Ic7ba918177f6f5cc35da713cf063c467bd7a7908
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220999
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index bb0f229..cc42269 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -117,14 +117,14 @@
*/
sk_sp<GrTextureProxy> wrapRenderableBackendTexture(const GrBackendTexture&, GrSurfaceOrigin,
int sampleCnt, GrWrapOwnership,
- GrWrapCacheable, ReleaseProc,
- ReleaseContext);
+ GrWrapCacheable, ReleaseProc = nullptr,
+ ReleaseContext = nullptr);
/*
* Create a render target proxy that wraps a backend render target
*/
sk_sp<GrSurfaceProxy> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrSurfaceOrigin,
- ReleaseProc, ReleaseContext);
+ ReleaseProc = nullptr, ReleaseContext = nullptr);
/*
* Create a render target proxy that wraps a backend texture
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
index a8f03b2..5036207 100644
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ b/tests/GrTestingBackendTextureUploadTest.cpp
@@ -5,13 +5,10 @@
* found in the LICENSE file.
*/
-#include "include/core/SkTypes.h"
-
-#include "include/gpu/GrTexture.h"
-#include "src/core/SkConvertPixels.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
+#include "src/gpu/GrSurfaceContext.h"
#include "src/gpu/SkGr.h"
#include "tests/Test.h"
#include "tests/TestUtils.h"
@@ -29,7 +26,6 @@
actualPixels.alloc(ii);
const GrCaps* caps = context->priv().caps();
- GrGpu* gpu = context->priv().getGpu();
GrPixelConfig config = SkColorType2GrPixelConfig(ct);
if (!caps->isConfigTexturable(config)) {
@@ -66,20 +62,23 @@
return;
}
- sk_sp<GrTexture> wrappedTex;
+ sk_sp<GrTextureProxy> wrappedProxy;
if (GrRenderable::kYes == renderable) {
- wrappedTex = gpu->wrapRenderableBackendTexture(
- backendTex, 1, GrWrapOwnership::kAdopt_GrWrapOwnership, GrWrapCacheable::kNo);
+ wrappedProxy = context->priv().proxyProvider()->wrapRenderableBackendTexture(
+ backendTex, kTopLeft_GrSurfaceOrigin, 1, kAdopt_GrWrapOwnership,
+ GrWrapCacheable::kNo);
} else {
- wrappedTex = gpu->wrapBackendTexture(backendTex, GrWrapOwnership::kAdopt_GrWrapOwnership,
- GrWrapCacheable::kNo, kRead_GrIOType);
+ wrappedProxy = context->priv().proxyProvider()->wrapBackendTexture(
+ backendTex, kTopLeft_GrSurfaceOrigin, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo,
+ GrIOType::kRW_GrIOType);
}
- REPORTER_ASSERT(reporter, wrappedTex);
+ REPORTER_ASSERT(reporter, wrappedProxy);
- bool result = gpu->readPixels(wrappedTex.get(), 0, 0, kWidth,
- kHeight, grCT,
- actualPixels.writable_addr32(0, 0),
- actualPixels.rowBytes());
+ auto surfaceContext = context->priv().makeWrappedSurfaceContext(std::move(wrappedProxy));
+ REPORTER_ASSERT(reporter, surfaceContext);
+
+ bool result = surfaceContext->readPixels(context, 0, 0, kWidth, kHeight, grCT, nullptr,
+ actualPixels.writable_addr(), actualPixels.rowBytes());
REPORTER_ASSERT(reporter, result);
REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(expectedPixels.addr32(),