From 0bd4a23ef40d74ef051eb7f457c133d5febc377d Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Fri, 27 Jan 2017 07:51:23 -0500 Subject: Consolidate read/write-Pixels testing code Change-Id: I853f8f747ed0040333473fbc722cabac84e6ac83 Reviewed-on: https://skia-review.googlesource.com/7560 Commit-Queue: Robert Phillips Reviewed-by: Brian Osman --- tests/TestUtils.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/TestUtils.h (limited to 'tests/TestUtils.h') diff --git a/tests/TestUtils.h b/tests/TestUtils.h new file mode 100644 index 0000000000..7c3370ed7e --- /dev/null +++ b/tests/TestUtils.h @@ -0,0 +1,34 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "Test.h" + +#if SK_SUPPORT_GPU + +class GrSurfaceContext; +class GrSurfaceProxy; + +// Ensure that reading back from 'srcContext' as RGBA 8888 matches 'expectedPixelValues +void test_read_pixels(skiatest::Reporter* reporter, GrContext* context, + GrSurfaceContext* srcContext, uint32_t expectedPixelValues[], + const char* testName); + +// See if trying to write RGBA 8888 pixels to 'dstContext' matches matches the +// expectation ('expectedToWork') +void test_write_pixels(skiatest::Reporter* reporter, GrContext* context, + GrSurfaceContext* srcContext, bool expectedToWork, const char* testName); + +// Ensure that the pixels can be copied from 'proxy' to an RGBA 8888 destination (both +// texture-backed and rendertarget-backed). +void test_copy_from_surface(skiatest::Reporter* reporter, GrContext* context, + GrSurfaceProxy* proxy, uint32_t expectedPixelValues[], + bool onlyTestRTConfig, const char* testName); + +// Ensure that RGBA 8888 pixels can be copied into 'dstContext' +void test_copy_to_surface(skiatest::Reporter* reporter, GrContext* context, + GrSurfaceContext* dstContext, const char* testName); +#endif -- cgit v1.2.3