Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2006)

Unified Diff: src/gpu/GrDrawState.cpp

Issue 818233002: Remove coordchanges from drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@coord-change-off-paint
Patch Set: adding test to ignore Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698