diff options
author | Robert Phillips <robertphillips@google.com> | 2017-01-25 12:10:37 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-25 17:53:10 +0000 |
commit | d46697ac36d5cb3b58571c6129cb5b26fe9d25d7 (patch) | |
tree | 5f7efe30049183c3248ce2cb8fe651e62f5c9392 /tests/CopySurfaceTest.cpp | |
parent | 74b16edd98e4fd560baaf5655dd7e4ae43f8ae69 (diff) |
Use GrSurfaceContext::read/write-Pixels more
Change-Id: I04bcaf91aa7a43e0563e332c1fe2836d762a04d4
Reviewed-on: https://skia-review.googlesource.com/7520
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/CopySurfaceTest.cpp')
-rw-r--r-- | tests/CopySurfaceTest.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp index efb6b2d43d..19037d9200 100644 --- a/tests/CopySurfaceTest.cpp +++ b/tests/CopySurfaceTest.cpp @@ -56,6 +56,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { {-1 , -1 }, }; + const SkImageInfo ii = SkImageInfo::Make(kW, kH, kRGBA_8888_SkColorType, kPremul_SkAlphaType); + SkAutoTMalloc<uint32_t> read(kW * kH); for (auto sOrigin : {kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin}) { @@ -90,10 +92,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { continue; } - sk_sp<GrSurfaceContext> sContext = - context->contextPriv().makeWrappedSurfaceContext(dst, nullptr); + sk_sp<GrSurfaceContext> dstContext = + context->contextPriv().makeWrappedSurfaceContext(std::move(dst), + nullptr); - bool result = sContext->copy(src.get(), srcRect, dstPoint); + bool result = dstContext->copy(src.get(), srcRect, dstPoint); bool expectedResult = true; SkIPoint dstOffset = { dstPoint.fX - srcRect.fLeft, @@ -130,11 +133,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { continue; } - GrSurface* dstSurf = dst->instantiate(context->textureProvider()); - sk_memset32(read.get(), 0, kW * kH); - if (!dstSurf->readPixels(0, 0, kW, kH, baseDesc.fConfig, read.get(), - kRowBytes)) { + if (!dstContext->readPixels(ii, read.get(), kRowBytes, 0, 0)) { ERRORF(reporter, "Error calling readPixels"); continue; } |