| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright 2012 Google Inc. |    2  * Copyright 2012 Google Inc. | 
|    3  * |    3  * | 
|    4  * Use of this source code is governed by a BSD-style license that can be |    4  * Use of this source code is governed by a BSD-style license that can be | 
|    5  * found in the LICENSE file. |    5  * found in the LICENSE file. | 
|    6  */ |    6  */ | 
|    7  |    7  | 
|    8 #include "GrDrawState.h" |    8 #include "GrDrawState.h" | 
|    9  |    9  | 
|   10 #include "GrOptDrawState.h" |   10 #include "GrOptDrawState.h" | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  101     fDstBlend = that.fDstBlend; |  101     fDstBlend = that.fDstBlend; | 
|  102     fBlendConstant = that.fBlendConstant; |  102     fBlendConstant = that.fBlendConstant; | 
|  103     fFlagBits = that.fFlagBits; |  103     fFlagBits = that.fFlagBits; | 
|  104     fVACount = that.fVACount; |  104     fVACount = that.fVACount; | 
|  105     fVAPtr = that.fVAPtr; |  105     fVAPtr = that.fVAPtr; | 
|  106     fVAStride = that.fVAStride; |  106     fVAStride = that.fVAStride; | 
|  107     fStencilSettings = that.fStencilSettings; |  107     fStencilSettings = that.fStencilSettings; | 
|  108     fCoverage = that.fCoverage; |  108     fCoverage = that.fCoverage; | 
|  109     fDrawFace = that.fDrawFace; |  109     fDrawFace = that.fDrawFace; | 
|  110     if (that.hasGeometryProcessor()) { |  110     if (that.hasGeometryProcessor()) { | 
|  111         fGeometryProcessor.reset(SkNEW_ARGS(GrEffectStage, (*that.fGeometryProce
     ssor.get()))); |  111         fGeometryProcessor.reset(SkNEW_ARGS(GrGeometryStage, (*that.fGeometryPro
     cessor.get()))); | 
|  112     } else { |  112     } else { | 
|  113         fGeometryProcessor.reset(NULL); |  113         fGeometryProcessor.reset(NULL); | 
|  114     } |  114     } | 
|  115     fColorStages = that.fColorStages; |  115     fColorStages = that.fColorStages; | 
|  116     fCoverageStages = that.fCoverageStages; |  116     fCoverageStages = that.fCoverageStages; | 
|  117  |  117  | 
|  118     fHints = that.fHints; |  118     fHints = that.fHints; | 
|  119  |  119  | 
|  120     SkRefCnt_SafeAssign(fCachedOptState, that.fCachedOptState); |  120     SkRefCnt_SafeAssign(fCachedOptState, that.fCachedOptState); | 
|  121  |  121  | 
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  322 } |  322 } | 
|  323  |  323  | 
|  324 //////////////////////////////////////////////////////////////////////////////s |  324 //////////////////////////////////////////////////////////////////////////////s | 
|  325  |  325  | 
|  326 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { |  326 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { | 
|  327     if (fDrawState) { |  327     if (fDrawState) { | 
|  328         // See the big comment on the class definition about GPs. |  328         // See the big comment on the class definition about GPs. | 
|  329         if (SK_InvalidUniqueID == fOriginalGPID) { |  329         if (SK_InvalidUniqueID == fOriginalGPID) { | 
|  330             fDrawState->fGeometryProcessor.reset(NULL); |  330             fDrawState->fGeometryProcessor.reset(NULL); | 
|  331         } else { |  331         } else { | 
|  332             SkASSERT(fDrawState->getGeometryProcessor()->getEffect()->getUniqueI
     D() == |  332             SkASSERT(fDrawState->getGeometryProcessor()->getProcessor()->getUniq
     ueID() == | 
|  333                      fOriginalGPID); |  333                      fOriginalGPID); | 
|  334             fOriginalGPID = SK_InvalidUniqueID; |  334             fOriginalGPID = SK_InvalidUniqueID; | 
|  335         } |  335         } | 
|  336  |  336  | 
|  337         int m = fDrawState->numColorStages() - fColorEffectCnt; |  337         int m = fDrawState->numColorStages() - fColorEffectCnt; | 
|  338         SkASSERT(m >= 0); |  338         SkASSERT(m >= 0); | 
|  339         fDrawState->fColorStages.pop_back_n(m); |  339         fDrawState->fColorStages.pop_back_n(m); | 
|  340  |  340  | 
|  341         int n = fDrawState->numCoverageStages() - fCoverageEffectCnt; |  341         int n = fDrawState->numCoverageStages() - fCoverageEffectCnt; | 
|  342         SkASSERT(n >= 0); |  342         SkASSERT(n >= 0); | 
|  343         fDrawState->fCoverageStages.pop_back_n(n); |  343         fDrawState->fCoverageStages.pop_back_n(n); | 
|  344         if (m + n > 0) { |  344         if (m + n > 0) { | 
|  345             fDrawState->invalidateOptState(); |  345             fDrawState->invalidateOptState(); | 
|  346         } |  346         } | 
|  347         SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) |  347         SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) | 
|  348     } |  348     } | 
|  349     fDrawState = ds; |  349     fDrawState = ds; | 
|  350     if (NULL != ds) { |  350     if (NULL != ds) { | 
|  351         SkASSERT(SK_InvalidUniqueID == fOriginalGPID); |  351         SkASSERT(SK_InvalidUniqueID == fOriginalGPID); | 
|  352         if (NULL != ds->getGeometryProcessor()) { |  352         if (NULL != ds->getGeometryProcessor()) { | 
|  353             fOriginalGPID = ds->getGeometryProcessor()->getEffect()->getUniqueID
     (); |  353             fOriginalGPID = ds->getGeometryProcessor()->getProcessor()->getUniqu
     eID(); | 
|  354         } |  354         } | 
|  355         fColorEffectCnt = ds->numColorStages(); |  355         fColorEffectCnt = ds->numColorStages(); | 
|  356         fCoverageEffectCnt = ds->numCoverageStages(); |  356         fCoverageEffectCnt = ds->numCoverageStages(); | 
|  357         SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;) |  357         SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;) | 
|  358     } |  358     } | 
|  359 } |  359 } | 
|  360  |  360  | 
|  361 //////////////////////////////////////////////////////////////////////////////// |  361 //////////////////////////////////////////////////////////////////////////////// | 
|  362  |  362  | 
|  363 void GrDrawState::AutoViewMatrixRestore::restore() { |  363 void GrDrawState::AutoViewMatrixRestore::restore() { | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  466     SkSafeSetNull(fCachedOptState); |  466     SkSafeSetNull(fCachedOptState); | 
|  467 } |  467 } | 
|  468  |  468  | 
|  469 //////////////////////////////////////////////////////////////////////////////// |  469 //////////////////////////////////////////////////////////////////////////////// | 
|  470  |  470  | 
|  471 GrDrawState::~GrDrawState() { |  471 GrDrawState::~GrDrawState() { | 
|  472     SkSafeUnref(fCachedOptState); |  472     SkSafeUnref(fCachedOptState); | 
|  473     SkASSERT(0 == fBlockEffectRemovalCnt); |  473     SkASSERT(0 == fBlockEffectRemovalCnt); | 
|  474 } |  474 } | 
|  475  |  475  | 
| OLD | NEW |