blob: 3422631427cd00df88883aef05c841953b107bab [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/private/GrTypesPriv.h"
12#include "src/gpu/GrRenderTargetContext.h"
Michael Ludwig69858532018-11-28 15:34:34 -050013
14class GrDrawOp;
15class GrPaint;
Michael Ludwigd9f917b2019-05-24 12:57:55 -040016class GrPerspQuad;
Robert Phillipsb97da532019-02-12 15:24:12 -050017class GrRecordingContext;
Michael Ludwig69858532018-11-28 15:34:34 -050018struct GrUserStencilSettings;
19class SkMatrix;
20struct SkRect;
21
Michael Ludwig72ab3462018-12-10 12:43:36 -050022/**
23 * A set of factory functions for drawing filled rectangles either coverage-antialiased, or
24 * non-antialiased. The non-antialiased ops can be used with MSAA. As with other GrDrawOp factories,
25 * the GrPaint is only consumed by these methods if a valid op is returned. If null is returned then
26 * the paint is unmodified and may still be used.
27 */
Michael Ludwig69858532018-11-28 15:34:34 -050028namespace GrFillRectOp {
29
Michael Ludwig4a0cf502019-05-30 12:54:09 -040030std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
31 GrPaint&& paint,
32 GrAAType aaType,
33 GrQuadAAFlags aaFlags,
34 const GrPerspQuad& deviceQuad,
35 const GrPerspQuad& localQuad,
36 const GrUserStencilSettings* stencil = nullptr);
Michael Ludwigd9f917b2019-05-24 12:57:55 -040037
Michael Ludwigaa1b6b32019-05-29 14:43:13 -040038// Utility function to create a non-AA rect transformed by view. This is used commonly enough in
39// testing and GMs that manage ops without going through GrRTC that it's worth the convenience.
40std::unique_ptr<GrDrawOp> MakeNonAARect(GrRecordingContext* context,
41 GrPaint&& paint,
42 const SkMatrix& view,
43 const SkRect& rect,
44 const GrUserStencilSettings* stencil = nullptr);
45
Michael Ludwig72ab3462018-12-10 12:43:36 -050046// Bulk API for drawing quads with a single op
Michael Ludwig75451902019-01-23 11:14:29 -050047// TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
Robert Phillipsb97da532019-02-12 15:24:12 -050048std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
Michael Ludwig72ab3462018-12-10 12:43:36 -050049 GrPaint&& paint,
50 GrAAType aaType,
51 const SkMatrix& viewMatrix,
52 const GrRenderTargetContext::QuadSetEntry quads[],
53 int quadCount,
54 const GrUserStencilSettings* stencil = nullptr);
55
Michael Ludwig72ab3462018-12-10 12:43:36 -050056} // namespace GrFillRectOp
Michael Ludwig69858532018-11-28 15:34:34 -050057
58#endif // GrFillRectOp_DEFINED