| 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" |
| 11 #include "GrReducedClip.h" | 11 #include "GrReducedClip.h" |
| 12 #include "GrTexture.h" | 12 #include "GrTexture.h" |
| 13 #include "SkClipStack.h" | 13 #include "SkClipStack.h" |
| 14 #include "SkDeque.h" | 14 #include "SkDeque.h" |
| 15 #include "SkPath.h" | 15 #include "SkPath.h" |
| 16 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
| 17 #include "SkTLList.h" | 17 #include "SkTLList.h" |
| 18 #include "SkTypes.h" | 18 #include "SkTypes.h" |
| 19 | 19 |
| 20 class GrClip; |
| 20 class GrDrawTarget; | 21 class GrDrawTarget; |
| 21 class GrPathRenderer; | 22 class GrPathRenderer; |
| 22 class GrPathRendererChain; | 23 class GrPathRendererChain; |
| 23 class GrResourceProvider; | 24 class GrResourceProvider; |
| 24 class GrTexture; | 25 class GrTexture; |
| 25 class SkPath; | 26 class SkPath; |
| 26 | 27 |
| 27 /** | 28 /** |
| 28 * Produced by GrClipMaskManager. It provides a set of modifications to the draw
ing state that | 29 * Produced by GrClipMaskManager. It provides a set of modifications to the draw
ing state that |
| 29 * are used to create the final GrPipeline for a GrBatch. This is a work in prog
ress. It will | 30 * are used to create the final GrPipeline for a GrBatch. This is a work in prog
ress. It will |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 /** | 50 /** |
| 50 * The clip mask creator handles the generation of the clip mask. If anti | 51 * The clip mask creator handles the generation of the clip mask. If anti |
| 51 * aliasing is requested it will (in the future) generate a single channel | 52 * aliasing is requested it will (in the future) generate a single channel |
| 52 * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit | 53 * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit |
| 53 * mask in the stencil buffer. In the non anti-aliasing case, if the clip | 54 * mask in the stencil buffer. In the non anti-aliasing case, if the clip |
| 54 * mask can be represented as a rectangle then scissoring is used. In all | 55 * mask can be represented as a rectangle then scissoring is used. In all |
| 55 * cases scissoring is used to bound the range of the clip mask. | 56 * cases scissoring is used to bound the range of the clip mask. |
| 56 */ | 57 */ |
| 57 class GrClipMaskManager : SkNoncopyable { | 58 class GrClipMaskManager : SkNoncopyable { |
| 58 public: | 59 public: |
| 59 GrClipMaskManager(GrDrawTarget* owner, bool debugClipBatchToBounds); | 60 GrClipMaskManager(GrDrawTarget* owner); |
| 60 | 61 |
| 61 /** | 62 /** |
| 62 * Creates a clip mask if necessary as a stencil buffer or alpha texture | 63 * Creates a clip mask if necessary as a stencil buffer or alpha texture |
| 63 * and sets the GrGpu's scissor and stencil state. If the return is false | 64 * and sets the GrGpu's scissor and stencil state. If the return is false |
| 64 * then the draw can be skipped. devBounds is optional but can help optimize | 65 * then the draw can be skipped. devBounds is optional but can help optimize |
| 65 * clipping. | 66 * clipping. |
| 66 */ | 67 */ |
| 67 bool setupClipping(const GrPipelineBuilder&, const SkRect* devBounds, GrAppl
iedClip*); | 68 bool setupClipping(const GrPipelineBuilder&, const GrClip&, const SkRect* de
vBounds, |
| 68 | 69 GrAppliedClip*); |
| 69 bool setupScissorClip(const GrPipelineBuilder& pipelineBuilder, | |
| 70 const SkIRect& scissor, | |
| 71 const SkRect* devBounds, | |
| 72 GrAppliedClip* out); | |
| 73 | 70 |
| 74 private: | 71 private: |
| 75 inline GrContext* getContext(); | 72 inline GrContext* getContext(); |
| 76 inline const GrCaps* caps() const; | 73 inline const GrCaps* caps() const; |
| 77 inline GrResourceProvider* resourceProvider(); | 74 inline GrResourceProvider* resourceProvider(); |
| 78 | 75 |
| 79 static bool PathNeedsSWRenderer(GrContext* context, | 76 static bool PathNeedsSWRenderer(GrContext* context, |
| 80 bool hasUserStencilSettings, | 77 bool hasUserStencilSettings, |
| 81 const GrRenderTarget* rt, | 78 const GrRenderTarget* rt, |
| 82 const SkMatrix& viewMatrix, | 79 const SkMatrix& viewMatrix, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 const GrRenderTarget* rt, | 140 const GrRenderTarget* rt, |
| 144 const SkVector& clipToMaskOffset, | 141 const SkVector& clipToMaskOffset, |
| 145 const GrReducedClip::ElementList& elements); | 142 const GrReducedClip::ElementList& elements); |
| 146 | 143 |
| 147 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); | 144 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); |
| 148 | 145 |
| 149 static const int kMaxAnalyticElements = 4; | 146 static const int kMaxAnalyticElements = 4; |
| 150 | 147 |
| 151 GrDrawTarget* fDrawTarget; // This is our owning draw target. | 148 GrDrawTarget* fDrawTarget; // This is our owning draw target. |
| 152 StencilClipMode fClipMode; | 149 StencilClipMode fClipMode; |
| 153 bool fDebugClipBatchToBounds; | |
| 154 | 150 |
| 155 typedef SkNoncopyable INHERITED; | 151 typedef SkNoncopyable INHERITED; |
| 156 }; | 152 }; |
| 157 #endif // GrClipMaskManager_DEFINED | 153 #endif // GrClipMaskManager_DEFINED |
| OLD | NEW |