OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #ifndef GrClipMaskManager_DEFINED | 7 #ifndef GrClipMaskManager_DEFINED |
8 #define GrClipMaskManager_DEFINED | 8 #define GrClipMaskManager_DEFINED |
9 | 9 |
10 #include "GrClipMaskCache.h" | 10 #include "GrClipMaskCache.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 GrReducedClip::InitialState initialState, | 106 GrReducedClip::InitialState initialState, |
107 const GrReducedClip::ElementList& elements, | 107 const GrReducedClip::ElementList& elements, |
108 const SkIRect& clipSpaceIBounds, | 108 const SkIRect& clipSpaceIBounds, |
109 const SkIPoint& clipSpaceToStencilOffset); | 109 const SkIPoint& clipSpaceToStencilOffset); |
110 | 110 |
111 // Creates an alpha mask of the clip. The mask is a rasterization of element
s through the | 111 // Creates an alpha mask of the clip. The mask is a rasterization of element
s through the |
112 // rect specified by clipSpaceIBounds. | 112 // rect specified by clipSpaceIBounds. |
113 GrTexture* createAlphaClipMask(int32_t elementsGenID, | 113 GrTexture* createAlphaClipMask(int32_t elementsGenID, |
114 GrReducedClip::InitialState initialState, | 114 GrReducedClip::InitialState initialState, |
115 const GrReducedClip::ElementList& elements, | 115 const GrReducedClip::ElementList& elements, |
| 116 const SkVector& clipToMaskOffset, |
116 const SkIRect& clipSpaceIBounds); | 117 const SkIRect& clipSpaceIBounds); |
117 | 118 |
118 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. | 119 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. |
119 GrTexture* createSoftwareClipMask(int32_t elementsGenID, | 120 GrTexture* createSoftwareClipMask(int32_t elementsGenID, |
120 GrReducedClip::InitialState initialState, | 121 GrReducedClip::InitialState initialState, |
121 const GrReducedClip::ElementList& elements
, | 122 const GrReducedClip::ElementList& elements
, |
| 123 const SkVector& clipToMaskOffset, |
122 const SkIRect& clipSpaceIBounds); | 124 const SkIRect& clipSpaceIBounds); |
123 | 125 |
124 // Returns the cached mask texture if it matches the elementsGenID and the c
lipSpaceIBounds. | 126 // Returns the cached mask texture if it matches the elementsGenID and the c
lipSpaceIBounds. |
125 // Returns NULL if not found. | 127 // Returns NULL if not found. |
126 GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSp
aceIBounds); | 128 GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSp
aceIBounds); |
127 | 129 |
128 // Handles allocation (if needed) of a clip alpha-mask texture for both the
sw-upload | 130 // Handles allocation (if needed) of a clip alpha-mask texture for both the
sw-upload |
129 // or gpu-rendered cases. | 131 // or gpu-rendered cases. |
130 GrTexture* allocMaskTexture(int32_t elementsGenID, | 132 GrTexture* allocMaskTexture(int32_t elementsGenID, |
131 const SkIRect& clipSpaceIBounds, | 133 const SkIRect& clipSpaceIBounds, |
132 bool willUpload); | 134 bool willUpload); |
133 | 135 |
134 bool useSWOnlyPath(const GrDrawState*, const GrReducedClip::ElementList& ele
ments); | 136 bool useSWOnlyPath(const GrDrawState*, |
| 137 const SkVector& clipToMaskOffset, |
| 138 const GrReducedClip::ElementList& elements); |
135 | 139 |
136 // Draws a clip element into the target alpha mask. The caller should have a
lready setup the | 140 // Draws a clip element into the target alpha mask. The caller should have a
lready setup the |
137 // desired blend operation. Optionally if the caller already selected a path
renderer it can | 141 // desired blend operation. Optionally if the caller already selected a path
renderer it can |
138 // be passed. Otherwise the function will select one if the element is a pat
h. | 142 // be passed. Otherwise the function will select one if the element is a pat
h. |
139 bool drawElement(GrDrawState*, | 143 bool drawElement(GrDrawState*, |
| 144 const SkMatrix& viewMatrix, |
140 GrTexture* target, | 145 GrTexture* target, |
141 const SkClipStack::Element*, | 146 const SkClipStack::Element*, |
142 GrPathRenderer* pr = NULL); | 147 GrPathRenderer* pr = NULL); |
143 | 148 |
144 // Determines whether it is possible to draw the element to both the stencil
buffer and the | 149 // Determines whether it is possible to draw the element to both the stencil
buffer and the |
145 // alpha mask simultaneously. If so and the element is a path a compatible p
ath renderer is | 150 // alpha mask simultaneously. If so and the element is a path a compatible p
ath renderer is |
146 // also returned. | 151 // also returned. |
147 bool canStencilAndDrawElement(GrDrawState*, | 152 bool canStencilAndDrawElement(GrDrawState*, |
148 GrTexture* target, | 153 GrTexture* target, |
149 GrPathRenderer**, | 154 GrPathRenderer**, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 kAlpha_ClipMaskType, | 191 kAlpha_ClipMaskType, |
187 } fCurrClipMaskType; | 192 } fCurrClipMaskType; |
188 | 193 |
189 GrClipMaskCache fAACache; // cache for the AA path | 194 GrClipMaskCache fAACache; // cache for the AA path |
190 GrClipTarget* fClipTarget; | 195 GrClipTarget* fClipTarget; |
191 StencilClipMode fClipMode; | 196 StencilClipMode fClipMode; |
192 | 197 |
193 typedef SkNoncopyable INHERITED; | 198 typedef SkNoncopyable INHERITED; |
194 }; | 199 }; |
195 #endif // GrClipMaskManager_DEFINED | 200 #endif // GrClipMaskManager_DEFINED |
OLD | NEW |