aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ReadWriteAlphaTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ReadWriteAlphaTest.cpp')
-rw-r--r--tests/ReadWriteAlphaTest.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 2a68191a2d..531159ff6f 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -142,13 +142,17 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
}
}
+ const SkImageInfo dstInfo = SkImageInfo::Make(X_SIZE, Y_SIZE,
+ kAlpha_8_SkColorType,
+ kPremul_SkAlphaType);
+
// Attempt to read back just alpha from a RGBA/BGRA texture. Once with a texture-only src and
// once with a render target.
- for (auto cfg : kRGBAConfigs) {
+ for (auto config : kRGBAConfigs) {
for (int rt = 0; rt < 2; ++rt) {
GrSurfaceDesc desc;
desc.fFlags = rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
- desc.fConfig = cfg;
+ desc.fConfig = config;
desc.fWidth = X_SIZE;
desc.fHeight = Y_SIZE;
@@ -170,6 +174,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
continue;
}
+ sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(
+ std::move(proxy), nullptr);
+
for (auto rowBytes : kRowBytes) {
size_t nonZeroRowBytes = rowBytes ? rowBytes : X_SIZE;
@@ -178,11 +185,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
memset(readback.get(), kClearValue, nonZeroRowBytes * Y_SIZE);
// read the texture back
- bool result = context->contextPriv().readSurfacePixels(
- proxy.get(), nullptr,
- 0, 0, desc.fWidth, desc.fHeight,
- kAlpha_8_GrPixelConfig, nullptr,
- readback.get(), rowBytes);
+ bool result = sContext->readPixels(dstInfo, readback.get(), rowBytes, 0, 0);
REPORTER_ASSERT_MESSAGE(reporter, result, "8888 readPixels failed");
// make sure the original & read back versions match