blob: 97ea865a6d07cff13525645b184ba5b9ec9c387f [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
11#include "GrTypesPriv.h"
12
13class GrDrawOp;
14class GrPaint;
15class SkMatrix;
16struct SkRect;
17class SkStrokeRec;
18
19/**
20 * A set of factory functions for drawing stroked rectangles either coverage-antialiased, or
21 * non-antialiased. The non-antialiased ops can be used with MSAA. As with other GrDrawOp factories,
22 * the GrPaint is only consumed by these methods if a valid op is returned. If null is returned then
23 * the paint is unmodified and may still be used.
24 */
25namespace GrStrokeRectOp {
26
27std::unique_ptr<GrDrawOp> Make(GrContext* context,
28 GrPaint&& paint,
29 GrAAType aaType,
30 const SkMatrix& viewMatrix,
31 const SkRect& rect,
32 const SkStrokeRec& stroke);
33
34// rects[0] == outer rectangle, rects[1] == inner rectangle. Null return means there is nothing to
35// draw rather than failure. The area between the rectangles will be filled by the paint, and it
36// will be anti-aliased with coverage AA. viewMatrix.rectStaysRect() must be true.
37std::unique_ptr<GrDrawOp> MakeNested(GrContext* context,
38 GrPaint&& paint,
39 const SkMatrix& viewMatrix,
40 const SkRect rects[2]);
41
42} // namespace GrStrokeRectOp
43
44#endif // GrStrokeRectOp_DEFINED