Robert Phillips | 3500b77 | 2017-01-27 10:11:42 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "Test.h" |
| 9 | |
Robert Phillips | 3500b77 | 2017-01-27 10:11:42 -0500 | [diff] [blame] | 10 | class GrSurfaceContext; |
| 11 | class GrSurfaceProxy; |
Timothy Liang | 760dbc4 | 2018-07-17 13:28:20 -0400 | [diff] [blame] | 12 | typedef uint32_t GrColor; |
Robert Phillips | 3500b77 | 2017-01-27 10:11:42 -0500 | [diff] [blame] | 13 | |
| 14 | // Ensure that reading back from 'srcContext' as RGBA 8888 matches 'expectedPixelValues |
Robert Phillips | 26c90e0 | 2017-03-14 14:39:29 -0400 | [diff] [blame] | 15 | void test_read_pixels(skiatest::Reporter*, |
Robert Phillips | 3500b77 | 2017-01-27 10:11:42 -0500 | [diff] [blame] | 16 | GrSurfaceContext* srcContext, uint32_t expectedPixelValues[], |
| 17 | const char* testName); |
| 18 | |
| 19 | // See if trying to write RGBA 8888 pixels to 'dstContext' matches matches the |
| 20 | // expectation ('expectedToWork') |
Robert Phillips | 26c90e0 | 2017-03-14 14:39:29 -0400 | [diff] [blame] | 21 | void test_write_pixels(skiatest::Reporter*, |
Robert Phillips | 3500b77 | 2017-01-27 10:11:42 -0500 | [diff] [blame] | 22 | GrSurfaceContext* srcContext, bool expectedToWork, const char* testName); |
| 23 | |
| 24 | // Ensure that the pixels can be copied from 'proxy' to an RGBA 8888 destination (both |
| 25 | // texture-backed and rendertarget-backed). |
Robert Phillips | 26c90e0 | 2017-03-14 14:39:29 -0400 | [diff] [blame] | 26 | void test_copy_from_surface(skiatest::Reporter*, GrContext*, |
Robert Phillips | 3500b77 | 2017-01-27 10:11:42 -0500 | [diff] [blame] | 27 | GrSurfaceProxy* proxy, uint32_t expectedPixelValues[], |
| 28 | bool onlyTestRTConfig, const char* testName); |
| 29 | |
| 30 | // Ensure that RGBA 8888 pixels can be copied into 'dstContext' |
Robert Phillips | 1afd4cd | 2018-01-08 13:40:32 -0500 | [diff] [blame] | 31 | void test_copy_to_surface(skiatest::Reporter*, GrProxyProvider*, |
Robert Phillips | 3500b77 | 2017-01-27 10:11:42 -0500 | [diff] [blame] | 32 | GrSurfaceContext* dstContext, const char* testName); |
Timothy Liang | 760dbc4 | 2018-07-17 13:28:20 -0400 | [diff] [blame] | 33 | |
| 34 | // Fills data with a red-green gradient |
| 35 | void fill_pixel_data(int width, int height, GrColor* data); |
| 36 | |
| 37 | // Checks srcBuffer and dstBuffer contain the same colors |
| 38 | bool does_full_buffer_contain_correct_color(GrColor* srcBuffer, GrColor* dstBuffer, int width, |
| 39 | int height); |