blob: 7b71830ee88617a251b967dcabf53d3434d0aacd [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;
Robert Phillipsb97da532019-02-12 15:24:12 -050016class GrRecordingContext;
Michael Ludwig69858532018-11-28 15:34:34 -050017struct GrUserStencilSettings;
18class SkMatrix;
19struct SkRect;
20
Michael Ludwig72ab3462018-12-10 12:43:36 -050021/**
22 * A set of factory functions for drawing filled rectangles either coverage-antialiased, or
23 * non-antialiased. The non-antialiased ops can be used with MSAA. As with other GrDrawOp factories,
24 * the GrPaint is only consumed by these methods if a valid op is returned. If null is returned then
25 * the paint is unmodified and may still be used.
26 */
Michael Ludwig69858532018-11-28 15:34:34 -050027namespace GrFillRectOp {
28
Michael Ludwig72ab3462018-12-10 12:43:36 -050029// General purpose factory functions that handle per-edge anti-aliasing
Robert Phillipsb97da532019-02-12 15:24:12 -050030std::unique_ptr<GrDrawOp> MakePerEdge(GrRecordingContext* context,
Michael Ludwig72ab3462018-12-10 12:43:36 -050031 GrPaint&& paint,
32 GrAAType aaType,
33 GrQuadAAFlags edgeAA,
34 const SkMatrix& viewMatrix,
35 const SkRect& rect,
36 const GrUserStencilSettings* stencil = nullptr);
37
Robert Phillipsb97da532019-02-12 15:24:12 -050038std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalMatrix(GrRecordingContext* context,
Michael Ludwig72ab3462018-12-10 12:43:36 -050039 GrPaint&& paint,
40 GrAAType aaType,
41 GrQuadAAFlags edgeAA,
42 const SkMatrix& viewMatrix,
43 const SkMatrix& localMatrix,
44 const SkRect& rect,
45 const GrUserStencilSettings* stl = nullptr);
46
Robert Phillipsb97da532019-02-12 15:24:12 -050047std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalRect(GrRecordingContext* context,
Michael Ludwig72ab3462018-12-10 12:43:36 -050048 GrPaint&& paint,
49 GrAAType aaType,
50 GrQuadAAFlags edgeAA,
51 const SkMatrix& viewMatrix,
52 const SkRect& rect,
53 const SkRect& localRect,
54 const GrUserStencilSettings* stencil = nullptr);
55
56// Bulk API for drawing quads with a single op
Michael Ludwig75451902019-01-23 11:14:29 -050057// TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
Robert Phillipsb97da532019-02-12 15:24:12 -050058std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
Michael Ludwig72ab3462018-12-10 12:43:36 -050059 GrPaint&& paint,
60 GrAAType aaType,
61 const SkMatrix& viewMatrix,
62 const GrRenderTargetContext::QuadSetEntry quads[],
63 int quadCount,
64 const GrUserStencilSettings* stencil = nullptr);
65
66// Specializations where all edges are treated the same. If the aa type is coverage, then the
67// edges will be anti-aliased, otherwise per-edge AA will be disabled.
Robert Phillipsb97da532019-02-12 15:24:12 -050068std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
Michael Ludwig69858532018-11-28 15:34:34 -050069 GrPaint&& paint,
70 GrAAType aaType,
Michael Ludwig69858532018-11-28 15:34:34 -050071 const SkMatrix& viewMatrix,
72 const SkRect& rect,
73 const GrUserStencilSettings* stencil = nullptr);
74
Robert Phillipsb97da532019-02-12 15:24:12 -050075std::unique_ptr<GrDrawOp> MakeWithLocalMatrix(GrRecordingContext* context,
Michael Ludwig69858532018-11-28 15:34:34 -050076 GrPaint&& paint,
77 GrAAType aaType,
Michael Ludwig69858532018-11-28 15:34:34 -050078 const SkMatrix& viewMatrix,
79 const SkMatrix& localMatrix,
80 const SkRect& rect,
81 const GrUserStencilSettings* stencil = nullptr);
82
Robert Phillipsb97da532019-02-12 15:24:12 -050083std::unique_ptr<GrDrawOp> MakeWithLocalRect(GrRecordingContext* context,
Michael Ludwig69858532018-11-28 15:34:34 -050084 GrPaint&& paint,
85 GrAAType aaType,
Michael Ludwig69858532018-11-28 15:34:34 -050086 const SkMatrix& viewMatrix,
87 const SkRect& rect,
88 const SkRect& localRect,
89 const GrUserStencilSettings* stencil = nullptr);
90
Michael Ludwig72ab3462018-12-10 12:43:36 -050091} // namespace GrFillRectOp
Michael Ludwig69858532018-11-28 15:34:34 -050092
93#endif // GrFillRectOp_DEFINED