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 | |
| 11 | #include "GrTestUtils.h" |
| 12 | #include "SkRefCnt.h" |
| 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 | |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 16 | class GrDrawOp; |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 17 | class GrPaint; |
| 18 | class GrRenderTargetContext; |
| 19 | struct GrUserStencilSettings; |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 20 | class SkRandom; |
| 21 | |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 22 | /** This function draws a randomly configured GrDrawOp for testing purposes. */ |
| 23 | void GrDrawRandomOp(SkRandom*, GrRenderTargetContext*, GrPaint&&); |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 24 | |
| 25 | /** GrDrawOp subclasses should define test factory functions using this macro. */ |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 26 | #define GR_DRAW_OP_TEST_DEFINE(Op) \ |
| 27 | std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, GrContext* context, \ |
| 28 | GrFSAAType fsaaType) |
Brian Salomon | 44acb5b | 2017-07-18 19:59:24 -0400 | [diff] [blame] | 29 | #define GR_DRAW_OP_TEST_FRIEND(Op) \ |
| 30 | friend std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, \ |
| 31 | GrContext* context, GrFSAAType fsaaType) |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 32 | |
Brian Salomon | 1772663 | 2017-05-12 14:09:46 -0400 | [diff] [blame] | 33 | /** Helper for op test factories to pick a random stencil state. */ |
| 34 | const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext*); |
| 35 | |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 36 | #endif |
| 37 | #endif |