| 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 26 matching lines...) Expand all Loading... |
| 37 GrClipMaskManager(GrClipTarget* owner); | 37 GrClipMaskManager(GrClipTarget* owner); |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Creates a clip mask if necessary as a stencil buffer or alpha texture | 40 * Creates a clip mask if necessary as a stencil buffer or alpha texture |
| 41 * and sets the GrGpu's scissor and stencil state. If the return is false | 41 * and sets the GrGpu's scissor and stencil state. If the return is false |
| 42 * then the draw can be skipped. The AutoRestoreEffects is initialized by | 42 * then the draw can be skipped. The AutoRestoreEffects is initialized by |
| 43 * the manager when it must install additional effects to implement the | 43 * the manager when it must install additional effects to implement the |
| 44 * clip. devBounds is optional but can help optimize clipping. | 44 * clip. devBounds is optional but can help optimize clipping. |
| 45 */ | 45 */ |
| 46 bool setupClipping(const GrPipelineBuilder&, | 46 bool setupClipping(const GrPipelineBuilder&, |
| 47 GrPipelineBuilder::AutoRestoreFragmentProcessors*, | 47 GrPipelineBuilder::AutoRestoreFragmentProcessorState*, |
| 48 GrPipelineBuilder::AutoRestoreStencil*, | 48 GrPipelineBuilder::AutoRestoreStencil*, |
| 49 GrPipelineBuilder::AutoRestoreProcessorDataManager*, | |
| 50 GrScissorState*, | 49 GrScissorState*, |
| 51 const SkRect* devBounds); | 50 const SkRect* devBounds); |
| 52 | 51 |
| 53 /** | 52 /** |
| 54 * Purge resources to free up memory. TODO: This class shouldn't hold any lo
ng lived refs | 53 * Purge resources to free up memory. TODO: This class shouldn't hold any lo
ng lived refs |
| 55 * which will allow Resourcecache to automatically purge anything this class
has created. | 54 * which will allow Resourcecache to automatically purge anything this class
has created. |
| 56 */ | 55 */ |
| 57 void purgeResources(); | 56 void purgeResources(); |
| 58 | 57 |
| 59 bool isClipInStencil() const { | 58 bool isClipInStencil() const { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 81 // Clip against the existing representation of the clip in the high bit | 80 // Clip against the existing representation of the clip in the high bit |
| 82 // of the stencil buffer. | 81 // of the stencil buffer. |
| 83 kRespectClip_StencilClipMode, | 82 kRespectClip_StencilClipMode, |
| 84 // Neither writing to nor clipping against the clip bit. | 83 // Neither writing to nor clipping against the clip bit. |
| 85 kIgnoreClip_StencilClipMode, | 84 kIgnoreClip_StencilClipMode, |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 // Attempts to install a series of coverage effects to implement the clip. R
eturn indicates | 87 // Attempts to install a series of coverage effects to implement the clip. R
eturn indicates |
| 89 // whether the element list was successfully converted to effects. | 88 // whether the element list was successfully converted to effects. |
| 90 bool installClipEffects(const GrPipelineBuilder&, | 89 bool installClipEffects(const GrPipelineBuilder&, |
| 91 GrPipelineBuilder::AutoRestoreFragmentProcessors*, | 90 GrPipelineBuilder::AutoRestoreFragmentProcessorState
*, |
| 92 const GrReducedClip::ElementList&, | 91 const GrReducedClip::ElementList&, |
| 93 const SkVector& clipOffset, | 92 const SkVector& clipOffset, |
| 94 const SkRect* devBounds); | 93 const SkRect* devBounds); |
| 95 | 94 |
| 96 // Draws the clip into the stencil buffer | 95 // Draws the clip into the stencil buffer |
| 97 bool createStencilClipMask(GrRenderTarget*, | 96 bool createStencilClipMask(GrRenderTarget*, |
| 98 int32_t elementsGenID, | 97 int32_t elementsGenID, |
| 99 GrReducedClip::InitialState initialState, | 98 GrReducedClip::InitialState initialState, |
| 100 const GrReducedClip::ElementList& elements, | 99 const GrReducedClip::ElementList& elements, |
| 101 const SkIRect& clipSpaceIBounds, | 100 const SkIRect& clipSpaceIBounds, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 kAlpha_ClipMaskType, | 183 kAlpha_ClipMaskType, |
| 185 } fCurrClipMaskType; | 184 } fCurrClipMaskType; |
| 186 | 185 |
| 187 GrClipMaskCache fAACache; // cache for the AA path | 186 GrClipMaskCache fAACache; // cache for the AA path |
| 188 GrClipTarget* fClipTarget; // This is our owning clip target. | 187 GrClipTarget* fClipTarget; // This is our owning clip target. |
| 189 StencilClipMode fClipMode; | 188 StencilClipMode fClipMode; |
| 190 | 189 |
| 191 typedef SkNoncopyable INHERITED; | 190 typedef SkNoncopyable INHERITED; |
| 192 }; | 191 }; |
| 193 #endif // GrClipMaskManager_DEFINED | 192 #endif // GrClipMaskManager_DEFINED |
| OLD | NEW |