| 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 "include/core/SkRefCnt.h" |
| 12 | #include "src/gpu/GrTestUtils.h" |
| 13 | |
| 14 | #if GR_TEST_UTILS |
| 15 | |
| 16 | class GrContext_Base; |
| 17 | class GrDrawOp; |
| 18 | class GrPaint; |
| 19 | class GrRecordingContext; |
| 20 | class GrRenderTargetContext; |
| 21 | struct GrUserStencilSettings; |
| 22 | class SkRandom; |
| 23 | |
| 24 | /** This function draws a randomly configured GrDrawOp for testing purposes. */ |
| 25 | void GrDrawRandomOp(SkRandom*, GrRenderTargetContext*, GrPaint&&); |
| 26 | |
| 27 | /** GrDrawOp subclasses should define test factory functions using this macro. */ |
| 28 | #define GR_DRAW_OP_TEST_DEFINE(Op) \ |
| 29 | std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, \ |
| 30 | GrRecordingContext* context, int numSamples) |
| 31 | #define GR_DRAW_OP_TEST_FRIEND(Op) \ |
| 32 | friend std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, \ |
| 33 | GrRecordingContext* context, int numSamples) |
| 34 | |
| 35 | /** Helper for op test factories to pick a random stencil state. */ |
| 36 | const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext_Base*); |
| 37 | |
| 38 | #endif |
| 39 | #endif |
| 40 | |