blob: 6dc9541d77564d5f8779799374ea952307035f24 [file] [log] [blame]
Brian Salomon5ec9def2016-12-20 15:34:05 -05001/*
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 Canary6f6961e2017-01-31 13:50:44 -050014#if GR_TEST_UTILS
Brian Salomon5ec9def2016-12-20 15:34:05 -050015
Brian Salomon17726632017-05-12 14:09:46 -040016class GrDrawOp;
Brian Salomon17726632017-05-12 14:09:46 -040017class GrPaint;
18class GrRenderTargetContext;
19struct GrUserStencilSettings;
Brian Salomon5ec9def2016-12-20 15:34:05 -050020class SkRandom;
21
Brian Salomon17726632017-05-12 14:09:46 -040022/** This function draws a randomly configured GrDrawOp for testing purposes. */
23void GrDrawRandomOp(SkRandom*, GrRenderTargetContext*, GrPaint&&);
Brian Salomon5ec9def2016-12-20 15:34:05 -050024
25/** GrDrawOp subclasses should define test factory functions using this macro. */
Brian Salomon17726632017-05-12 14:09:46 -040026#define GR_DRAW_OP_TEST_DEFINE(Op) \
27 std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, GrContext* context, \
28 GrFSAAType fsaaType)
Brian Salomon44acb5b2017-07-18 19:59:24 -040029#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 Salomon5ec9def2016-12-20 15:34:05 -050032
Brian Salomon17726632017-05-12 14:09:46 -040033/** Helper for op test factories to pick a random stencil state. */
34const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext*);
35
Brian Salomon5ec9def2016-12-20 15:34:05 -050036#endif
37#endif