Brian Salomon | e21af50 | 2019-11-22 16:56:36 -0500 | [diff] [blame] | 1 | /* |
| 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 Phillips | b7bfbc2 | 2020-07-01 12:55:01 -0400 | [diff] [blame] | 12 | #include "include/gpu/GrRecordingContext.h" |
Brian Salomon | e21af50 | 2019-11-22 16:56:36 -0500 | [diff] [blame] | 13 | #include "src/gpu/GrRecordingContextPriv.h" |
| 14 | #include "src/gpu/ops/GrMeshDrawOp.h" |
| 15 | |
| 16 | class GrPaint; |
| 17 | |
| 18 | namespace 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 Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 26 | GrOp::Owner MakeRect(GrRecordingContext*, |
| 27 | GrPaint&&, |
| 28 | const SkRect& drawRect, |
| 29 | const SkRect& localRect, |
| 30 | const SkMatrix& localM = SkMatrix::I()); |
Brian Salomon | e21af50 | 2019-11-22 16:56:36 -0500 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * A simpler version of MakeRect that takes a single color FP instead of a full paint. Uses |
| 34 | * SkBlendMode::kSrcOver. |
| 35 | */ |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 36 | GrOp::Owner MakeRect(GrRecordingContext*, |
| 37 | std::unique_ptr<GrFragmentProcessor>, |
| 38 | const SkRect& drawRect, |
| 39 | const SkRect& localRect, |
| 40 | const SkMatrix& localM = SkMatrix::I()); |
Brian Salomon | e21af50 | 2019-11-22 16:56:36 -0500 | [diff] [blame] | 41 | |
| 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 Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 46 | GrOp::Owner MakeRect(GrRecordingContext*, GrPaint&&, const SkRect& rect); |
Brian Salomon | e21af50 | 2019-11-22 16:56:36 -0500 | [diff] [blame] | 47 | |
| 48 | } // namespace sk_gpu_test::test_ops |
| 49 | |
| 50 | #endif |