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 SkMatrix& translate, |
| 117 const SkVector& clipToMaskOffset, |
116 const SkIRect& clipSpaceIBounds); | 118 const SkIRect& clipSpaceIBounds); |
117 | 119 |
118 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. | 120 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. |
119 GrTexture* createSoftwareClipMask(int32_t elementsGenID, | 121 GrTexture* createSoftwareClipMask(int32_t elementsGenID, |
120 GrReducedClip::InitialState initialState, | 122 GrReducedClip::InitialState initialState, |
121 const GrReducedClip::ElementList& elements
, | 123 const GrReducedClip::ElementList& elements
, |
| 124 const SkMatrix& translate, |
122 const SkIRect& clipSpaceIBounds); | 125 const SkIRect& clipSpaceIBounds); |
123 | 126 |
124 // Returns the cached mask texture if it matches the elementsGenID and the c
lipSpaceIBounds. | 127 // Returns the cached mask texture if it matches the elementsGenID and the c
lipSpaceIBounds. |
125 // Returns NULL if not found. | 128 // Returns NULL if not found. |
126 GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSp
aceIBounds); | 129 GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSp
aceIBounds); |
127 | 130 |
128 // Handles allocation (if needed) of a clip alpha-mask texture for both the
sw-upload | 131 // Handles allocation (if needed) of a clip alpha-mask texture for both the
sw-upload |
129 // or gpu-rendered cases. | 132 // or gpu-rendered cases. |
130 GrTexture* allocMaskTexture(int32_t elementsGenID, | 133 GrTexture* allocMaskTexture(int32_t elementsGenID, |
131 const SkIRect& clipSpaceIBounds, | 134 const SkIRect& clipSpaceIBounds, |
132 bool willUpload); | 135 bool willUpload); |
133 | 136 |
134 bool useSWOnlyPath(const GrDrawState*, const GrReducedClip::ElementList& ele
ments); | 137 bool useSWOnlyPath(const GrDrawState*, |
| 138 const SkMatrix& viewMatrix, |
| 139 const GrReducedClip::ElementList& elements); |
135 | 140 |
136 // Draws a clip element into the target alpha mask. The caller should have a
lready setup the | 141 // 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 | 142 // 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. | 143 // be passed. Otherwise the function will select one if the element is a pat
h. |
139 bool drawElement(GrDrawState*, | 144 bool drawElement(GrDrawState*, |
| 145 const SkMatrix& viewMatrix, |
140 GrTexture* target, | 146 GrTexture* target, |
141 const SkClipStack::Element*, | 147 const SkClipStack::Element*, |
142 GrPathRenderer* pr = NULL); | 148 GrPathRenderer* pr = NULL); |
143 | 149 |
144 // Determines whether it is possible to draw the element to both the stencil
buffer and the | 150 // 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 | 151 // alpha mask simultaneously. If so and the element is a path a compatible p
ath renderer is |
146 // also returned. | 152 // also returned. |
147 bool canStencilAndDrawElement(GrDrawState*, | 153 bool canStencilAndDrawElement(GrDrawState*, |
148 GrTexture* target, | 154 GrTexture* target, |
149 GrPathRenderer**, | 155 GrPathRenderer**, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 kAlpha_ClipMaskType, | 192 kAlpha_ClipMaskType, |
187 } fCurrClipMaskType; | 193 } fCurrClipMaskType; |
188 | 194 |
189 GrClipMaskCache fAACache; // cache for the AA path | 195 GrClipMaskCache fAACache; // cache for the AA path |
190 GrClipTarget* fClipTarget; | 196 GrClipTarget* fClipTarget; |
191 StencilClipMode fClipMode; | 197 StencilClipMode fClipMode; |
192 | 198 |
193 typedef SkNoncopyable INHERITED; | 199 typedef SkNoncopyable INHERITED; |
194 }; | 200 }; |
195 #endif // GrClipMaskManager_DEFINED | 201 #endif // GrClipMaskManager_DEFINED |
OLD | NEW |