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" 12 #include "include/gpu/GrRecordingContext.h" 13 #include "src/gpu/GrRecordingContextPriv.h" 14 #include "src/gpu/ops/GrOp.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 */ 26 GrOp::Owner MakeRect(GrRecordingContext*, 27 GrPaint&&, 28 const SkRect& drawRect, 29 const SkRect& localRect, 30 const SkMatrix& localM = SkMatrix::I()); 31 32 /** 33 * A simpler version of MakeRect that takes a single color FP instead of a full paint. Uses 34 * SkBlendMode::kSrcOver. 35 */ 36 GrOp::Owner MakeRect(GrRecordingContext*, 37 std::unique_ptr<GrFragmentProcessor>, 38 const SkRect& drawRect, 39 const SkRect& localRect, 40 const SkMatrix& localM = SkMatrix::I()); 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 */ 46 GrOp::Owner MakeRect(GrRecordingContext*, GrPaint&&, const SkRect& rect); 47 48 } // namespace sk_gpu_test::test_ops 49 50 #endif 51