Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | #ifndef GrDrawOpTest_DEFINED |
| 9 | #define GrDrawOpTest_DEFINED |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkRefCnt.h" |
| 12 | #include "src/gpu/GrTestUtils.h" |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 13 | |
Hal Canary | 6f6961e | 2017-01-31 13:50:44 -0500 | [diff] [blame] | 14 | #if GR_TEST_UTILS |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 15 | |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 16 | class GrContext_Base; |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 17 | class GrDrawOp; |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 18 | class GrPaint; |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 19 | class GrRecordingContext; |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 20 | class GrRenderTargetContext; |
| 21 | struct GrUserStencilSettings; |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 22 | class SkRandom; |
| 23 | |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 24 | /** This function draws a randomly configured GrDrawOp for testing purposes. */ |
| 25 | void GrDrawRandomOp(SkRandom*, GrRenderTargetContext*, GrPaint&&); |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 26 | |
| 27 | /** GrDrawOp subclasses should define test factory functions using this macro. */ |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 28 | #define GR_DRAW_OP_TEST_DEFINE(Op) \ |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 29 | std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, \ |
| 30 | GrRecordingContext* context, GrFSAAType fsaaType) |
| 31 | #define GR_DRAW_OP_TEST_FRIEND(Op) \ |
| 32 | friend std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, \ |
| 33 | GrRecordingContext* context, GrFSAAType fsaaType) |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 34 | |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 35 | /** Helper for op test factories to pick a random stencil state. */ |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 36 | const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext_Base*); |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 37 | |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 38 | #endif |
| 39 | #endif |