blob: e89193195bd1df610bb25eeca48da3540c7792d4 [file] [log] [blame]
Robert Phillips3500b772017-01-27 10:11:42 -05001/*
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 Phillips3500b772017-01-27 10:11:42 -050010class GrSurfaceContext;
11class GrSurfaceProxy;
Timothy Liang760dbc42018-07-17 13:28:20 -040012typedef uint32_t GrColor;
Robert Phillips3500b772017-01-27 10:11:42 -050013
14// Ensure that reading back from 'srcContext' as RGBA 8888 matches 'expectedPixelValues
Robert Phillips26c90e02017-03-14 14:39:29 -040015void test_read_pixels(skiatest::Reporter*,
Robert Phillips3500b772017-01-27 10:11:42 -050016 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 Phillips26c90e02017-03-14 14:39:29 -040021void test_write_pixels(skiatest::Reporter*,
Robert Phillips3500b772017-01-27 10:11:42 -050022 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 Phillips26c90e02017-03-14 14:39:29 -040026void test_copy_from_surface(skiatest::Reporter*, GrContext*,
Robert Phillips3500b772017-01-27 10:11:42 -050027 GrSurfaceProxy* proxy, uint32_t expectedPixelValues[],
28 bool onlyTestRTConfig, const char* testName);
29
30// Ensure that RGBA 8888 pixels can be copied into 'dstContext'
Robert Phillips1afd4cd2018-01-08 13:40:32 -050031void test_copy_to_surface(skiatest::Reporter*, GrProxyProvider*,
Robert Phillips3500b772017-01-27 10:11:42 -050032 GrSurfaceContext* dstContext, const char* testName);
Timothy Liang760dbc42018-07-17 13:28:20 -040033
34// Fills data with a red-green gradient
35void fill_pixel_data(int width, int height, GrColor* data);
36
37// Checks srcBuffer and dstBuffer contain the same colors
38bool does_full_buffer_contain_correct_color(GrColor* srcBuffer, GrColor* dstBuffer, int width,
39 int height);