aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/TransferPixelsTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-06-01 15:33:20 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-02 01:42:46 +0000
commita694870ef50c05ce91538d1b4109f373c816b76b (patch)
treedc7c0aa06c82ae796dec5404e1d37f937d67eaf4 /tests/TransferPixelsTest.cpp
parenta9b04b90669e08c1ee4aa826a83c416b24704248 (diff)
Remove origin from GrGpu::readPixels
Change-Id: I40d046c66240ab40794aa008861a1974f7f9182c Reviewed-on: https://skia-review.googlesource.com/131620 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests/TransferPixelsTest.cpp')
-rwxr-xr-xtests/TransferPixelsTest.cpp41
1 files changed, 12 insertions, 29 deletions
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);
}