From a694870ef50c05ce91538d1b4109f373c816b76b Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Fri, 1 Jun 2018 15:33:20 -0400 Subject: Remove origin from GrGpu::readPixels Change-Id: I40d046c66240ab40794aa008861a1974f7f9182c Reviewed-on: https://skia-review.googlesource.com/131620 Commit-Queue: Brian Salomon Reviewed-by: Brian Osman --- tests/TransferPixelsTest.cpp | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'tests/TransferPixelsTest.cpp') diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp index 5bb309494e..339a591660 100755 --- a/tests/TransferPixelsTest.cpp +++ b/tests/TransferPixelsTest.cpp @@ -41,12 +41,9 @@ bool does_full_buffer_contain_correct_values(GrColor* srcBuffer, int width, int height, int bufferWidth, - int bufferHeight, - GrSurfaceOrigin origin) { + int bufferHeight) { GrColor* srcPtr = srcBuffer; - bool bottomUp = SkToBool(kBottomLeft_GrSurfaceOrigin == origin); - GrColor* dstPtr = bottomUp ? dstBuffer + bufferWidth*(bufferHeight-1) : dstBuffer; - int dstIncrement = bottomUp ? -bufferWidth : +bufferWidth; + GrColor* dstPtr = dstBuffer; for (int j = 0; j < height; ++j) { for (int i = 0; i < width; ++i) { @@ -55,13 +52,13 @@ bool does_full_buffer_contain_correct_values(GrColor* srcBuffer, } } srcPtr += bufferWidth; - dstPtr += dstIncrement; + dstPtr += bufferWidth; } return true; } void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrColorType colorType, - GrSurfaceOrigin origin, bool renderTarget) { + bool renderTarget) { if (GrCaps::kNone_MapFlags == context->contextPriv().caps()->mapBufferFlags()) { return; } @@ -125,7 +122,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrCol REPORTER_ASSERT(reporter, result); memset(dstBuffer.get(), 0xCDCD, size); - result = gpu->readPixels(tex.get(), origin, 0, 0, kTextureWidth, kTextureHeight, colorType, + result = gpu->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight, colorType, dstBuffer.get(), rowBytes); if (result) { REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer, @@ -133,8 +130,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrCol kTextureWidth, kTextureHeight, kBufferWidth, - kBufferHeight, - origin)); + kBufferHeight)); } ////////////////////////// @@ -157,7 +153,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrCol REPORTER_ASSERT(reporter, result); memset(dstBuffer.get(), 0xCDCD, size); - result = gpu->readPixels(tex.get(), origin, 0, 0, kTextureWidth, kTextureHeight, colorType, + result = gpu->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight, colorType, dstBuffer.get(), rowBytes); if (result) { REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer, @@ -165,30 +161,17 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrCol kTextureWidth, kTextureHeight, kBufferWidth, - kBufferHeight, - origin)); + kBufferHeight)); } } } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TransferPixelsTest, reporter, ctxInfo) { // RGBA - basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888, - kTopLeft_GrSurfaceOrigin, false); - basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888, - kTopLeft_GrSurfaceOrigin, true); - basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888, - kBottomLeft_GrSurfaceOrigin, false); - basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888, - kBottomLeft_GrSurfaceOrigin, true); + basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888, false); + basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kRGBA_8888, true); // BGRA - basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kBGRA_8888, - kTopLeft_GrSurfaceOrigin, false); - basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kBGRA_8888, - kTopLeft_GrSurfaceOrigin, true); - basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kBGRA_8888, - kBottomLeft_GrSurfaceOrigin, false); - basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kBGRA_8888, - kBottomLeft_GrSurfaceOrigin, true); + basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kBGRA_8888, false); + basic_transfer_test(reporter, ctxInfo.grContext(), GrColorType::kBGRA_8888, true); } -- cgit v1.2.3