| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 for (int i = 0; i < this->numCoverageStages(); ++i) { | 63 for (int i = 0; i < this->numCoverageStages(); ++i) { |
| 64 fCoverageStages[i].localCoordChange(preConcatMatrix); | 64 fCoverageStages[i].localCoordChange(preConcatMatrix); |
| 65 } | 65 } |
| 66 this->invalidateBlendOptFlags(); | 66 this->invalidateBlendOptFlags(); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 GrDrawState& GrDrawState::operator=(const GrDrawState& that) { | 70 GrDrawState& GrDrawState::operator=(const GrDrawState& that) { |
| 71 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); | 71 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); |
| 72 this->setRenderTarget(that.fRenderTarget.get()); | 72 SkASSERT(!that.fRenderTarget.ownsPendingIO()); |
| 73 SkASSERT(!this->fRenderTarget.ownsPendingIO()); |
| 74 this->setRenderTarget(that.getRenderTarget()); |
| 73 fColor = that.fColor; | 75 fColor = that.fColor; |
| 74 fViewMatrix = that.fViewMatrix; | 76 fViewMatrix = that.fViewMatrix; |
| 75 fSrcBlend = that.fSrcBlend; | 77 fSrcBlend = that.fSrcBlend; |
| 76 fDstBlend = that.fDstBlend; | 78 fDstBlend = that.fDstBlend; |
| 77 fBlendConstant = that.fBlendConstant; | 79 fBlendConstant = that.fBlendConstant; |
| 78 fFlagBits = that.fFlagBits; | 80 fFlagBits = that.fFlagBits; |
| 79 fVACount = that.fVACount; | 81 fVACount = that.fVACount; |
| 80 fVAPtr = that.fVAPtr; | 82 fVAPtr = that.fVAPtr; |
| 81 fVAStride = that.fVAStride; | 83 fVAStride = that.fVAStride; |
| 82 fStencilSettings = that.fStencilSettings; | 84 fStencilSettings = that.fStencilSettings; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 96 fHints = that.fHints; | 98 fHints = that.fHints; |
| 97 | 99 |
| 98 memcpy(fFixedFunctionVertexAttribIndices, | 100 memcpy(fFixedFunctionVertexAttribIndices, |
| 99 that.fFixedFunctionVertexAttribIndices, | 101 that.fFixedFunctionVertexAttribIndices, |
| 100 sizeof(fFixedFunctionVertexAttribIndices)); | 102 sizeof(fFixedFunctionVertexAttribIndices)); |
| 101 return *this; | 103 return *this; |
| 102 } | 104 } |
| 103 | 105 |
| 104 void GrDrawState::onReset(const SkMatrix* initialViewMatrix) { | 106 void GrDrawState::onReset(const SkMatrix* initialViewMatrix) { |
| 105 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); | 107 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); |
| 108 SkASSERT(!fRenderTarget.ownsPendingIO()); |
| 109 |
| 106 fGeometryProcessor.reset(NULL); | 110 fGeometryProcessor.reset(NULL); |
| 107 fColorStages.reset(); | 111 fColorStages.reset(); |
| 108 fCoverageStages.reset(); | 112 fCoverageStages.reset(); |
| 109 | 113 |
| 110 fRenderTarget.reset(NULL); | 114 fRenderTarget.reset(); |
| 111 | 115 |
| 112 this->setDefaultVertexAttribs(); | 116 this->setDefaultVertexAttribs(); |
| 113 | 117 |
| 114 fColor = 0xffffffff; | 118 fColor = 0xffffffff; |
| 115 if (NULL == initialViewMatrix) { | 119 if (NULL == initialViewMatrix) { |
| 116 fViewMatrix.reset(); | 120 fViewMatrix.reset(); |
| 117 } else { | 121 } else { |
| 118 fViewMatrix = *initialViewMatrix; | 122 fViewMatrix = *initialViewMatrix; |
| 119 } | 123 } |
| 120 fSrcBlend = kOne_GrBlendCoeff; | 124 fSrcBlend = kOne_GrBlendCoeff; |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 606 |
| 603 //////////////////////////////////////////////////////////////////////////////// | 607 //////////////////////////////////////////////////////////////////////////////// |
| 604 | 608 |
| 605 bool GrDrawState::canIgnoreColorAttribute() const { | 609 bool GrDrawState::canIgnoreColorAttribute() const { |
| 606 if (fBlendOptFlags & kInvalid_BlendOptFlag) { | 610 if (fBlendOptFlags & kInvalid_BlendOptFlag) { |
| 607 this->getBlendOpts(); | 611 this->getBlendOpts(); |
| 608 } | 612 } |
| 609 return SkToBool(fBlendOptFlags & (GrRODrawState::kEmitTransBlack_BlendOptFla
g | | 613 return SkToBool(fBlendOptFlags & (GrRODrawState::kEmitTransBlack_BlendOptFla
g | |
| 610 GrRODrawState::kEmitCoverage_BlendOptFlag)
); | 614 GrRODrawState::kEmitCoverage_BlendOptFlag)
); |
| 611 } | 615 } |
| 612 | |
| OLD | NEW |