blob: 175c9f3a6caf54883728ca9cdb9a6b5b8f470276 [file] [log] [blame]
Michael Ludwig69858532018-11-28 15:34:34 -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 GrFillRectOp_DEFINED
9#define GrFillRectOp_DEFINED
10
11#include "GrRenderTargetContext.h"
12#include "GrTypesPriv.h"
13
14class GrDrawOp;
15class GrPaint;
16struct GrUserStencilSettings;
17class SkMatrix;
18struct SkRect;
19
Michael Ludwig72ab3462018-12-10 12:43:36 -050020/**
21 * A set of factory functions for drawing filled 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 */
Michael Ludwig69858532018-11-28 15:34:34 -050026namespace GrFillRectOp {
27
Michael Ludwig72ab3462018-12-10 12:43:36 -050028// General purpose factory functions that handle per-edge anti-aliasing
29std::unique_ptr<GrDrawOp> MakePerEdge(GrContext* context,
30 GrPaint&& paint,
31 GrAAType aaType,
32 GrQuadAAFlags edgeAA,
33 const SkMatrix& viewMatrix,
34 const SkRect& rect,
35 const GrUserStencilSettings* stencil = nullptr);
36
37std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalMatrix(GrContext* context,
38 GrPaint&& paint,
39 GrAAType aaType,
40 GrQuadAAFlags edgeAA,
41 const SkMatrix& viewMatrix,
42 const SkMatrix& localMatrix,
43 const SkRect& rect,
44 const GrUserStencilSettings* stl = nullptr);
45
46std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalRect(GrContext* context,
47 GrPaint&& paint,
48 GrAAType aaType,
49 GrQuadAAFlags edgeAA,
50 const SkMatrix& viewMatrix,
51 const SkRect& rect,
52 const SkRect& localRect,
53 const GrUserStencilSettings* stencil = nullptr);
54
55// Bulk API for drawing quads with a single op
56std::unique_ptr<GrDrawOp> MakeSet(GrContext* context,
57 GrPaint&& paint,
58 GrAAType aaType,
59 const SkMatrix& viewMatrix,
60 const GrRenderTargetContext::QuadSetEntry quads[],
61 int quadCount,
62 const GrUserStencilSettings* stencil = nullptr);
63
64// Specializations where all edges are treated the same. If the aa type is coverage, then the
65// edges will be anti-aliased, otherwise per-edge AA will be disabled.
Michael Ludwig69858532018-11-28 15:34:34 -050066std::unique_ptr<GrDrawOp> Make(GrContext* context,
67 GrPaint&& paint,
68 GrAAType aaType,
Michael Ludwig69858532018-11-28 15:34:34 -050069 const SkMatrix& viewMatrix,
70 const SkRect& rect,
71 const GrUserStencilSettings* stencil = nullptr);
72
73std::unique_ptr<GrDrawOp> MakeWithLocalMatrix(GrContext* context,
74 GrPaint&& paint,
75 GrAAType aaType,
Michael Ludwig69858532018-11-28 15:34:34 -050076 const SkMatrix& viewMatrix,
77 const SkMatrix& localMatrix,
78 const SkRect& rect,
79 const GrUserStencilSettings* stencil = nullptr);
80
81std::unique_ptr<GrDrawOp> MakeWithLocalRect(GrContext* context,
82 GrPaint&& paint,
83 GrAAType aaType,
Michael Ludwig69858532018-11-28 15:34:34 -050084 const SkMatrix& viewMatrix,
85 const SkRect& rect,
86 const SkRect& localRect,
87 const GrUserStencilSettings* stencil = nullptr);
88
Michael Ludwig72ab3462018-12-10 12:43:36 -050089} // namespace GrFillRectOp
Michael Ludwig69858532018-11-28 15:34:34 -050090
91#endif // GrFillRectOp_DEFINED