Index: include/gpu/GrClip.h |
diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h |
index e58528114e873f2caa78f807337cdbb30d46b7e1..e7238841817c7417b05ee62b48c17bd4d3c9cb5a 100644 |
--- a/include/gpu/GrClip.h |
+++ b/include/gpu/GrClip.h |
@@ -8,11 +8,9 @@ |
#ifndef GrClip_DEFINED |
#define GrClip_DEFINED |
+#include "GrTypes.h" |
#include "GrFragmentProcessor.h" |
-#include "GrTypesPriv.h" |
-#include "SkClipStack.h" |
-class GrDrawContext; |
class GrPipelineBuilder; |
/** |
@@ -109,18 +107,27 @@ public: |
const SkRect* devBounds, GrAppliedClip*) const = 0; |
virtual ~GrClip() {} |
+ |
+ bool isWideOpen() const { return fIsWideOpen; } |
+ |
+protected: |
+ GrClip(bool isWideOpen) : fIsWideOpen(isWideOpen) {} |
+ bool fIsWideOpen; |
}; |
/** |
* Specialized implementation for no clip. |
*/ |
class GrNoClip final : public GrClip { |
+public: |
+ GrNoClip() : INHERITED(true) {} |
private: |
bool quickContains(const SkRect&) const final { return true; } |
void getConservativeBounds(int width, int height, SkIRect* devResult, |
bool* isIntersectionOfRects) const final; |
bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*, |
const SkRect*, GrAppliedClip*) const final { return true; } |
+ typedef GrClip INHERITED; |
}; |
/** |
@@ -129,19 +136,25 @@ private: |
*/ |
class GrFixedClip final : public GrClip { |
public: |
- GrFixedClip() : fDeviceBounds(SkRect::MakeLargest()), fHasStencilClip(false) {} |
- GrFixedClip(const SkIRect& scissorRect) |
- : fScissorState(scissorRect) |
- , fDeviceBounds(SkRect::Make(scissorRect)) |
- , fHasStencilClip(false) {} |
+ GrFixedClip() : INHERITED(true) { |
+ fDeviceBounds = SkRect::MakeLargest(); |
+ fHasStencilClip = false; |
+ } |
+ GrFixedClip(const SkIRect& scissorRect) : INHERITED(false) { |
+ fScissorState = scissorRect; |
+ fDeviceBounds = SkRect::Make(scissorRect); |
+ fHasStencilClip = false; |
+ } |
void reset() { |
+ fIsWideOpen = true; |
fScissorState.setDisabled(); |
fDeviceBounds.setLargest(); |
fHasStencilClip = false; |
} |
void reset(const SkIRect& scissorRect) { |
+ fIsWideOpen = false; |
fScissorState.set(scissorRect); |
fDeviceBounds = SkRect::Make(scissorRect); |
fHasStencilClip = false; |
@@ -152,6 +165,7 @@ public: |
* may pass. |
*/ |
void enableStencilClip(const SkRect& stencilBounds) { |
+ fIsWideOpen = false; |
fHasStencilClip = true; |
fDeviceBounds = stencilBounds; |
if (fScissorState.enabled()) { |
@@ -166,8 +180,10 @@ public: |
void disableStencilClip() { |
fHasStencilClip = false; |
if (fScissorState.enabled()) { |
+ fIsWideOpen = false; |
fDeviceBounds = SkRect::Make(fScissorState.rect()); |
} else { |
+ fIsWideOpen = true; |
fDeviceBounds.setLargest(); |
} |
} |
@@ -186,35 +202,7 @@ private: |
GrScissorState fScissorState; |
SkRect fDeviceBounds; |
bool fHasStencilClip; |
-}; |
- |
-/** |
- * GrClipStackClip can apply a generic SkClipStack to the draw state. It may generate clip masks or |
- * write to the stencil buffer during apply(). |
- */ |
-class GrClipStackClip final : public GrClip { |
-public: |
- GrClipStackClip(const SkClipStack* stack = nullptr, const SkIPoint* origin = nullptr) { |
- this->reset(stack, origin); |
- } |
- |
- void reset(const SkClipStack* stack = nullptr, const SkIPoint* origin = nullptr) { |
- fOrigin = origin ? *origin : SkIPoint::Make(0, 0); |
- fStack.reset(SkSafeRef(stack)); |
- } |
- |
- const SkIPoint& origin() const { return fOrigin; } |
- const SkClipStack* clipStack() const { return fStack; } |
- |
- bool quickContains(const SkRect&) const final; |
- void getConservativeBounds(int width, int height, SkIRect* devResult, |
- bool* isIntersectionOfRects) const final; |
- bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*, |
- const SkRect* devBounds, GrAppliedClip*) const final; |
- |
-private: |
- SkIPoint fOrigin; |
- SkAutoTUnref<const SkClipStack> fStack; |
+ typedef GrClip INHERITED; |
}; |
#endif |