diff options
Diffstat (limited to 'tests/VkUploadPixelsTests.cpp')
-rw-r--r-- | tests/VkUploadPixelsTests.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index b13de41571..bd87d19cd1 100644 --- a/tests/VkUploadPixelsTests.cpp +++ b/tests/VkUploadPixelsTests.cpp @@ -18,11 +18,40 @@ #include "ProxyUtils.h" #include "SkGr.h" #include "Test.h" -#include "TestUtils.h" #include "vk/GrVkGpu.h" using sk_gpu_test::GrContextFactory; +void fill_pixel_data(int width, int height, GrColor* data) { + + // build red-green gradient + for (int j = 0; j < height; ++j) { + for (int i = 0; i < width; ++i) { + unsigned int red = (unsigned int)(256.f*(i / (float)width)); + unsigned int green = (unsigned int)(256.f*(j / (float)height)); + data[i + j*width] = GrColorPackRGBA(red - (red>>8), green - (green>>8), 0xff, 0xff); + } + } +} + +bool does_full_buffer_contain_correct_color(GrColor* srcBuffer, + GrColor* dstBuffer, + int width, + int height) { + GrColor* srcPtr = srcBuffer; + GrColor* dstPtr = dstBuffer; + for (int j = 0; j < height; ++j) { + for (int i = 0; i < width; ++i) { + if (srcPtr[i] != dstPtr[i]) { + return false; + } + } + srcPtr += width; + dstPtr += width; + } + return true; +} + void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, SkColorType ct, bool renderTarget) { const int kWidth = 16; |