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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 * and sets the GrGpu's scissor and stencil state. If the return is false | 46 * and sets the GrGpu's scissor and stencil state. If the return is false |
47 * then the draw can be skipped. The AutoRestoreEffects is initialized by | 47 * then the draw can be skipped. The AutoRestoreEffects is initialized by |
48 * the manager when it must install additional effects to implement the | 48 * the manager when it must install additional effects to implement the |
49 * clip. devBounds is optional but can help optimize clipping. | 49 * clip. devBounds is optional but can help optimize clipping. |
50 */ | 50 */ |
51 bool setupClipping(GrDrawState*, | 51 bool setupClipping(GrDrawState*, |
52 GrDrawState::AutoRestoreEffects*, | 52 GrDrawState::AutoRestoreEffects*, |
53 GrDrawState::AutoRestoreStencil*, | 53 GrDrawState::AutoRestoreStencil*, |
54 GrScissorState*, | 54 GrScissorState*, |
55 const GrClipData* clipDataIn, | 55 const GrClipData* clipDataIn, |
| 56 const SkMatrix& viewMatrix, |
56 const SkRect* devBounds); | 57 const SkRect* devBounds); |
57 | 58 |
58 /** | 59 /** |
59 * Purge resources to free up memory. TODO: This class shouldn't hold any lo
ng lived refs | 60 * Purge resources to free up memory. TODO: This class shouldn't hold any lo
ng lived refs |
60 * which will allow ResourceCache2 to automatically purge anything this clas
s has created. | 61 * which will allow ResourceCache2 to automatically purge anything this clas
s has created. |
61 */ | 62 */ |
62 void purgeResources(); | 63 void purgeResources(); |
63 | 64 |
64 bool isClipInStencil() const { | 65 bool isClipInStencil() const { |
65 return kStencil_ClipMaskType == fCurrClipMaskType; | 66 return kStencil_ClipMaskType == fCurrClipMaskType; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // Returns the cached mask texture if it matches the elementsGenID and the c
lipSpaceIBounds. | 125 // Returns the cached mask texture if it matches the elementsGenID and the c
lipSpaceIBounds. |
125 // Returns NULL if not found. | 126 // Returns NULL if not found. |
126 GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSp
aceIBounds); | 127 GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSp
aceIBounds); |
127 | 128 |
128 // Handles allocation (if needed) of a clip alpha-mask texture for both the
sw-upload | 129 // Handles allocation (if needed) of a clip alpha-mask texture for both the
sw-upload |
129 // or gpu-rendered cases. | 130 // or gpu-rendered cases. |
130 GrTexture* allocMaskTexture(int32_t elementsGenID, | 131 GrTexture* allocMaskTexture(int32_t elementsGenID, |
131 const SkIRect& clipSpaceIBounds, | 132 const SkIRect& clipSpaceIBounds, |
132 bool willUpload); | 133 bool willUpload); |
133 | 134 |
134 bool useSWOnlyPath(const GrDrawState*, const GrReducedClip::ElementList& ele
ments); | 135 bool useSWOnlyPath(const GrDrawState*, |
| 136 const SkMatrix& viewMatrix, |
| 137 const GrReducedClip::ElementList& elements); |
135 | 138 |
136 // Draws a clip element into the target alpha mask. The caller should have a
lready setup the | 139 // 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 | 140 // 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. | 141 // be passed. Otherwise the function will select one if the element is a pat
h. |
139 bool drawElement(GrDrawState*, | 142 bool drawElement(GrDrawState*, |
| 143 const SkMatrix& viewMatrix, |
140 GrTexture* target, | 144 GrTexture* target, |
141 const SkClipStack::Element*, | 145 const SkClipStack::Element*, |
142 GrPathRenderer* pr = NULL); | 146 GrPathRenderer* pr = NULL); |
143 | 147 |
144 // Determines whether it is possible to draw the element to both the stencil
buffer and the | 148 // 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 | 149 // alpha mask simultaneously. If so and the element is a path a compatible p
ath renderer is |
146 // also returned. | 150 // also returned. |
147 bool canStencilAndDrawElement(GrDrawState*, | 151 bool canStencilAndDrawElement(GrDrawState*, |
148 GrTexture* target, | 152 GrTexture* target, |
149 GrPathRenderer**, | 153 GrPathRenderer**, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 kAlpha_ClipMaskType, | 190 kAlpha_ClipMaskType, |
187 } fCurrClipMaskType; | 191 } fCurrClipMaskType; |
188 | 192 |
189 GrClipMaskCache fAACache; // cache for the AA path | 193 GrClipMaskCache fAACache; // cache for the AA path |
190 GrClipTarget* fClipTarget; | 194 GrClipTarget* fClipTarget; |
191 StencilClipMode fClipMode; | 195 StencilClipMode fClipMode; |
192 | 196 |
193 typedef SkNoncopyable INHERITED; | 197 typedef SkNoncopyable INHERITED; |
194 }; | 198 }; |
195 #endif // GrClipMaskManager_DEFINED | 199 #endif // GrClipMaskManager_DEFINED |
OLD | NEW |