Remove unnecessary dirty clip flag in GrGpu, remove getUsableStencilBits()
Review URL: http://codereview.appspot.com/4828050/
git-svn-id: http://skia.googlecode.com/svn/trunk@2011 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrDrawTarget.cpp b/gpu/src/GrDrawTarget.cpp
index f1f1136..ad066d8 100644
--- a/gpu/src/GrDrawTarget.cpp
+++ b/gpu/src/GrDrawTarget.cpp
@@ -792,6 +792,10 @@
}
return layout;
}
+
+void GrDrawTarget::clipWillBeSet(const GrClip& clip) {
+}
+
void GrDrawTarget::SetRectVertices(const GrRect& rect,
const GrMatrix* matrix,
const GrRect* srcRects[],
diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp
index 011d39d..c89dd4e 100644
--- a/gpu/src/GrGpu.cpp
+++ b/gpu/src/GrGpu.cpp
@@ -257,14 +257,6 @@
////////////////////////////////////////////////////////////////////////////////
-void GrGpu::clipWillBeSet(const GrClip& newClip) {
- if (newClip != fClip) {
- fClipState.fClipIsDirty = true;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
// stencil settings to use when clip is in stencil
const GrStencilSettings GrGpu::gClipStencilSettings = {
kKeep_StencilOp, kKeep_StencilOp,
@@ -402,13 +394,12 @@
}
r = &clipRect;
- fClipState.fClipInStencil = !fClip.isRect() &&
- !fClip.isEmpty() &&
- !bounds.isEmpty();
+ // use the stencil clip if we can't represent the clip as a rectangle.
+ fClipInStencil = !fClip.isRect() && !fClip.isEmpty() &&
+ !bounds.isEmpty();
- if (fClipState.fClipInStencil &&
- (fClipState.fClipIsDirty ||
- fClip != rt.fLastStencilClip)) {
+ if (fClipInStencil &&
+ fClip != rt.fLastStencilClip) {
rt.fLastStencilClip = fClip;
// we set the current clip to the bounds so that our recursive
@@ -533,12 +524,12 @@
}
}
}
+ // restore clip
fClip = clip;
- // recusive draws would have disabled this.
- fClipState.fClipInStencil = true;
+ // recusive draws would have disabled this since they drew with
+ // the clip bounds as clip.
+ fClipInStencil = true;
}
-
- fClipState.fClipIsDirty = false;
}
// Must flush the scissor after graphics state
diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp
index b8a0406..2498972 100644
--- a/gpu/src/GrGpuGL.cpp
+++ b/gpu/src/GrGpuGL.cpp
@@ -578,8 +578,7 @@
fHWDrawState.fStencilSettings.invalidate();
fHWStencilClip = false;
- fClipState.fClipIsDirty = true;
- fClipState.fClipInStencil = false;
+ fClipInStencil = false;
fHWGeometryState.fIndexBuffer = NULL;
fHWGeometryState.fVertexBuffer = NULL;
@@ -1761,7 +1760,7 @@
// use stencil for clipping if clipping is enabled and the clip
// has been written into the stencil.
- bool stencilClip = fClipState.fClipInStencil &&
+ bool stencilClip = fClipInStencil &&
(kClip_StateBit & fCurrDrawState.fFlagBits);
bool stencilChange = fHWStencilClip != stencilClip ||
fHWDrawState.fStencilSettings != *settings ||
diff --git a/gpu/src/GrInOrderDrawBuffer.cpp b/gpu/src/GrInOrderDrawBuffer.cpp
index b2aba4c..a8eb1f5 100644
--- a/gpu/src/GrInOrderDrawBuffer.cpp
+++ b/gpu/src/GrInOrderDrawBuffer.cpp
@@ -612,6 +612,7 @@
fClipSet = false;
}
-void GrInOrderDrawBuffer::clipWillBeSet(const GrClip& newClip) {
+void GrInOrderDrawBuffer::clipWillBeSet(const GrClip& newClip) {
+ INHERITED::clipWillBeSet(newClip);
fClipSet = true;
}