• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 "include/private/GrTypesPriv.h"
12 #include "src/gpu/GrRenderTargetContext.h"
13 
14 class GrDrawOp;
15 class GrPaint;
16 class GrQuad;
17 class GrRecordingContext;
18 struct GrUserStencilSettings;
19 class SkMatrix;
20 struct SkRect;
21 
22 /**
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  */
28 namespace GrFillRectOp {
29 
30 std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
31                                GrPaint&& paint,
32                                GrAAType aaType,
33                                GrQuadAAFlags aaFlags,
34                                const GrQuad& deviceQuad,
35                                const GrQuad& localQuad,
36                                const GrUserStencilSettings* stencil = nullptr);
37 
38 // 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.
40 std::unique_ptr<GrDrawOp> MakeNonAARect(GrRecordingContext* context,
41                                         GrPaint&& paint,
42                                         const SkMatrix& view,
43                                         const SkRect& rect,
44                                         const GrUserStencilSettings* stencil = nullptr);
45 
46 // Bulk API for drawing quads with a single op
47 // TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
48 std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
49                                   GrPaint&& paint,
50                                   GrAAType aaType,
51                                   const SkMatrix& viewMatrix,
52                                   const GrRenderTargetContext::QuadSetEntry quads[],
53                                   int quadCount,
54                                   const GrUserStencilSettings* stencil = nullptr);
55 
56 } // namespace GrFillRectOp
57 
58 #endif // GrFillRectOp_DEFINED
59