aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ReadWriteAlphaTest.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-04-14 12:51:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-14 17:39:12 +0000
commit74d5a1470378dc7dae9eec38d46f9f802fc5c249 (patch)
tree97fb91742dceea5eb8644f018a5968bea362c591 /tests/ReadWriteAlphaTest.cpp
parent307efd4e8131836594681a7d975ba87dee2d8e93 (diff)
Reduce read/write-SurfacePixels call sites
Change-Id: I657c489c56b93765567be69076fb4c3d526e55a5 Reviewed-on: https://skia-review.googlesource.com/13068 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
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