| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 *dstCoeff = kISA_GrBlendCoeff; | 364 *dstCoeff = kISA_GrBlendCoeff; |
| 365 return kCoverageAsAlpha_BlendOptFlag; | 365 return kCoverageAsAlpha_BlendOptFlag; |
| 366 } | 366 } |
| 367 } else if (dstCoeffIsOne) { | 367 } else if (dstCoeffIsOne) { |
| 368 // the dst coeff is effectively one so blend works out to: | 368 // the dst coeff is effectively one so blend works out to: |
| 369 // cS + (c)(1)D + (1-c)D = cS + D. | 369 // cS + (c)(1)D + (1-c)D = cS + D. |
| 370 *dstCoeff = kOne_GrBlendCoeff; | 370 *dstCoeff = kOne_GrBlendCoeff; |
| 371 return kCoverageAsAlpha_BlendOptFlag; | 371 return kCoverageAsAlpha_BlendOptFlag; |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 if (kOne_GrBlendCoeff == *srcCoeff && |
| 375 kZero_GrBlendCoeff == *dstCoeff && |
| 376 this->willEffectReadDstColor()) { |
| 377 // In this case the shader will fully resolve the color, coverage, and d
st and we don't |
| 378 // need blending. |
| 379 return kDisableBlend_BlendOptFlag; |
| 380 } |
| 374 return kNone_BlendOpt; | 381 return kNone_BlendOpt; |
| 375 } | 382 } |
| 376 | 383 |
| 377 //////////////////////////////////////////////////////////////////////////////// | 384 //////////////////////////////////////////////////////////////////////////////// |
| 378 | 385 |
| 379 void GrDrawState::AutoViewMatrixRestore::restore() { | 386 void GrDrawState::AutoViewMatrixRestore::restore() { |
| 380 if (NULL != fDrawState) { | 387 if (NULL != fDrawState) { |
| 381 fDrawState->setViewMatrix(fViewMatrix); | 388 fDrawState->setViewMatrix(fViewMatrix); |
| 382 for (int s = 0; s < GrDrawState::kNumStages; ++s) { | 389 for (int s = 0; s < GrDrawState::kNumStages; ++s) { |
| 383 if (fRestoreMask & (1 << s)) { | 390 if (fRestoreMask & (1 << s)) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 456 } |
| 450 fRestoreMask |= (1 << s); | 457 fRestoreMask |= (1 << s); |
| 451 GrEffectStage* stage = drawState->fStages + s; | 458 GrEffectStage* stage = drawState->fStages + s; |
| 452 stage->saveCoordChange(&fSavedCoordChanges[s]); | 459 stage->saveCoordChange(&fSavedCoordChanges[s]); |
| 453 stage->localCoordChange(invVM); | 460 stage->localCoordChange(invVM); |
| 454 } | 461 } |
| 455 } | 462 } |
| 456 drawState->viewMatrix()->reset(); | 463 drawState->viewMatrix()->reset(); |
| 457 return true; | 464 return true; |
| 458 } | 465 } |
| OLD | NEW |