Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 class GrDrawTarget; | 21 class GrDrawTarget; |
| 22 class GrPathRenderer; | 22 class GrPathRenderer; |
| 23 class GrPathRendererChain; | 23 class GrPathRendererChain; |
| 24 class GrTexture; | 24 class GrTexture; |
| 25 class SkPath; | 25 class SkPath; |
| 26 | 26 |
| 27 class GrAppliedClip : public SkNoncopyable { | 27 class GrAppliedClip : public SkNoncopyable { |
| 28 public: | 28 public: |
| 29 GrAppliedClip() {} | 29 GrAppliedClip() {} |
| 30 const GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fC lipCoverageFP; } | 30 const GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fC lipCoverageFP; } |
| 31 const GrScissorState& scissorState() const { return fScissorState; } | |
| 31 | 32 |
|
robertphillips
2015/10/07 12:28:04
void setScissorState(const GrScissorState& newStat
bsalomon
2015/10/07 13:31:23
The way I see this evolving is GrCMM become a fact
| |
| 32 private: | 33 private: |
| 33 SkAutoTUnref<const GrFragmentProcessor> fClipCoverageFP; | 34 SkAutoTUnref<const GrFragmentProcessor> fClipCoverageFP; |
| 35 GrScissorState fScissorState; | |
| 34 friend GrClipMaskManager; | 36 friend GrClipMaskManager; |
| 35 | 37 |
| 36 typedef SkNoncopyable INHERITED; | 38 typedef SkNoncopyable INHERITED; |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 /** | 41 /** |
| 40 * The clip mask creator handles the generation of the clip mask. If anti | 42 * The clip mask creator handles the generation of the clip mask. If anti |
| 41 * aliasing is requested it will (in the future) generate a single channel | 43 * aliasing is requested it will (in the future) generate a single channel |
| 42 * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit | 44 * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit |
| 43 * mask in the stencil buffer. In the non anti-aliasing case, if the clip | 45 * mask in the stencil buffer. In the non anti-aliasing case, if the clip |
| 44 * mask can be represented as a rectangle then scissoring is used. In all | 46 * mask can be represented as a rectangle then scissoring is used. In all |
| 45 * cases scissoring is used to bound the range of the clip mask. | 47 * cases scissoring is used to bound the range of the clip mask. |
| 46 */ | 48 */ |
| 47 class GrClipMaskManager : SkNoncopyable { | 49 class GrClipMaskManager : SkNoncopyable { |
| 48 public: | 50 public: |
| 49 GrClipMaskManager(GrDrawTarget* owner); | 51 GrClipMaskManager(GrDrawTarget* owner); |
| 50 | 52 |
| 51 /** | 53 /** |
| 52 * Creates a clip mask if necessary as a stencil buffer or alpha texture | 54 * Creates a clip mask if necessary as a stencil buffer or alpha texture |
| 53 * and sets the GrGpu's scissor and stencil state. If the return is false | 55 * and sets the GrGpu's scissor and stencil state. If the return is false |
| 54 * then the draw can be skipped. The AutoRestoreEffects is initialized by | 56 * then the draw can be skipped. The AutoRestoreEffects is initialized by |
| 55 * the manager when it must install additional effects to implement the | 57 * the manager when it must install additional effects to implement the |
| 56 * clip. devBounds is optional but can help optimize clipping. | 58 * clip. devBounds is optional but can help optimize clipping. |
| 57 */ | 59 */ |
| 58 bool setupClipping(const GrPipelineBuilder&, | 60 bool setupClipping(const GrPipelineBuilder&, |
| 59 GrPipelineBuilder::AutoRestoreStencil*, | 61 GrPipelineBuilder::AutoRestoreStencil*, |
| 60 GrScissorState*, | |
| 61 const SkRect* devBounds, | 62 const SkRect* devBounds, |
| 62 GrAppliedClip*); | 63 GrAppliedClip*); |
| 63 | 64 |
| 64 void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*) ; | 65 void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*) ; |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 inline GrContext* getContext(); | 68 inline GrContext* getContext(); |
| 68 | 69 |
| 69 /** | 70 /** |
| 70 * Informs the helper function adjustStencilParams() about how the stencil | 71 * Informs the helper function adjustStencilParams() about how the stencil |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b ool renderTarget); | 158 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b ool renderTarget); |
| 158 | 159 |
| 159 static const int kMaxAnalyticElements = 4; | 160 static const int kMaxAnalyticElements = 4; |
| 160 | 161 |
| 161 GrDrawTarget* fDrawTarget; // This is our owning draw target. | 162 GrDrawTarget* fDrawTarget; // This is our owning draw target. |
| 162 StencilClipMode fClipMode; | 163 StencilClipMode fClipMode; |
| 163 | 164 |
| 164 typedef SkNoncopyable INHERITED; | 165 typedef SkNoncopyable INHERITED; |
| 165 }; | 166 }; |
| 166 #endif // GrClipMaskManager_DEFINED | 167 #endif // GrClipMaskManager_DEFINED |
| OLD | NEW |