Revert 3503
git-svn-id: http://skia.googlecode.com/svn/trunk@3504 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 37cac0f..05f9a3f 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -509,10 +509,9 @@
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;
@@ -528,8 +527,7 @@
const Draw& draw = fDraws[i];
if (draw.fStateChanged) {
++currState;
- GrDrawState* ds = &GrDrawTarget::accessSavedDrawState(fStates[currState]);
- target->setDrawState(ds);
+ target->restoreDrawState(fStates[currState]);
}
if (draw.fClipChanged) {
++currClip;
@@ -559,8 +557,6 @@
target->clear(&fClears[currClear].fRect, fClears[currClear].fColor);
++currClear;
}
- target->setDrawState(prevDrawState);
- prevDrawState->unref();
}
void GrInOrderDrawBuffer::setAutoFlushTarget(GrDrawTarget* target) {
@@ -780,7 +776,7 @@
return true;
} else {
const GrDrawState& old = this->accessSavedDrawState(fStates.back());
- return old != this->getDrawState();
+ return old != fCurrDrawState;
}
}