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