Index: src/gpu/GrDrawState.cpp |
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp |
index 643253efc0e05c1f77ca4a3252ff27fe772ad8cf..67a356a1fa46c70c92194467adc64e01b0368760 100644 |
--- a/src/gpu/GrDrawState.cpp |
+++ b/src/gpu/GrDrawState.cpp |
@@ -211,93 +211,6 @@ bool GrDrawState::canTweakAlphaForCoverage() const { |
//////////////////////////////////////////////////////////////////////////////// |
-void GrDrawState::AutoViewMatrixRestore::restore() { |
- if (fDrawState) { |
- SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) |
- fDrawState->fViewMatrix = fViewMatrix; |
- SkASSERT(fDrawState->numColorStages() >= fNumColorStages); |
- int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages; |
- SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages); |
- |
- int i = 0; |
- for (int s = 0; s < fNumColorStages; ++s, ++i) { |
- fDrawState->fColorStages[s].restoreCoordChange(fSavedCoordChanges[i]); |
- } |
- for (int s = 0; s < numCoverageStages; ++s, ++i) { |
- fDrawState->fCoverageStages[s].restoreCoordChange(fSavedCoordChanges[i]); |
- } |
- fDrawState = NULL; |
- } |
-} |
- |
-void GrDrawState::AutoViewMatrixRestore::set(GrDrawState* drawState, |
- const SkMatrix& preconcatMatrix) { |
- this->restore(); |
- |
- SkASSERT(NULL == fDrawState); |
- if (NULL == drawState || preconcatMatrix.isIdentity()) { |
- return; |
- } |
- fDrawState = drawState; |
- |
- fViewMatrix = drawState->getViewMatrix(); |
- drawState->fViewMatrix.preConcat(preconcatMatrix); |
- |
- this->doEffectCoordChanges(preconcatMatrix); |
- SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;) |
-} |
- |
-bool GrDrawState::AutoViewMatrixRestore::setIdentity(GrDrawState* drawState) { |
- this->restore(); |
- |
- if (NULL == drawState) { |
- return false; |
- } |
- |
- if (drawState->getViewMatrix().isIdentity()) { |
- return true; |
- } |
- |
- fViewMatrix = drawState->getViewMatrix(); |
- if (0 == drawState->numFragmentStages()) { |
- drawState->fViewMatrix.reset(); |
- fDrawState = drawState; |
- fNumColorStages = 0; |
- fSavedCoordChanges.reset(0); |
- SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;) |
- return true; |
- } else { |
- SkMatrix inv; |
- if (!fViewMatrix.invert(&inv)) { |
- return false; |
- } |
- drawState->fViewMatrix.reset(); |
- fDrawState = drawState; |
- this->doEffectCoordChanges(inv); |
- SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;) |
- return true; |
- } |
-} |
- |
-void GrDrawState::AutoViewMatrixRestore::doEffectCoordChanges(const SkMatrix& coordChangeMatrix) { |
- fSavedCoordChanges.reset(fDrawState->numFragmentStages()); |
- int i = 0; |
- |
- fNumColorStages = fDrawState->numColorStages(); |
- for (int s = 0; s < fNumColorStages; ++s, ++i) { |
- fDrawState->getColorStage(s).saveCoordChange(&fSavedCoordChanges[i]); |
- fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); |
- } |
- |
- int numCoverageStages = fDrawState->numCoverageStages(); |
- for (int s = 0; s < numCoverageStages; ++s, ++i) { |
- fDrawState->getCoverageStage(s).saveCoordChange(&fSavedCoordChanges[i]); |
- fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); |
- } |
-} |
- |
-//////////////////////////////////////////////////////////////////////////////// |
- |
GrDrawState::~GrDrawState() { |
SkASSERT(0 == fBlockEffectRemovalCnt); |
} |