Add isUnblended query to GrDrawState.

BUG=skia:

Review URL: https://codereview.chromium.org/715873002
This commit is contained in:
egdaniel 2014-11-11 14:46:05 -08:00 committed by Commit bot
parent 453cf40ac7
commit cd8b6307fe
2 changed files with 26 additions and 0 deletions

View File

@ -742,3 +742,23 @@ bool GrDrawState::srcAlphaWillBeOne() const {
return inoutColor.isOpaque();
}
bool GrDrawState::willBlendWithDst() const {
if (!this->hasSolidCoverage()) {
return true;
}
bool srcAIsOne = this->srcAlphaWillBeOne();
GrBlendCoeff srcCoeff = this->getSrcBlendCoeff();
GrBlendCoeff dstCoeff = this->getDstBlendCoeff();
if (kISA_GrBlendCoeff == dstCoeff && srcAIsOne) {
dstCoeff = kZero_GrBlendCoeff;
}
if (kOne_GrBlendCoeff != srcCoeff ||
kZero_GrBlendCoeff != dstCoeff ||
this->willEffectReadDstColor()) {
return true;
}
return false;
}

View File

@ -159,6 +159,12 @@ public:
*/
bool hasSolidCoverage() const;
/**
* This function returns true if the render target destination pixel values will be read for
* blending during draw.
*/
bool willBlendWithDst() const;
/// @}
///////////////////////////////////////////////////////////////////////////