2017-01-27 15:11:42 +00:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
|
|
|
class GrSurfaceContext;
|
|
|
|
class GrSurfaceProxy;
|
2018-07-17 17:28:20 +00:00
|
|
|
typedef uint32_t GrColor;
|
2017-01-27 15:11:42 +00:00
|
|
|
|
|
|
|
// Ensure that reading back from 'srcContext' as RGBA 8888 matches 'expectedPixelValues
|
2017-03-14 18:39:29 +00:00
|
|
|
void test_read_pixels(skiatest::Reporter*,
|
2017-01-27 15:11:42 +00:00
|
|
|
GrSurfaceContext* srcContext, uint32_t expectedPixelValues[],
|
|
|
|
const char* testName);
|
|
|
|
|
|
|
|
// See if trying to write RGBA 8888 pixels to 'dstContext' matches matches the
|
|
|
|
// expectation ('expectedToWork')
|
2017-03-14 18:39:29 +00:00
|
|
|
void test_write_pixels(skiatest::Reporter*,
|
2017-01-27 15:11:42 +00:00
|
|
|
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).
|
2017-03-14 18:39:29 +00:00
|
|
|
void test_copy_from_surface(skiatest::Reporter*, GrContext*,
|
2017-01-27 15:11:42 +00:00
|
|
|
GrSurfaceProxy* proxy, uint32_t expectedPixelValues[],
|
|
|
|
bool onlyTestRTConfig, const char* testName);
|
|
|
|
|
|
|
|
// Ensure that RGBA 8888 pixels can be copied into 'dstContext'
|
2018-01-08 18:40:32 +00:00
|
|
|
void test_copy_to_surface(skiatest::Reporter*, GrProxyProvider*,
|
2017-01-27 15:11:42 +00:00
|
|
|
GrSurfaceContext* dstContext, const char* testName);
|
2018-07-17 17:28:20 +00:00
|
|
|
|
|
|
|
// Fills data with a red-green gradient
|
|
|
|
void fill_pixel_data(int width, int height, GrColor* data);
|
|
|
|
|
|
|
|
// Checks srcBuffer and dstBuffer contain the same colors
|
|
|
|
bool does_full_buffer_contain_correct_color(GrColor* srcBuffer, GrColor* dstBuffer, int width,
|
|
|
|
int height);
|