| 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 #include "GrPaint.h" | 9 #include "GrPaint.h" |
| 10 #include "GrDrawTargetCaps.h" | 10 #include "GrDrawTargetCaps.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 for (int i = 0; i < this->numCoverageStages(); ++i) { | 60 for (int i = 0; i < this->numCoverageStages(); ++i) { |
| 61 fCoverageStages[i].localCoordChange(preConcatMatrix); | 61 fCoverageStages[i].localCoordChange(preConcatMatrix); |
| 62 } | 62 } |
| 63 this->invalidateBlendOptFlags(); | 63 this->invalidateBlendOptFlags(); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 GrDrawState& GrDrawState::operator=(const GrDrawState& that) { | 67 GrDrawState& GrDrawState::operator=(const GrDrawState& that) { |
| 68 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); | 68 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); |
| 69 this->setRenderTarget(that.fRenderTarget.get()); | 69 SkASSERT(!that.fRenderTarget.ownsPendingIO()); |
| 70 SkASSERT(!this->fRenderTarget.ownsPendingIO()); |
| 71 this->setRenderTarget(that.getRenderTarget()); |
| 70 fColor = that.fColor; | 72 fColor = that.fColor; |
| 71 fViewMatrix = that.fViewMatrix; | 73 fViewMatrix = that.fViewMatrix; |
| 72 fSrcBlend = that.fSrcBlend; | 74 fSrcBlend = that.fSrcBlend; |
| 73 fDstBlend = that.fDstBlend; | 75 fDstBlend = that.fDstBlend; |
| 74 fBlendConstant = that.fBlendConstant; | 76 fBlendConstant = that.fBlendConstant; |
| 75 fFlagBits = that.fFlagBits; | 77 fFlagBits = that.fFlagBits; |
| 76 fVACount = that.fVACount; | 78 fVACount = that.fVACount; |
| 77 fVAPtr = that.fVAPtr; | 79 fVAPtr = that.fVAPtr; |
| 78 fVAStride = that.fVAStride; | 80 fVAStride = that.fVAStride; |
| 79 fStencilSettings = that.fStencilSettings; | 81 fStencilSettings = that.fStencilSettings; |
| 80 fCoverage = that.fCoverage; | 82 fCoverage = that.fCoverage; |
| 81 fDrawFace = that.fDrawFace; | 83 fDrawFace = that.fDrawFace; |
| 82 fColorStages = that.fColorStages; | 84 fColorStages = that.fColorStages; |
| 83 fCoverageStages = that.fCoverageStages; | 85 fCoverageStages = that.fCoverageStages; |
| 84 fOptSrcBlend = that.fOptSrcBlend; | 86 fOptSrcBlend = that.fOptSrcBlend; |
| 85 fOptDstBlend = that.fOptDstBlend; | 87 fOptDstBlend = that.fOptDstBlend; |
| 86 fBlendOptFlags = that.fBlendOptFlags; | 88 fBlendOptFlags = that.fBlendOptFlags; |
| 87 | 89 |
| 88 fHints = that.fHints; | 90 fHints = that.fHints; |
| 89 | 91 |
| 90 memcpy(fFixedFunctionVertexAttribIndices, | 92 memcpy(fFixedFunctionVertexAttribIndices, |
| 91 that.fFixedFunctionVertexAttribIndices, | 93 that.fFixedFunctionVertexAttribIndices, |
| 92 sizeof(fFixedFunctionVertexAttribIndices)); | 94 sizeof(fFixedFunctionVertexAttribIndices)); |
| 93 return *this; | 95 return *this; |
| 94 } | 96 } |
| 95 | 97 |
| 96 void GrDrawState::onReset(const SkMatrix* initialViewMatrix) { | 98 void GrDrawState::onReset(const SkMatrix* initialViewMatrix) { |
| 97 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); | 99 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); |
| 100 SkASSERT(!fRenderTarget.ownsPendingIO()); |
| 101 |
| 98 fColorStages.reset(); | 102 fColorStages.reset(); |
| 99 fCoverageStages.reset(); | 103 fCoverageStages.reset(); |
| 100 | 104 |
| 101 fRenderTarget.reset(NULL); | 105 fRenderTarget.reset(); |
| 102 | 106 |
| 103 this->setDefaultVertexAttribs(); | 107 this->setDefaultVertexAttribs(); |
| 104 | 108 |
| 105 fColor = 0xffffffff; | 109 fColor = 0xffffffff; |
| 106 if (NULL == initialViewMatrix) { | 110 if (NULL == initialViewMatrix) { |
| 107 fViewMatrix.reset(); | 111 fViewMatrix.reset(); |
| 108 } else { | 112 } else { |
| 109 fViewMatrix = *initialViewMatrix; | 113 fViewMatrix = *initialViewMatrix; |
| 110 } | 114 } |
| 111 fSrcBlend = kOne_GrBlendCoeff; | 115 fSrcBlend = kOne_GrBlendCoeff; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 564 |
| 561 //////////////////////////////////////////////////////////////////////////////// | 565 //////////////////////////////////////////////////////////////////////////////// |
| 562 | 566 |
| 563 bool GrDrawState::canIgnoreColorAttribute() const { | 567 bool GrDrawState::canIgnoreColorAttribute() const { |
| 564 if (fBlendOptFlags & kInvalid_BlendOptFlag) { | 568 if (fBlendOptFlags & kInvalid_BlendOptFlag) { |
| 565 this->getBlendOpts(); | 569 this->getBlendOpts(); |
| 566 } | 570 } |
| 567 return SkToBool(fBlendOptFlags & (GrRODrawState::kEmitTransBlack_BlendOptFla
g | | 571 return SkToBool(fBlendOptFlags & (GrRODrawState::kEmitTransBlack_BlendOptFla
g | |
| 568 GrRODrawState::kEmitCoverage_BlendOptFlag)
); | 572 GrRODrawState::kEmitCoverage_BlendOptFlag)
); |
| 569 } | 573 } |
| 570 | |
| OLD | NEW |