Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 | |
Robert Phillips | cadd5db | 2021-08-30 11:37:18 -0400 | [diff] [blame] | 8 | #ifndef StrokeRectOp_DEFINED |
| 9 | #define StrokeRectOp_DEFINED |
Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/private/GrTypesPriv.h" |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 12 | #include "src/gpu/ops/GrOp.h" |
Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 13 | |
Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 14 | class GrPaint; |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 15 | class GrRecordingContext; |
Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 16 | class SkMatrix; |
| 17 | struct SkRect; |
| 18 | class SkStrokeRec; |
| 19 | |
| 20 | /** |
| 21 | * A set of factory functions for drawing stroked rectangles either coverage-antialiased, or |
| 22 | * non-antialiased. The non-antialiased ops can be used with MSAA. As with other GrDrawOp factories, |
| 23 | * the GrPaint is only consumed by these methods if a valid op is returned. If null is returned then |
| 24 | * the paint is unmodified and may still be used. |
| 25 | */ |
Robert Phillips | cadd5db | 2021-08-30 11:37:18 -0400 | [diff] [blame] | 26 | namespace skgpu::v1::StrokeRectOp { |
Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 27 | |
Robert Phillips | cadd5db | 2021-08-30 11:37:18 -0400 | [diff] [blame] | 28 | GrOp::Owner Make(GrRecordingContext*, |
| 29 | GrPaint&&, |
| 30 | GrAAType, |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 31 | const SkMatrix& viewMatrix, |
Robert Phillips | cadd5db | 2021-08-30 11:37:18 -0400 | [diff] [blame] | 32 | const SkRect&, |
| 33 | const SkStrokeRec&); |
Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 34 | |
| 35 | // rects[0] == outer rectangle, rects[1] == inner rectangle. Null return means there is nothing to |
| 36 | // draw rather than failure. The area between the rectangles will be filled by the paint, and it |
| 37 | // will be anti-aliased with coverage AA. viewMatrix.rectStaysRect() must be true. |
Robert Phillips | cadd5db | 2021-08-30 11:37:18 -0400 | [diff] [blame] | 38 | GrOp::Owner MakeNested(GrRecordingContext*, |
| 39 | GrPaint&&, |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 40 | const SkMatrix& viewMatrix, |
| 41 | const SkRect rects[2]); |
Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 42 | |
Robert Phillips | cadd5db | 2021-08-30 11:37:18 -0400 | [diff] [blame] | 43 | } // namespace skgpu::v1::StrokeRectOp |
Michael Ludwig | 72ab346 | 2018-12-10 12:43:36 -0500 | [diff] [blame] | 44 | |
Robert Phillips | cadd5db | 2021-08-30 11:37:18 -0400 | [diff] [blame] | 45 | #endif // StrokeRectOp_DEFINED |