Revert 3503
git-svn-id: http://skia.googlecode.com/svn/trunk@3504 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 5cce435..6d52c2a 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -474,9 +474,6 @@
#if GR_DEBUG
VertexLayoutUnitTest();
#endif
- fDrawState = &fDefaultDrawState;
- // We assume that fDrawState always owns a ref to the object it points at.
- fDefaultDrawState.ref();
GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back();
#if GR_DEBUG
geoSrc.fVertexCount = DEBUG_INVAL_START_IDX;
@@ -493,7 +490,6 @@
GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
GrAssert(kNone_GeometrySrcType == geoSrc.fIndexSrc);
GrAssert(kNone_GeometrySrcType == geoSrc.fVertexSrc);
- fDrawState->unref();
}
void GrDrawTarget::releaseGeometry() {
@@ -515,28 +511,16 @@
return fClip;
}
-void GrDrawTarget::setDrawState(GrDrawState* drawState) {
- GrAssert(NULL != fDrawState);
- if (NULL == drawState) {
- drawState = &fDefaultDrawState;
- }
- if (fDrawState != drawState) {
- fDrawState->unref();
- drawState->ref();
- fDrawState = drawState;
- }
-}
-
void GrDrawTarget::saveCurrentDrawState(SavedDrawState* state) const {
- state->fState.set(this->getDrawState());
+ state->fState.set(fCurrDrawState);
}
void GrDrawTarget::restoreDrawState(const SavedDrawState& state) {
- *fDrawState = *state.fState.get();
+ fCurrDrawState = *state.fState.get();
}
void GrDrawTarget::copyDrawState(const GrDrawTarget& srcTarget) {
- *fDrawState = srcTarget.getDrawState();
+ fCurrDrawState = srcTarget.fCurrDrawState;
}
bool GrDrawTarget::reserveVertexSpace(GrVertexLayout vertexLayout,
@@ -871,7 +855,7 @@
}
// Check if a color stage could create a partial alpha
for (int s = 0; s < drawState.getFirstCoverageStage(); ++s) {
- if (StageWillBeUsed(s, layout, this->getDrawState())) {
+ if (StageWillBeUsed(s, layout, fCurrDrawState)) {
GrAssert(NULL != drawState.getTexture(s));
GrPixelConfig config = drawState.getTexture(s)->config();
if (!GrPixelConfigIsOpaque(config)) {
@@ -948,7 +932,7 @@
for (int s = drawState.getFirstCoverageStage();
!hasCoverage && s < GrDrawState::kNumStages;
++s) {
- if (StageWillBeUsed(s, layout, this->getDrawState())) {
+ if (StageWillBeUsed(s, layout, fCurrDrawState)) {
hasCoverage = true;
}
}