Remove cached OptDrawState from GrDrawState.
Since we now snap and create the ODS one time in the inorder draw buffer,
there is no need for us to keep a cached version of it around.
BUG=skia:
Review URL: https://codereview.chromium.org/701123003
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index d300f2b..c82c5ad 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -109,8 +109,7 @@
//////////////////////////////////////////////////////////////////////////////s
-GrDrawState::GrDrawState(const GrDrawState& state, const SkMatrix& preConcatMatrix)
- : fCachedOptState(NULL) {
+GrDrawState::GrDrawState(const GrDrawState& state, const SkMatrix& preConcatMatrix) {
SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
*this = state;
if (!preConcatMatrix.isIdentity()) {
@@ -120,7 +119,6 @@
for (int i = 0; i < this->numCoverageStages(); ++i) {
fCoverageStages[i].localCoordChange(preConcatMatrix);
}
- this->invalidateOptState();
}
}
@@ -151,8 +149,6 @@
fHints = that.fHints;
- SkRefCnt_SafeAssign(fCachedOptState, that.fCachedOptState);
-
memcpy(fFixedFunctionVertexAttribIndices,
that.fFixedFunctionVertexAttribIndices,
sizeof(fFixedFunctionVertexAttribIndices));
@@ -186,8 +182,6 @@
fDrawFace = kBoth_DrawFace;
fHints = 0;
-
- this->invalidateOptState();
}
bool GrDrawState::setIdentityViewMatrix() {
@@ -204,7 +198,6 @@
fCoverageStages[s].localCoordChange(invVM);
}
}
- this->invalidateOptState();
fViewMatrix.reset();
return true;
}
@@ -244,7 +237,6 @@
this->setBlendFunc(paint.getSrcBlendCoeff(), paint.getDstBlendCoeff());
this->setCoverage(paint.getCoverage());
- this->invalidateOptState();
}
////////////////////////////////////////////////////////////////////////////////
@@ -342,7 +334,6 @@
overlapCheck |= (mask << offsetShift);
#endif
}
- this->invalidateOptState();
// Positions must be specified.
SkASSERT(-1 != fFixedFunctionVertexAttribIndices[kPosition_GrVertexAttribBinding]);
}
@@ -362,7 +353,6 @@
0xff,
sizeof(fFixedFunctionVertexAttribIndices));
fFixedFunctionVertexAttribIndices[kPosition_GrVertexAttribBinding] = 0;
- this->invalidateOptState();
}
////////////////////////////////////////////////////////////////////////////////
@@ -457,9 +447,6 @@
int n = fDrawState->numCoverageStages() - fCoverageEffectCnt;
SkASSERT(n >= 0);
fDrawState->fCoverageStages.pop_back_n(n);
- if (m + n > 0) {
- fDrawState->invalidateOptState();
- }
SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;)
}
fDrawState = ds;
@@ -513,7 +500,6 @@
for (int s = 0; s < numCoverageStages; ++s, ++i) {
fDrawState->fCoverageStages[s].restoreCoordChange(fSavedCoordChanges[i]);
}
- fDrawState->invalidateOptState();
fDrawState = NULL;
}
}
@@ -533,7 +519,6 @@
this->doEffectCoordChanges(preconcatMatrix);
SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;)
- drawState->invalidateOptState();
}
bool GrDrawState::AutoViewMatrixRestore::setIdentity(GrDrawState* drawState) {
@@ -547,7 +532,6 @@
return true;
}
- drawState->invalidateOptState();
fViewMatrix = drawState->getViewMatrix();
if (0 == drawState->numTotalStages()) {
drawState->fViewMatrix.reset();
@@ -604,14 +588,7 @@
////////////////////////////////////////////////////////////////////////////////
-void GrDrawState::invalidateOptState() const {
- SkSafeSetNull(fCachedOptState);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
GrDrawState::~GrDrawState() {
- SkSafeUnref(fCachedOptState);
SkASSERT(0 == fBlockEffectRemovalCnt);
}