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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 } | 735 } |
736 | 736 |
737 // Since the shader will multiply coverage and color, the only way the f
inal A==1 is if | 737 // Since the shader will multiply coverage and color, the only way the f
inal A==1 is if |
738 // coverage and color both have A==1. | 738 // coverage and color both have A==1. |
739 return (inoutColor.isOpaque() && inoutCoverage.isOpaque()); | 739 return (inoutColor.isOpaque() && inoutCoverage.isOpaque()); |
740 } | 740 } |
741 | 741 |
742 return inoutColor.isOpaque(); | 742 return inoutColor.isOpaque(); |
743 } | 743 } |
744 | 744 |
| 745 bool GrDrawState::willBlendWithDst() const { |
| 746 if (!this->hasSolidCoverage()) { |
| 747 return true; |
| 748 } |
| 749 |
| 750 bool srcAIsOne = this->srcAlphaWillBeOne(); |
| 751 GrBlendCoeff srcCoeff = this->getSrcBlendCoeff(); |
| 752 GrBlendCoeff dstCoeff = this->getDstBlendCoeff(); |
| 753 if (kISA_GrBlendCoeff == dstCoeff && srcAIsOne) { |
| 754 dstCoeff = kZero_GrBlendCoeff; |
| 755 } |
| 756 if (kOne_GrBlendCoeff != srcCoeff || |
| 757 kZero_GrBlendCoeff != dstCoeff || |
| 758 this->willEffectReadDstColor()) { |
| 759 return true; |
| 760 } |
| 761 |
| 762 return false; |
| 763 } |
| 764 |
OLD | NEW |