Index: src/gpu/GrClipMaskManager.h |
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h |
index 096dafd2e575ab743c40d3b7adc50eeb7b227a6f..ef0c2be040ce4cd97a5ecc56404c7bd55c5b7467 100644 |
--- a/src/gpu/GrClipMaskManager.h |
+++ b/src/gpu/GrClipMaskManager.h |
@@ -9,6 +9,7 @@ |
#include "GrPipelineBuilder.h" |
#include "GrReducedClip.h" |
+#include "GrStencil.h" |
#include "GrTexture.h" |
#include "SkClipStack.h" |
#include "SkDeque.h" |
@@ -32,15 +33,13 @@ |
*/ |
class GrAppliedClip : public SkNoncopyable { |
public: |
- GrAppliedClip() : fHasStencilClip(false) {} |
+ GrAppliedClip() {} |
const GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fClipCoverageFP; } |
const GrScissorState& scissorState() const { return fScissorState; } |
- bool hasStencilClip() const { return fHasStencilClip; } |
private: |
SkAutoTUnref<const GrFragmentProcessor> fClipCoverageFP; |
GrScissorState fScissorState; |
- bool fHasStencilClip; |
friend class GrClipMaskManager; |
typedef SkNoncopyable INHERITED; |
@@ -61,15 +60,22 @@ |
/** |
* Creates a clip mask if necessary as a stencil buffer or alpha texture |
* and sets the GrGpu's scissor and stencil state. If the return is false |
- * then the draw can be skipped. devBounds is optional but can help optimize |
- * clipping. |
+ * then the draw can be skipped. The AutoRestoreEffects is initialized by |
+ * the manager when it must install additional effects to implement the |
+ * clip. devBounds is optional but can help optimize clipping. |
*/ |
- bool setupClipping(const GrPipelineBuilder&, const SkRect* devBounds, GrAppliedClip*); |
+ bool setupClipping(const GrPipelineBuilder&, |
+ GrPipelineBuilder::AutoRestoreStencil*, |
+ const SkRect* devBounds, |
+ GrAppliedClip*); |
bool setupScissorClip(const GrPipelineBuilder& pipelineBuilder, |
+ GrPipelineBuilder::AutoRestoreStencil* ars, |
const SkIRect& scissor, |
const SkRect* devBounds, |
GrAppliedClip* out); |
+ |
+ void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*); |
private: |
inline GrContext* getContext(); |
@@ -77,7 +83,7 @@ |
inline GrResourceProvider* resourceProvider(); |
static bool PathNeedsSWRenderer(GrContext* context, |
- bool hasUserStencilSettings, |
+ bool isStencilDisabled, |
const GrRenderTarget* rt, |
const SkMatrix& viewMatrix, |
const SkClipStack::Element* element, |
@@ -144,6 +150,21 @@ |
const SkVector& clipToMaskOffset, |
const GrReducedClip::ElementList& elements); |
+ /** |
+ * Called prior to return control back the GrGpu in setupClipping. It updates the |
+ * GrPipelineBuilder with stencil settings that account for stencil-based clipping. |
+ */ |
+ void setPipelineBuilderStencil(const GrPipelineBuilder&, |
+ GrPipelineBuilder::AutoRestoreStencil*); |
+ |
+ /** |
+ * Adjusts the stencil settings to account for interaction with stencil |
+ * clipping. |
+ */ |
+ void adjustStencilParams(GrStencilSettings* settings, |
+ StencilClipMode mode, |
+ int stencilBitCnt); |
+ |
GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, bool renderTarget); |
static const int kMaxAnalyticElements = 4; |