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 "GrPipelineBuilder.h" | 10 #include "GrPipelineBuilder.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 * then the draw can be skipped. The AutoRestoreEffects is initialized by | 60 * then the draw can be skipped. The AutoRestoreEffects is initialized by |
61 * the manager when it must install additional effects to implement the | 61 * the manager when it must install additional effects to implement the |
62 * clip. devBounds is optional but can help optimize clipping. | 62 * clip. devBounds is optional but can help optimize clipping. |
63 */ | 63 */ |
64 bool setupClipping(const GrPipelineBuilder&, | 64 bool setupClipping(const GrPipelineBuilder&, |
65 GrPipelineBuilder::AutoRestoreStencil*, | 65 GrPipelineBuilder::AutoRestoreStencil*, |
66 GrScissorState*, | 66 GrScissorState*, |
67 const SkRect* devBounds, | 67 const SkRect* devBounds, |
68 GrAppliedClip*); | 68 GrAppliedClip*); |
69 | 69 |
70 bool isClipInStencil() const { | |
71 return kStencil_ClipMaskType == fCurrClipMaskType; | |
72 } | |
73 | |
74 bool isClipInAlpha() const { | |
75 return kAlpha_ClipMaskType == fCurrClipMaskType; | |
76 } | |
77 | |
78 void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*)
; | 70 void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*)
; |
79 | 71 |
80 private: | 72 private: |
81 inline GrContext* getContext(); | 73 inline GrContext* getContext(); |
82 | 74 |
83 /** | 75 /** |
84 * Informs the helper function adjustStencilParams() about how the stencil | 76 * Informs the helper function adjustStencilParams() about how the stencil |
85 * buffer clip is being used. | 77 * buffer clip is being used. |
86 */ | 78 */ |
87 enum StencilClipMode { | 79 enum StencilClipMode { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 /** | 155 /** |
164 * Adjusts the stencil settings to account for interaction with stencil | 156 * Adjusts the stencil settings to account for interaction with stencil |
165 * clipping. | 157 * clipping. |
166 */ | 158 */ |
167 void adjustStencilParams(GrStencilSettings* settings, | 159 void adjustStencilParams(GrStencilSettings* settings, |
168 StencilClipMode mode, | 160 StencilClipMode mode, |
169 int stencilBitCnt); | 161 int stencilBitCnt); |
170 | 162 |
171 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); | 163 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); |
172 | 164 |
173 /** | |
174 * We may represent the clip as a mask in the stencil buffer or as an alpha | |
175 * texture. It may be neither because the scissor rect suffices or we | |
176 * haven't yet examined the clip. | |
177 */ | |
178 enum ClipMaskType { | |
179 kNone_ClipMaskType, | |
180 kStencil_ClipMaskType, | |
181 kAlpha_ClipMaskType, | |
182 } fCurrClipMaskType; | |
183 | |
184 static const int kMaxAnalyticElements = 4; | 165 static const int kMaxAnalyticElements = 4; |
185 | 166 |
186 GrDrawTarget* fDrawTarget; // This is our owning draw target. | 167 GrDrawTarget* fDrawTarget; // This is our owning draw target. |
187 StencilClipMode fClipMode; | 168 StencilClipMode fClipMode; |
188 | 169 |
189 typedef SkNoncopyable INHERITED; | 170 typedef SkNoncopyable INHERITED; |
190 }; | 171 }; |
191 #endif // GrClipMaskManager_DEFINED | 172 #endif // GrClipMaskManager_DEFINED |
OLD | NEW |