Reland 3503 with fix
git-svn-id: http://skia.googlecode.com/svn/trunk@3506 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 05f9a3f..37cac0f 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -509,9 +509,10 @@
fVertexPool.unlock();
fIndexPool.unlock();
- GrDrawTarget::AutoStateRestore asr(target);
GrDrawTarget::AutoClipRestore acr(target);
AutoGeometryPush agp(target);
+ GrDrawState* prevDrawState = target->drawState();
+ prevDrawState->ref();
int currState = ~0;
int currClip = ~0;
@@ -527,7 +528,8 @@
const Draw& draw = fDraws[i];
if (draw.fStateChanged) {
++currState;
- target->restoreDrawState(fStates[currState]);
+ GrDrawState* ds = &GrDrawTarget::accessSavedDrawState(fStates[currState]);
+ target->setDrawState(ds);
}
if (draw.fClipChanged) {
++currClip;
@@ -557,6 +559,8 @@
target->clear(&fClears[currClear].fRect, fClears[currClear].fColor);
++currClear;
}
+ target->setDrawState(prevDrawState);
+ prevDrawState->unref();
}
void GrInOrderDrawBuffer::setAutoFlushTarget(GrDrawTarget* target) {
@@ -776,7 +780,7 @@
return true;
} else {
const GrDrawState& old = this->accessSavedDrawState(fStates.back());
- return old != fCurrDrawState;
+ return old != this->getDrawState();
}
}