blob: 6f319cc17df97c0b4369fd5a24a8398f7b223bfe [file] [log] [blame]
Michael Ludwig72ab3462018-12-10 12:43:36 -05001/*
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
8#ifndef GrStrokeRectOp_DEFINED
9#define GrStrokeRectOp_DEFINED
10
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/private/GrTypesPriv.h"
Michael Ludwig72ab3462018-12-10 12:43:36 -050012
13class GrDrawOp;
14class GrPaint;
Robert Phillipsb97da532019-02-12 15:24:12 -050015class GrRecordingContext;
Michael Ludwig72ab3462018-12-10 12:43:36 -050016class SkMatrix;
17struct SkRect;
18class 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 */
26namespace GrStrokeRectOp {
27
Robert Phillipsb97da532019-02-12 15:24:12 -050028std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
Michael Ludwig72ab3462018-12-10 12:43:36 -050029 GrPaint&& paint,
30 GrAAType aaType,
31 const SkMatrix& viewMatrix,
32 const SkRect& rect,
33 const SkStrokeRec& stroke);
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 Phillipsb97da532019-02-12 15:24:12 -050038std::unique_ptr<GrDrawOp> MakeNested(GrRecordingContext* context,
Michael Ludwig72ab3462018-12-10 12:43:36 -050039 GrPaint&& paint,
40 const SkMatrix& viewMatrix,
41 const SkRect rects[2]);
42
43} // namespace GrStrokeRectOp
44
45#endif // GrStrokeRectOp_DEFINED