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 | 10 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 if (kOne_GrBlendCoeff == *srcCoeff && | 402 if (kOne_GrBlendCoeff == *srcCoeff && |
403 kZero_GrBlendCoeff == *dstCoeff && | 403 kZero_GrBlendCoeff == *dstCoeff && |
404 this->willEffectReadDstColor()) { | 404 this->willEffectReadDstColor()) { |
405 // In this case the shader will fully resolve the color, coverage, and d
st and we don't | 405 // In this case the shader will fully resolve the color, coverage, and d
st and we don't |
406 // need blending. | 406 // need blending. |
407 return kDisableBlend_BlendOptFlag; | 407 return kDisableBlend_BlendOptFlag; |
408 } | 408 } |
409 return kNone_BlendOpt; | 409 return kNone_BlendOpt; |
410 } | 410 } |
411 | 411 |
| 412 bool GrDrawState::canIgnoreColorAttribute() const { |
| 413 if (fBlendOptFlags & kInvalid_BlendOptFlag) { |
| 414 this->getBlendOpts(); |
| 415 } |
| 416 return SkToBool(fBlendOptFlags & (GrDrawState::kEmitTransBlack_BlendOptFlag
| |
| 417 GrDrawState::kEmitCoverage_BlendOptFlag)); |
| 418 } |
| 419 |
| 420 |
412 //////////////////////////////////////////////////////////////////////////////// | 421 //////////////////////////////////////////////////////////////////////////////// |
413 | 422 |
414 void GrDrawState::AutoViewMatrixRestore::restore() { | 423 void GrDrawState::AutoViewMatrixRestore::restore() { |
415 if (NULL != fDrawState) { | 424 if (NULL != fDrawState) { |
416 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) | 425 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) |
417 fDrawState->fViewMatrix = fViewMatrix; | 426 fDrawState->fViewMatrix = fViewMatrix; |
418 SkASSERT(fDrawState->numColorStages() >= fNumColorStages); | 427 SkASSERT(fDrawState->numColorStages() >= fNumColorStages); |
419 int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages; | 428 int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages; |
420 SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages); | 429 SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages); |
421 | 430 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]); | 497 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]); |
489 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); | 498 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); |
490 } | 499 } |
491 | 500 |
492 int numCoverageStages = fDrawState->numCoverageStages(); | 501 int numCoverageStages = fDrawState->numCoverageStages(); |
493 for (int s = 0; s < numCoverageStages; ++s, ++i) { | 502 for (int s = 0; s < numCoverageStages; ++s, ++i) { |
494 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]); | 503 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]); |
495 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); | 504 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); |
496 } | 505 } |
497 } | 506 } |
OLD | NEW |