blob: 7f7af01b4e9550c403b6a71980f79ea880859aac [file] [log] [blame]
Brian Salomone21af502019-11-22 16:56:36 -05001/*
2 * Copyright 2019 Google LLC
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 TestRectOp_DEFINED
9#define TestRectOp_DEFINED
10
11#include "include/core/SkRefCnt.h"
Robert Phillipsb7bfbc22020-07-01 12:55:01 -040012#include "include/gpu/GrRecordingContext.h"
Brian Salomone21af502019-11-22 16:56:36 -050013#include "src/gpu/GrRecordingContextPriv.h"
14#include "src/gpu/ops/GrMeshDrawOp.h"
15
16class GrPaint;
17
18namespace sk_gpu_test::test_ops {
19
20/**
21 * Fully specified device space rect op. The test Op draws a rectangle with local coords and a
22 * local matrix. It is important to test effects in the presence of GP local matrices. Our standard
23 * rect drawing code doesn't exercise this because it applies any local matrix to pre-transformed
24 * local coord vertex attributes.
25 */
Herb Derbyc76d4092020-10-07 16:46:15 -040026GrOp::Owner MakeRect(GrRecordingContext*,
27 GrPaint&&,
28 const SkRect& drawRect,
29 const SkRect& localRect,
30 const SkMatrix& localM = SkMatrix::I());
Brian Salomone21af502019-11-22 16:56:36 -050031
32/**
33 * A simpler version of MakeRect that takes a single color FP instead of a full paint. Uses
34 * SkBlendMode::kSrcOver.
35 */
Herb Derbyc76d4092020-10-07 16:46:15 -040036GrOp::Owner MakeRect(GrRecordingContext*,
37 std::unique_ptr<GrFragmentProcessor>,
38 const SkRect& drawRect,
39 const SkRect& localRect,
40 const SkMatrix& localM = SkMatrix::I());
Brian Salomone21af502019-11-22 16:56:36 -050041
42/**
43 * A simpler version of MakeRect that uses the same rect as the device space rect to draw as well as
44 * the local rect. The local matrix is identity.
45 */
Herb Derbyc76d4092020-10-07 16:46:15 -040046GrOp::Owner MakeRect(GrRecordingContext*, GrPaint&&, const SkRect& rect);
Brian Salomone21af502019-11-22 16:56:36 -050047
48} // namespace sk_gpu_test::test_ops
49
50#endif