1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrRectOpFactory_DEFINED
#define GrRectOpFactory_DEFINED
#include <memory>
#include "GrTypes.h"
enum class GrAAType : unsigned;
class GrDrawOp;
class GrPaint;
struct GrUserStencilSettings;
class SkMatrix;
struct SkRect;
class SkStrokeRec;
/**
* A set of factory functions for drawing rectangles including fills, strokes, coverage-antialiased,
* and non-antialiased. The non-antialiased ops can be used with MSAA. As with other GrDrawOp
* factories, the GrPaint is only consumed by these methods if a valid op is returned. If null is
* returned then the paint is unmodified and may still be used.
*/
namespace GrRectOpFactory {
/** AA Fill */
std::unique_ptr<GrDrawOp> MakeAAFill(GrContext*,
GrPaint&&,
const SkMatrix&,
const SkRect&,
const GrUserStencilSettings* = nullptr);
std::unique_ptr<GrDrawOp> MakeAAFillWithLocalMatrix(GrContext*,
GrPaint&&,
const SkMatrix& viewMatrix,
const SkMatrix& localMatrix,
const SkRect&);
std::unique_ptr<GrDrawOp> MakeAAFillWithLocalRect(GrContext*,
GrPaint&&,
const SkMatrix&,
const SkRect& rect,
const SkRect& localRect);
/** Non-AA Fill - GrAAType must be either kNone or kMSAA. */
std::unique_ptr<GrDrawOp> MakeNonAAFill(GrContext*,
GrPaint&&,
const SkMatrix& viewMatrix,
const SkRect& rect,
GrAAType,
const GrUserStencilSettings* = nullptr);
std::unique_ptr<GrDrawOp> MakeNonAAFillWithLocalMatrix(GrContext*,
GrPaint&&,
const SkMatrix& viewMatrix,
const SkMatrix& localMatrix,
const SkRect&,
GrAAType,
const GrUserStencilSettings* = nullptr);
std::unique_ptr<GrDrawOp> MakeNonAAFillWithLocalRect(GrContext*,
GrPaint&&,
const SkMatrix&,
const SkRect& rect,
const SkRect& localRect,
GrAAType);
/** AA Stroke */
std::unique_ptr<GrDrawOp> MakeAAStroke(GrContext*,
GrPaint&&,
const SkMatrix&,
const SkRect&,
const SkStrokeRec&);
// rects[0] == outer rectangle, rects[1] == inner rectangle. Null return means there is nothing to
// draw rather than failure.
std::unique_ptr<GrDrawOp> MakeAAFillNestedRects(GrContext*,
GrPaint&&,
const SkMatrix&,
const SkRect rects[2]);
/** Non-AA Stroke - GrAAType must be either kNone or kMSAA. */
std::unique_ptr<GrDrawOp> MakeNonAAStroke(GrContext*,
GrPaint&&,
const SkMatrix&,
const SkRect&,
const SkStrokeRec&,
GrAAType);
} // namespace GrRectOpFactory
#endif
|