Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: src/gpu/GrDrawState.cpp

Issue 715873002: Add isUnblended query to GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/gpu/GrDrawState.h ('K') | « src/gpu/GrDrawState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.cpp
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index c82c5adad1f771354e711e1ce149234d8ee77acf..a6e4a96083f7e350cd20b48c400d8c69f05e862e 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -742,3 +742,20 @@ bool GrDrawState::srcAlphaWillBeOne() const {
return inoutColor.isOpaque();
}
+bool GrDrawState::isUnblended() const {
+ if (!this->hasSolidCoverage()) {
+ return false;
+ }
+
+ bool srcAIsOne = this->srcAlphaWillBeOne();
+ GrBlendCoeff srcCoeff = this->getSrcBlendCoeff();
+ GrBlendCoeff dstCoeff = this->getDstBlendCoeff();
+ bool dstCoeffIsZero = kZero_GrBlendCoeff == dstCoeff ||
bsalomon 2014/11/11 20:49:56 The fact that the blend opts code doesn't directly
egdaniel 2014/11/11 21:05:55 Done.
+ (kISA_GrBlendCoeff == dstCoeff && srcAIsOne);
+ if (kOne_GrBlendCoeff != srcCoeff || !dstCoeffIsZero || this->willEffectReadDstColor()) {
+ return false;
+ }
+
+ return true;
+}
+
« src/gpu/GrDrawState.h ('K') | « src/gpu/GrDrawState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698