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 
14 #if GR_TEST_UTILS
15 
16 class GrDrawOp;
17 class GrPaint;
18 class GrRenderTargetContext;
19 struct GrUserStencilSettings;
20 class SkRandom;
21 
22 /**  This function draws a randomly configured GrDrawOp for testing purposes. */
23 void GrDrawRandomOp(SkRandom*, GrRenderTargetContext*, GrPaint&&);
24 
25 /** GrDrawOp subclasses should define test factory functions using this macro. */
26 #define GR_DRAW_OP_TEST_DEFINE(Op)                                                              \
27     std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, GrContext* context, \
28                                          GrFSAAType fsaaType)
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)
32 
33 /** Helper for op test factories to pick a random stencil state. */
34 const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext*);
35 
36 #endif
37 #endif
38