From d46697ac36d5cb3b58571c6129cb5b26fe9d25d7 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Wed, 25 Jan 2017 12:10:37 -0500 Subject: Use GrSurfaceContext::read/write-Pixels more Change-Id: I04bcaf91aa7a43e0563e332c1fe2836d762a04d4 Reviewed-on: https://skia-review.googlesource.com/7520 Reviewed-by: Brian Osman Reviewed-by: Robert Phillips Commit-Queue: Robert Phillips --- tests/CopySurfaceTest.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/CopySurfaceTest.cpp') 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 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 sContext = - context->contextPriv().makeWrappedSurfaceContext(dst, nullptr); + sk_sp 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; } -- cgit v1.2.3