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 "GrBlend.h" |
10 #include "GrInvariantOutput.h" | 11 #include "GrInvariantOutput.h" |
11 #include "GrOptDrawState.h" | 12 #include "GrOptDrawState.h" |
12 #include "GrPaint.h" | 13 #include "GrPaint.h" |
13 | 14 |
14 //////////////////////////////////////////////////////////////////////////////s | 15 //////////////////////////////////////////////////////////////////////////////s |
15 | 16 |
16 bool GrDrawState::isEqual(const GrDrawState& that) const { | 17 bool GrDrawState::isEqual(const GrDrawState& that) const { |
17 bool usingVertexColors = this->hasColorVertexAttribute(); | 18 bool usingVertexColors = this->hasColorVertexAttribute(); |
18 if (!usingVertexColors && this->fColor != that.fColor) { | 19 if (!usingVertexColors && this->fColor != that.fColor) { |
19 return false; | 20 return false; |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } | 743 } |
743 | 744 |
744 return inoutColor.isOpaque(); | 745 return inoutColor.isOpaque(); |
745 } | 746 } |
746 | 747 |
747 bool GrDrawState::willBlendWithDst() const { | 748 bool GrDrawState::willBlendWithDst() const { |
748 if (!this->hasSolidCoverage()) { | 749 if (!this->hasSolidCoverage()) { |
749 return true; | 750 return true; |
750 } | 751 } |
751 | 752 |
752 bool srcAIsOne = this->srcAlphaWillBeOne(); | 753 if (this->willEffectReadDstColor()) { |
753 GrBlendCoeff srcCoeff = this->getSrcBlendCoeff(); | |
754 GrBlendCoeff dstCoeff = this->getDstBlendCoeff(); | |
755 if (kISA_GrBlendCoeff == dstCoeff && srcAIsOne) { | |
756 dstCoeff = kZero_GrBlendCoeff; | |
757 } | |
758 if (kOne_GrBlendCoeff != srcCoeff || | |
759 kZero_GrBlendCoeff != dstCoeff || | |
760 this->willEffectReadDstColor()) { | |
761 return true; | 754 return true; |
762 } | 755 } |
763 | 756 |
| 757 if (GrBlendCoeffRefsDst(this->getSrcBlendCoeff())) { |
| 758 return true; |
| 759 } |
| 760 |
| 761 GrBlendCoeff dstCoeff = this->getDstBlendCoeff(); |
| 762 if (!(kZero_GrBlendCoeff == dstCoeff || |
| 763 (kISA_GrBlendCoeff == dstCoeff && this->srcAlphaWillBeOne()))) { |
| 764 return true; |
| 765 } |
| 766 |
764 return false; | 767 return false; |
765 } | 768 } |
766 | 769 |
OLD | NEW |