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 bool srcAIsOne = this->srcAlphaWillBeOne(); |
Chris Dalton
2014/11/12 21:21:48
Just a thought, I'm not too familiar with how slow
| |
753 GrBlendCoeff srcCoeff = this->getSrcBlendCoeff(); | 754 GrBlendCoeff srcCoeff = this->getSrcBlendCoeff(); |
754 GrBlendCoeff dstCoeff = this->getDstBlendCoeff(); | 755 GrBlendCoeff dstCoeff = this->getDstBlendCoeff(); |
755 if (kISA_GrBlendCoeff == dstCoeff && srcAIsOne) { | 756 if (kISA_GrBlendCoeff == dstCoeff && srcAIsOne) { |
bsalomon
2014/11/12 21:33:38
At a minimum we can just change this srcAIsOne to
| |
756 dstCoeff = kZero_GrBlendCoeff; | 757 dstCoeff = kZero_GrBlendCoeff; |
757 } | 758 } |
758 if (kOne_GrBlendCoeff != srcCoeff || | 759 if (GrBlendCoeffRefsDst(srcCoeff) || |
759 kZero_GrBlendCoeff != dstCoeff || | 760 kZero_GrBlendCoeff != dstCoeff || |
760 this->willEffectReadDstColor()) { | 761 this->willEffectReadDstColor()) { |
761 return true; | 762 return true; |
762 } | 763 } |
763 | 764 |
764 return false; | 765 return false; |
765 } | 766 } |
766 | 767 |
OLD | NEW |