| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); | 37 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); |
| 38 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { | 38 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { |
| 39 return false; | 39 return false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool explicitLocalCoords = this->hasLocalCoordAttribute(); | 42 bool explicitLocalCoords = this->hasLocalCoordAttribute(); |
| 43 if (this->hasGeometryProcessor()) { | 43 if (this->hasGeometryProcessor()) { |
| 44 if (!that.hasGeometryProcessor()) { | 44 if (!that.hasGeometryProcessor()) { |
| 45 return false; | 45 return false; |
| 46 } else if (!GrProcessorStage::AreCompatible(*this->getGeometryProcessor(
), | 46 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { |
| 47 *that.getGeometryProcessor()
, | |
| 48 explicitLocalCoords)) { | |
| 49 return false; | 47 return false; |
| 50 } | 48 } |
| 51 } else if (that.hasGeometryProcessor()) { | 49 } else if (that.hasGeometryProcessor()) { |
| 52 return false; | 50 return false; |
| 53 } | 51 } |
| 54 | 52 |
| 55 for (int i = 0; i < this->numColorStages(); i++) { | 53 for (int i = 0; i < this->numColorStages(); i++) { |
| 56 if (!GrProcessorStage::AreCompatible(this->getColorStage(i), that.getCol
orStage(i), | 54 if (!GrFragmentStage::AreCompatible(this->getColorStage(i), that.getColo
rStage(i), |
| 57 explicitLocalCoords)) { | 55 explicitLocalCoords)) { |
| 58 return false; | 56 return false; |
| 59 } | 57 } |
| 60 } | 58 } |
| 61 for (int i = 0; i < this->numCoverageStages(); i++) { | 59 for (int i = 0; i < this->numCoverageStages(); i++) { |
| 62 if (!GrProcessorStage::AreCompatible(this->getCoverageStage(i), that.get
CoverageStage(i), | 60 if (!GrFragmentStage::AreCompatible(this->getCoverageStage(i), that.getC
overageStage(i), |
| 63 explicitLocalCoords)) { | 61 explicitLocalCoords)) { |
| 64 return false; | 62 return false; |
| 65 } | 63 } |
| 66 } | 64 } |
| 67 | 65 |
| 68 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 66 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
| 69 that.fFixedFunctionVertexAttribIndices, | 67 that.fFixedFunctionVertexAttribIndices, |
| 70 sizeof(this->fFixedFunctionVertexAttribIndices))); | 68 sizeof(this->fFixedFunctionVertexAttribIndices))); |
| 71 | 69 |
| 72 return true; | 70 return true; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 return kAOrB_CombinedState; | 107 return kAOrB_CombinedState; |
| 110 } | 108 } |
| 111 | 109 |
| 112 //////////////////////////////////////////////////////////////////////////////s | 110 //////////////////////////////////////////////////////////////////////////////s |
| 113 | 111 |
| 114 GrDrawState::GrDrawState(const GrDrawState& state, const SkMatrix& preConcatMatr
ix) | 112 GrDrawState::GrDrawState(const GrDrawState& state, const SkMatrix& preConcatMatr
ix) |
| 115 : fCachedOptState(NULL) { | 113 : fCachedOptState(NULL) { |
| 116 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 114 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
| 117 *this = state; | 115 *this = state; |
| 118 if (!preConcatMatrix.isIdentity()) { | 116 if (!preConcatMatrix.isIdentity()) { |
| 119 if (this->hasGeometryProcessor()) { | |
| 120 fGeometryProcessor->localCoordChange(preConcatMatrix); | |
| 121 } | |
| 122 for (int i = 0; i < this->numColorStages(); ++i) { | 117 for (int i = 0; i < this->numColorStages(); ++i) { |
| 123 fColorStages[i].localCoordChange(preConcatMatrix); | 118 fColorStages[i].localCoordChange(preConcatMatrix); |
| 124 } | 119 } |
| 125 for (int i = 0; i < this->numCoverageStages(); ++i) { | 120 for (int i = 0; i < this->numCoverageStages(); ++i) { |
| 126 fCoverageStages[i].localCoordChange(preConcatMatrix); | 121 fCoverageStages[i].localCoordChange(preConcatMatrix); |
| 127 } | 122 } |
| 128 this->invalidateOptState(); | 123 this->invalidateOptState(); |
| 129 } | 124 } |
| 130 } | 125 } |
| 131 | 126 |
| 132 GrDrawState& GrDrawState::operator=(const GrDrawState& that) { | 127 GrDrawState& GrDrawState::operator=(const GrDrawState& that) { |
| 133 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); | 128 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); |
| 134 SkASSERT(!that.fRenderTarget.ownsPendingIO()); | 129 SkASSERT(!that.fRenderTarget.ownsPendingIO()); |
| 135 SkASSERT(!this->fRenderTarget.ownsPendingIO()); | 130 SkASSERT(!this->fRenderTarget.ownsPendingIO()); |
| 136 this->setRenderTarget(that.getRenderTarget()); | 131 this->setRenderTarget(that.getRenderTarget()); |
| 137 fColor = that.fColor; | 132 fColor = that.fColor; |
| 138 fViewMatrix = that.fViewMatrix; | 133 fViewMatrix = that.fViewMatrix; |
| 139 fSrcBlend = that.fSrcBlend; | 134 fSrcBlend = that.fSrcBlend; |
| 140 fDstBlend = that.fDstBlend; | 135 fDstBlend = that.fDstBlend; |
| 141 fBlendConstant = that.fBlendConstant; | 136 fBlendConstant = that.fBlendConstant; |
| 142 fFlagBits = that.fFlagBits; | 137 fFlagBits = that.fFlagBits; |
| 143 fVACount = that.fVACount; | 138 fVACount = that.fVACount; |
| 144 fVAPtr = that.fVAPtr; | 139 fVAPtr = that.fVAPtr; |
| 145 fVAStride = that.fVAStride; | 140 fVAStride = that.fVAStride; |
| 146 fStencilSettings = that.fStencilSettings; | 141 fStencilSettings = that.fStencilSettings; |
| 147 fCoverage = that.fCoverage; | 142 fCoverage = that.fCoverage; |
| 148 fDrawFace = that.fDrawFace; | 143 fDrawFace = that.fDrawFace; |
| 149 if (that.hasGeometryProcessor()) { | 144 if (that.hasGeometryProcessor()) { |
| 150 fGeometryProcessor.reset(SkNEW_ARGS(GrGeometryStage, (*that.fGeometryPro
cessor.get()))); | 145 fGeometryProcessor.initAndRef(that.fGeometryProcessor); |
| 151 } else { | 146 } else { |
| 152 fGeometryProcessor.reset(NULL); | 147 fGeometryProcessor.reset(NULL); |
| 153 } | 148 } |
| 154 fColorStages = that.fColorStages; | 149 fColorStages = that.fColorStages; |
| 155 fCoverageStages = that.fCoverageStages; | 150 fCoverageStages = that.fCoverageStages; |
| 156 | 151 |
| 157 fHints = that.fHints; | 152 fHints = that.fHints; |
| 158 | 153 |
| 159 SkRefCnt_SafeAssign(fCachedOptState, that.fCachedOptState); | 154 SkRefCnt_SafeAssign(fCachedOptState, that.fCachedOptState); |
| 160 | 155 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 this->invalidateOptState(); | 190 this->invalidateOptState(); |
| 196 } | 191 } |
| 197 | 192 |
| 198 bool GrDrawState::setIdentityViewMatrix() { | 193 bool GrDrawState::setIdentityViewMatrix() { |
| 199 if (this->numTotalStages()) { | 194 if (this->numTotalStages()) { |
| 200 SkMatrix invVM; | 195 SkMatrix invVM; |
| 201 if (!fViewMatrix.invert(&invVM)) { | 196 if (!fViewMatrix.invert(&invVM)) { |
| 202 // sad trombone sound | 197 // sad trombone sound |
| 203 return false; | 198 return false; |
| 204 } | 199 } |
| 205 if (this->hasGeometryProcessor()) { | |
| 206 fGeometryProcessor->localCoordChange(invVM); | |
| 207 } | |
| 208 for (int s = 0; s < this->numColorStages(); ++s) { | 200 for (int s = 0; s < this->numColorStages(); ++s) { |
| 209 fColorStages[s].localCoordChange(invVM); | 201 fColorStages[s].localCoordChange(invVM); |
| 210 } | 202 } |
| 211 for (int s = 0; s < this->numCoverageStages(); ++s) { | 203 for (int s = 0; s < this->numCoverageStages(); ++s) { |
| 212 fCoverageStages[s].localCoordChange(invVM); | 204 fCoverageStages[s].localCoordChange(invVM); |
| 213 } | 205 } |
| 214 } | 206 } |
| 215 this->invalidateOptState(); | 207 this->invalidateOptState(); |
| 216 fViewMatrix.reset(); | 208 fViewMatrix.reset(); |
| 217 return true; | 209 return true; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 //////////////////////////////////////////////////////////////////////////////// | 250 //////////////////////////////////////////////////////////////////////////////// |
| 259 | 251 |
| 260 bool GrDrawState::validateVertexAttribs() const { | 252 bool GrDrawState::validateVertexAttribs() const { |
| 261 // check consistency of effects and attributes | 253 // check consistency of effects and attributes |
| 262 GrSLType slTypes[kMaxVertexAttribCnt]; | 254 GrSLType slTypes[kMaxVertexAttribCnt]; |
| 263 for (int i = 0; i < kMaxVertexAttribCnt; ++i) { | 255 for (int i = 0; i < kMaxVertexAttribCnt; ++i) { |
| 264 slTypes[i] = static_cast<GrSLType>(-1); | 256 slTypes[i] = static_cast<GrSLType>(-1); |
| 265 } | 257 } |
| 266 | 258 |
| 267 if (this->hasGeometryProcessor()) { | 259 if (this->hasGeometryProcessor()) { |
| 268 const GrGeometryStage& stage = *this->getGeometryProcessor(); | 260 const GrGeometryProcessor* gp = this->getGeometryProcessor(); |
| 269 const GrGeometryProcessor* gp = stage.getProcessor(); | |
| 270 SkASSERT(gp); | |
| 271 // make sure that any attribute indices have the correct binding type, t
hat the attrib | 261 // make sure that any attribute indices have the correct binding type, t
hat the attrib |
| 272 // type and effect's shader lang type are compatible, and that attribute
s shared by | 262 // type and effect's shader lang type are compatible, and that attribute
s shared by |
| 273 // multiple effects use the same shader lang type. | 263 // multiple effects use the same shader lang type. |
| 274 const GrGeometryProcessor::VertexAttribArray& s = gp->getVertexAttribs()
; | 264 const GrGeometryProcessor::VertexAttribArray& s = gp->getVertexAttribs()
; |
| 275 | 265 |
| 276 int effectIndex = 0; | 266 int effectIndex = 0; |
| 277 for (int index = 0; index < fVACount; index++) { | 267 for (int index = 0; index < fVACount; index++) { |
| 278 if (kGeometryProcessor_GrVertexAttribBinding != fVAPtr[index].fBindi
ng) { | 268 if (kGeometryProcessor_GrVertexAttribBinding != fVAPtr[index].fBindi
ng) { |
| 279 // we only care about effect bindings | 269 // we only care about effect bindings |
| 280 continue; | 270 continue; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // Initialize to an unknown starting coverage if per-vertex coverage is spec
ified. | 393 // Initialize to an unknown starting coverage if per-vertex coverage is spec
ified. |
| 404 if (this->hasCoverageVertexAttribute()) { | 394 if (this->hasCoverageVertexAttribute()) { |
| 405 inout.fValidFlags = 0; | 395 inout.fValidFlags = 0; |
| 406 } else { | 396 } else { |
| 407 inout.fColor = this->getCoverageColor(); | 397 inout.fColor = this->getCoverageColor(); |
| 408 inout.fValidFlags = kRGBA_GrColorComponentFlags; | 398 inout.fValidFlags = kRGBA_GrColorComponentFlags; |
| 409 } | 399 } |
| 410 | 400 |
| 411 // Run through the coverage stages and see if the coverage will be all ones
at the end. | 401 // Run through the coverage stages and see if the coverage will be all ones
at the end. |
| 412 if (this->hasGeometryProcessor()) { | 402 if (this->hasGeometryProcessor()) { |
| 413 const GrGeometryProcessor* gp = fGeometryProcessor->getProcessor(); | 403 fGeometryProcessor->computeInvariantOutput(&inout); |
| 414 gp->computeInvariantOutput(&inout); | |
| 415 } | 404 } |
| 416 | 405 |
| 417 for (int s = 0; s < this->numCoverageStages(); ++s) { | 406 for (int s = 0; s < this->numCoverageStages(); ++s) { |
| 418 const GrProcessor* processor = this->getCoverageStage(s).getProcessor(); | 407 const GrProcessor* processor = this->getCoverageStage(s).getProcessor(); |
| 419 processor->computeInvariantOutput(&inout); | 408 processor->computeInvariantOutput(&inout); |
| 420 } | 409 } |
| 421 return inout.isSolidWhite(); | 410 return inout.isSolidWhite(); |
| 422 } | 411 } |
| 423 | 412 |
| 424 ////////////////////////////////////////////////////////////////////////////// | 413 ////////////////////////////////////////////////////////////////////////////// |
| (...skipping 24 matching lines...) Expand all Loading... |
| 449 } | 438 } |
| 450 return false; | 439 return false; |
| 451 } | 440 } |
| 452 | 441 |
| 453 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { | 442 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { |
| 454 if (fDrawState) { | 443 if (fDrawState) { |
| 455 // See the big comment on the class definition about GPs. | 444 // See the big comment on the class definition about GPs. |
| 456 if (SK_InvalidUniqueID == fOriginalGPID) { | 445 if (SK_InvalidUniqueID == fOriginalGPID) { |
| 457 fDrawState->fGeometryProcessor.reset(NULL); | 446 fDrawState->fGeometryProcessor.reset(NULL); |
| 458 } else { | 447 } else { |
| 459 SkASSERT(fDrawState->getGeometryProcessor()->getProcessor()->getUniq
ueID() == | 448 SkASSERT(fDrawState->getGeometryProcessor()->getUniqueID() == |
| 460 fOriginalGPID); | 449 fOriginalGPID); |
| 461 fOriginalGPID = SK_InvalidUniqueID; | 450 fOriginalGPID = SK_InvalidUniqueID; |
| 462 } | 451 } |
| 463 | 452 |
| 464 int m = fDrawState->numColorStages() - fColorEffectCnt; | 453 int m = fDrawState->numColorStages() - fColorEffectCnt; |
| 465 SkASSERT(m >= 0); | 454 SkASSERT(m >= 0); |
| 466 fDrawState->fColorStages.pop_back_n(m); | 455 fDrawState->fColorStages.pop_back_n(m); |
| 467 | 456 |
| 468 int n = fDrawState->numCoverageStages() - fCoverageEffectCnt; | 457 int n = fDrawState->numCoverageStages() - fCoverageEffectCnt; |
| 469 SkASSERT(n >= 0); | 458 SkASSERT(n >= 0); |
| 470 fDrawState->fCoverageStages.pop_back_n(n); | 459 fDrawState->fCoverageStages.pop_back_n(n); |
| 471 if (m + n > 0) { | 460 if (m + n > 0) { |
| 472 fDrawState->invalidateOptState(); | 461 fDrawState->invalidateOptState(); |
| 473 } | 462 } |
| 474 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) | 463 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) |
| 475 } | 464 } |
| 476 fDrawState = ds; | 465 fDrawState = ds; |
| 477 if (NULL != ds) { | 466 if (NULL != ds) { |
| 478 SkASSERT(SK_InvalidUniqueID == fOriginalGPID); | 467 SkASSERT(SK_InvalidUniqueID == fOriginalGPID); |
| 479 if (NULL != ds->getGeometryProcessor()) { | 468 if (NULL != ds->getGeometryProcessor()) { |
| 480 fOriginalGPID = ds->getGeometryProcessor()->getProcessor()->getUniqu
eID(); | 469 fOriginalGPID = ds->getGeometryProcessor()->getUniqueID(); |
| 481 } | 470 } |
| 482 fColorEffectCnt = ds->numColorStages(); | 471 fColorEffectCnt = ds->numColorStages(); |
| 483 fCoverageEffectCnt = ds->numCoverageStages(); | 472 fCoverageEffectCnt = ds->numCoverageStages(); |
| 484 SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;) | 473 SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;) |
| 485 } | 474 } |
| 486 } | 475 } |
| 487 | 476 |
| 488 //////////////////////////////////////////////////////////////////////////////// | 477 //////////////////////////////////////////////////////////////////////////////// |
| 489 | 478 |
| 490 // Some blend modes allow folding a fractional coverage value into the color's a
lpha channel, while | 479 // Some blend modes allow folding a fractional coverage value into the color's a
lpha channel, while |
| (...skipping 17 matching lines...) Expand all Loading... |
| 508 } | 497 } |
| 509 | 498 |
| 510 //////////////////////////////////////////////////////////////////////////////// | 499 //////////////////////////////////////////////////////////////////////////////// |
| 511 | 500 |
| 512 void GrDrawState::AutoViewMatrixRestore::restore() { | 501 void GrDrawState::AutoViewMatrixRestore::restore() { |
| 513 if (fDrawState) { | 502 if (fDrawState) { |
| 514 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) | 503 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) |
| 515 fDrawState->fViewMatrix = fViewMatrix; | 504 fDrawState->fViewMatrix = fViewMatrix; |
| 516 SkASSERT(fDrawState->numColorStages() >= fNumColorStages); | 505 SkASSERT(fDrawState->numColorStages() >= fNumColorStages); |
| 517 int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages; | 506 int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages; |
| 518 numCoverageStages -= fHasGeometryProcessor ? 1 : 0; | |
| 519 SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages); | 507 SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages); |
| 520 | 508 |
| 521 int i = 0; | 509 int i = 0; |
| 522 if (fHasGeometryProcessor) { | |
| 523 SkASSERT(fDrawState->hasGeometryProcessor()); | |
| 524 fDrawState->fGeometryProcessor->restoreCoordChange(fSavedCoordChange
s[i++]); | |
| 525 } | |
| 526 for (int s = 0; s < fNumColorStages; ++s, ++i) { | 510 for (int s = 0; s < fNumColorStages; ++s, ++i) { |
| 527 fDrawState->fColorStages[s].restoreCoordChange(fSavedCoordChanges[i]
); | 511 fDrawState->fColorStages[s].restoreCoordChange(fSavedCoordChanges[i]
); |
| 528 } | 512 } |
| 529 for (int s = 0; s < numCoverageStages; ++s, ++i) { | 513 for (int s = 0; s < numCoverageStages; ++s, ++i) { |
| 530 fDrawState->fCoverageStages[s].restoreCoordChange(fSavedCoordChanges
[i]); | 514 fDrawState->fCoverageStages[s].restoreCoordChange(fSavedCoordChanges
[i]); |
| 531 } | 515 } |
| 532 fDrawState->invalidateOptState(); | 516 fDrawState->invalidateOptState(); |
| 533 fDrawState = NULL; | 517 fDrawState = NULL; |
| 534 } | 518 } |
| 535 } | 519 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 561 | 545 |
| 562 if (drawState->getViewMatrix().isIdentity()) { | 546 if (drawState->getViewMatrix().isIdentity()) { |
| 563 return true; | 547 return true; |
| 564 } | 548 } |
| 565 | 549 |
| 566 drawState->invalidateOptState(); | 550 drawState->invalidateOptState(); |
| 567 fViewMatrix = drawState->getViewMatrix(); | 551 fViewMatrix = drawState->getViewMatrix(); |
| 568 if (0 == drawState->numTotalStages()) { | 552 if (0 == drawState->numTotalStages()) { |
| 569 drawState->fViewMatrix.reset(); | 553 drawState->fViewMatrix.reset(); |
| 570 fDrawState = drawState; | 554 fDrawState = drawState; |
| 571 fHasGeometryProcessor = false; | |
| 572 fNumColorStages = 0; | 555 fNumColorStages = 0; |
| 573 fSavedCoordChanges.reset(0); | 556 fSavedCoordChanges.reset(0); |
| 574 SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;) | 557 SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;) |
| 575 return true; | 558 return true; |
| 576 } else { | 559 } else { |
| 577 SkMatrix inv; | 560 SkMatrix inv; |
| 578 if (!fViewMatrix.invert(&inv)) { | 561 if (!fViewMatrix.invert(&inv)) { |
| 579 return false; | 562 return false; |
| 580 } | 563 } |
| 581 drawState->fViewMatrix.reset(); | 564 drawState->fViewMatrix.reset(); |
| 582 fDrawState = drawState; | 565 fDrawState = drawState; |
| 583 this->doEffectCoordChanges(inv); | 566 this->doEffectCoordChanges(inv); |
| 584 SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;) | 567 SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;) |
| 585 return true; | 568 return true; |
| 586 } | 569 } |
| 587 } | 570 } |
| 588 | 571 |
| 589 void GrDrawState::AutoViewMatrixRestore::doEffectCoordChanges(const SkMatrix& co
ordChangeMatrix) { | 572 void GrDrawState::AutoViewMatrixRestore::doEffectCoordChanges(const SkMatrix& co
ordChangeMatrix) { |
| 590 fSavedCoordChanges.reset(fDrawState->numTotalStages()); | 573 fSavedCoordChanges.reset(fDrawState->numTotalStages()); |
| 591 int i = 0; | 574 int i = 0; |
| 592 | 575 |
| 593 fHasGeometryProcessor = false; | |
| 594 if (fDrawState->hasGeometryProcessor()) { | |
| 595 fDrawState->fGeometryProcessor->saveCoordChange(&fSavedCoordChanges[i++]
); | |
| 596 fDrawState->fGeometryProcessor->localCoordChange(coordChangeMatrix); | |
| 597 fHasGeometryProcessor = true; | |
| 598 } | |
| 599 | |
| 600 fNumColorStages = fDrawState->numColorStages(); | 576 fNumColorStages = fDrawState->numColorStages(); |
| 601 for (int s = 0; s < fNumColorStages; ++s, ++i) { | 577 for (int s = 0; s < fNumColorStages; ++s, ++i) { |
| 602 fDrawState->getColorStage(s).saveCoordChange(&fSavedCoordChanges[i]); | 578 fDrawState->getColorStage(s).saveCoordChange(&fSavedCoordChanges[i]); |
| 603 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); | 579 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); |
| 604 } | 580 } |
| 605 | 581 |
| 606 int numCoverageStages = fDrawState->numCoverageStages(); | 582 int numCoverageStages = fDrawState->numCoverageStages(); |
| 607 for (int s = 0; s < numCoverageStages; ++s, ++i) { | 583 for (int s = 0; s < numCoverageStages; ++s, ++i) { |
| 608 fDrawState->getCoverageStage(s).saveCoordChange(&fSavedCoordChanges[i]); | 584 fDrawState->getCoverageStage(s).saveCoordChange(&fSavedCoordChanges[i]); |
| 609 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); | 585 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); |
| 610 } | 586 } |
| 611 } | 587 } |
| 612 | 588 |
| 613 //////////////////////////////////////////////////////////////////////////////// | 589 //////////////////////////////////////////////////////////////////////////////// |
| 614 | 590 |
| 615 void GrDrawState::convertToPendingExec() { | 591 void GrDrawState::convertToPendingExec() { |
| 616 fRenderTarget.markPendingIO(); | 592 fRenderTarget.markPendingIO(); |
| 617 fRenderTarget.removeRef(); | 593 fRenderTarget.removeRef(); |
| 618 for (int i = 0; i < fColorStages.count(); ++i) { | 594 for (int i = 0; i < fColorStages.count(); ++i) { |
| 619 fColorStages[i].convertToPendingExec(); | 595 fColorStages[i].convertToPendingExec(); |
| 620 } | 596 } |
| 621 if (fGeometryProcessor) { | 597 if (fGeometryProcessor) { |
| 622 fGeometryProcessor->convertToPendingExec(); | 598 fGeometryProcessor.convertToPendingExec(); |
| 623 } | 599 } |
| 624 for (int i = 0; i < fCoverageStages.count(); ++i) { | 600 for (int i = 0; i < fCoverageStages.count(); ++i) { |
| 625 fCoverageStages[i].convertToPendingExec(); | 601 fCoverageStages[i].convertToPendingExec(); |
| 626 } | 602 } |
| 627 } | 603 } |
| 628 | 604 |
| 629 //////////////////////////////////////////////////////////////////////////////// | 605 //////////////////////////////////////////////////////////////////////////////// |
| 630 | 606 |
| 631 void GrDrawState::invalidateOptState() const { | 607 void GrDrawState::invalidateOptState() const { |
| 632 SkSafeSetNull(fCachedOptState); | 608 SkSafeSetNull(fCachedOptState); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 } | 754 } |
| 779 | 755 |
| 780 // Since the shader will multiply coverage and color, the only way the f
inal A==1 is if | 756 // Since the shader will multiply coverage and color, the only way the f
inal A==1 is if |
| 781 // coverage and color both have A==1. | 757 // coverage and color both have A==1. |
| 782 return (inoutColor.isOpaque() && inoutCoverage.isOpaque()); | 758 return (inoutColor.isOpaque() && inoutCoverage.isOpaque()); |
| 783 } | 759 } |
| 784 | 760 |
| 785 return inoutColor.isOpaque(); | 761 return inoutColor.isOpaque(); |
| 786 } | 762 } |
| 787 | 763 |
| OLD | NEW |