• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/ganesh/GrTestUtils.h"
13 
14 #if defined(GR_TEST_UTILS)
15 
16 class GrContext_Base;
17 class GrDrawOp;
18 class GrPaint;
19 class GrRecordingContext;
20 namespace skgpu {
21 namespace ganesh {
22 class SurfaceDrawContext;
23 }
24 }  // namespace skgpu
25 struct GrUserStencilSettings;
26 class SkRandom;
27 
28 /**  This function draws a randomly configured GrDrawOp for testing purposes. */
29 void GrDrawRandomOp(SkRandom*, skgpu::ganesh::SurfaceDrawContext*, GrPaint&&);
30 
31 /** GrDrawOp subclasses should define test factory functions using this macro. */
32 #define GR_DRAW_OP_TEST_DEFINE(Op)                                 \
33     GrOp::Owner Op##__Test(GrPaint&& paint,                        \
34                            SkRandom* random,                       \
35                            GrRecordingContext* context,            \
36                            skgpu::ganesh::SurfaceDrawContext* sdc, \
37                            int numSamples)
38 #define GR_DRAW_OP_TEST_FRIEND(Op)   \
39     friend GrOp::OpOwner Op##__Test( \
40             GrPaint&&, SkRandom*, GrRecordingContext*, skgpu::ganesh::SurfaceDrawContext*, int)
41 
42 /** Helper for op test factories to pick a random stencil state. */
43 const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext_Base*);
44 
45 #endif
46 #endif
47