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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrRenderTargetContextPriv_DEFINED
#define GrRenderTargetContextPriv_DEFINED
#include "GrRenderTargetContext.h"
#include "GrRenderTargetOpList.h"
#include "GrPathRendering.h"
class GrFixedClip;
class GrPath;
class GrRenderTargetPriv;
struct GrUserStencilSettings;
/** Class that adds methods to GrRenderTargetContext that are only intended for use internal to
Skia. This class is purely a privileged window into GrRenderTargetContext. It should never have
additional data members or virtual methods. */
class GrRenderTargetContextPriv {
public:
gr_instanced::InstancedRendering* accessInstancedRendering() const {
return fRenderTargetContext->getRTOpList()->instancedRendering();
}
// called to note the last clip drawn to the stencil buffer.
// TODO: remove after clipping overhaul.
void setLastClip(uint32_t clipStackGenID, const SkIRect& devClipBounds) {
GrRenderTargetOpList* opList = fRenderTargetContext->getRTOpList();
opList->fLastClipStackGenID = clipStackGenID;
opList->fLastDevClipBounds = devClipBounds;
}
// called to determine if we have to render the clip into SB.
// TODO: remove after clipping overhaul.
bool mustRenderClip(uint32_t clipStackGenID, const SkIRect& devClipBounds) const {
GrRenderTargetOpList* opList = fRenderTargetContext->getRTOpList();
return opList->fLastClipStackGenID != clipStackGenID ||
!opList->fLastDevClipBounds.contains(devClipBounds);
}
void clear(const GrFixedClip&, const GrColor, bool canIgnoreClip);
void clearStencilClip(const GrFixedClip&, bool insideStencilMask);
/*
* Some portions of the code, which use approximate-match rendertargets (i.e., ImageFilters),
* rely on clears that lie outside of the content region to still have an effect.
* For example, when sampling a decimated blurred image back up to full size, the GaussianBlur
* code draws 1-pixel rects along the left and bottom edges to be able to use bilerp for
* upsampling. The "absClear" entry point ignores the content bounds but does use the
* worst case (instantiated) bounds.
*
* @param rect if (!null) the rect to clear, otherwise it is a full screen clear
* @param color the color to clear to
*/
void absClear(const SkIRect* rect, const GrColor color);
void stencilRect(const GrClip& clip,
const GrUserStencilSettings* ss,
GrAAType,
const SkMatrix& viewMatrix,
const SkRect& rect);
void stencilPath(const GrClip&, GrAAType, const SkMatrix& viewMatrix, const GrPath*);
/**
* Draws a rect, either AA or not, and touches the stencil buffer with the user stencil settings
* for each color sample written.
*/
bool drawAndStencilRect(const GrClip&,
const GrUserStencilSettings*,
SkRegion::Op op,
bool invert,
GrAA,
const SkMatrix& viewMatrix,
const SkRect&);
/**
* Draws a path, either AA or not, and touches the stencil buffer with the user stencil settings
* for each color sample written.
*/
bool drawAndStencilPath(const GrClip&,
const GrUserStencilSettings*,
SkRegion::Op op,
bool invert,
GrAA,
const SkMatrix& viewMatrix,
const SkPath&);
SkBudgeted isBudgeted() const;
int maxWindowRectangles() const;
/*
* This unique ID will not change for a given RenderTargetContext. However, it is _NOT_
* guaranteed to match the uniqueID of the underlying GrRenderTarget - beware!
*/
GrSurfaceProxy::UniqueID uniqueID() const {
return fRenderTargetContext->fRenderTargetProxy->uniqueID();
}
uint32_t testingOnly_addDrawOp(std::unique_ptr<GrDrawOp>);
bool refsWrappedObjects() const {
return fRenderTargetContext->fRenderTargetProxy->refsWrappedObjects();
}
private:
explicit GrRenderTargetContextPriv(GrRenderTargetContext* renderTargetContext)
: fRenderTargetContext(renderTargetContext) {}
GrRenderTargetContextPriv(const GrRenderTargetPriv&) {} // unimpl
GrRenderTargetContextPriv& operator=(const GrRenderTargetPriv&); // unimpl
// No taking addresses of this type.
const GrRenderTargetContextPriv* operator&() const;
GrRenderTargetContextPriv* operator&();
GrRenderTargetContext* fRenderTargetContext;
friend class GrRenderTargetContext; // to construct/copy this type.
};
inline GrRenderTargetContextPriv GrRenderTargetContext::priv() {
return GrRenderTargetContextPriv(this);
}
inline const GrRenderTargetContextPriv GrRenderTargetContext::priv() const {
return GrRenderTargetContextPriv(const_cast<GrRenderTargetContext*>(this));
}
#endif
|