From 760dbc4b53499f891a9e2057524956f8381535e3 Mon Sep 17 00:00:00 2001 From: Timothy Liang Date: Tue, 17 Jul 2018 13:28:20 -0400 Subject: Reland "implemented metal gpu backend texture upload testing" This reverts commit a80a012456a95a6996a8901268ec34ed0cc3aecb. Reason for revert: Fix bot failure. Original change's description: > Revert "implemented metal gpu backend texture upload testing" > > This reverts commit 36848f6b30ddaca461c98e13b9976b2c449ca547. > > Reason for revert: Test-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android_CCPR failing. > > Original change's description: > > implemented metal gpu backend texture upload testing > > > > Bug: skia: > > Change-Id: Ia3af58a0710f7f9792b37682a3cc45dd14282b71 > > Reviewed-on: https://skia-review.googlesource.com/140248 > > Commit-Queue: Timothy Liang > > Reviewed-by: Greg Daniel > > TBR=egdaniel@google.com,ethannicholas@google.com,timliang@google.com > > Change-Id: Idf40fc78b82aec1efbcc64221b6d2bbf63353960 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/141182 > Reviewed-by: Timothy Liang > Commit-Queue: Timothy Liang Bug: skia: Change-Id: Ib8c5b2e0cf9de25c11c14741a32846bcc874d712 Reviewed-on: https://skia-review.googlesource.com/141183 Reviewed-by: Greg Daniel Commit-Queue: Timothy Liang --- tests/TestUtils.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/TestUtils.cpp') diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp index 44a78c51fb..8b611c2064 100644 --- a/tests/TestUtils.cpp +++ b/tests/TestUtils.cpp @@ -113,3 +113,32 @@ void test_copy_to_surface(skiatest::Reporter* reporter, GrProxyProvider* proxyPr } } } + +void fill_pixel_data(int width, int height, GrColor* data) { + 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; +} -- cgit v1.2.3