Remove kDisableBlend_BlendOptFlag as it is no longer needed

BUG=skia:
R=bsalomon@google.com

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/425153003
This commit is contained in:
egdaniel 2014-07-30 13:18:32 -07:00 committed by Commit bot
parent b3abe90145
commit 0f1a7c42d7
3 changed files with 17 additions and 21 deletions

View File

@ -339,8 +339,7 @@ GrDrawState::BlendOptFlags GrDrawState::calcBlendOpts(bool forceCoverage,
// (0,1). The same applies when coverage is known to be 0.
if ((kZero_GrBlendCoeff == *srcCoeff && dstCoeffIsOne) || covIsZero) {
if (this->getStencil().doesWrite()) {
return kDisableBlend_BlendOptFlag |
kEmitCoverage_BlendOptFlag;
return kEmitCoverage_BlendOptFlag;
} else {
return kSkipDraw_BlendOptFlag;
}
@ -359,13 +358,14 @@ GrDrawState::BlendOptFlags GrDrawState::calcBlendOpts(bool forceCoverage,
if (kOne_GrBlendCoeff == *srcCoeff) {
// if there is no coverage and coeffs are (1,0) then we
// won't need to read the dst at all, it gets replaced by src
return kDisableBlend_BlendOptFlag;
*dstCoeff = kZero_GrBlendCoeff;
return kNone_BlendOpt;
} else if (kZero_GrBlendCoeff == *srcCoeff) {
// if the op is "clear" then we don't need to emit a color
// or blend, just write transparent black into the dst.
*srcCoeff = kOne_GrBlendCoeff;
*dstCoeff = kZero_GrBlendCoeff;
return kDisableBlend_BlendOptFlag | kEmitTransBlack_BlendOptFlag;
return kEmitTransBlack_BlendOptFlag;
}
}
} else if (this->isCoverageDrawing()) {
@ -399,13 +399,7 @@ GrDrawState::BlendOptFlags GrDrawState::calcBlendOpts(bool forceCoverage,
return kCoverageAsAlpha_BlendOptFlag;
}
}
if (kOne_GrBlendCoeff == *srcCoeff &&
kZero_GrBlendCoeff == *dstCoeff &&
this->willEffectReadDstColor()) {
// In this case the shader will fully resolve the color, coverage, and dst and we don't
// need blending.
return kDisableBlend_BlendOptFlag;
}
return kNone_BlendOpt;
}

View File

@ -520,29 +520,25 @@ public:
* Don't draw at all
*/
kSkipDraw_BlendOptFlag = 0x1,
/**
* Emit the src color, disable HW blending (replace dst with src)
*/
kDisableBlend_BlendOptFlag = 0x2,
/**
* The coverage value does not have to be computed separately from alpha, the the output
* color can be the modulation of the two.
*/
kCoverageAsAlpha_BlendOptFlag = 0x4,
kCoverageAsAlpha_BlendOptFlag = 0x2,
/**
* Instead of emitting a src color, emit coverage in the alpha channel and r,g,b are
* "don't cares".
*/
kEmitCoverage_BlendOptFlag = 0x8,
kEmitCoverage_BlendOptFlag = 0x4,
/**
* Emit transparent black instead of the src color, no need to compute coverage.
*/
kEmitTransBlack_BlendOptFlag = 0x10,
kEmitTransBlack_BlendOptFlag = 0x8,
/**
* Flag used to invalidate the cached BlendOptFlags, OptSrcCoeff, and OptDstCoeff cached by
* the get BlendOpts function.
*/
kInvalid_BlendOptFlag = 0x20,
kInvalid_BlendOptFlag = 1 << 31,
};
GR_DECL_BITFIELD_OPS_FRIENDS(BlendOptFlags);

View File

@ -615,9 +615,15 @@ void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
bool GrDrawTarget::canApplyCoverage() const {
// we can correctly apply coverage if a) we have dual source blending
// or b) one of our blend optimizations applies.
// or b) one of our blend optimizations applies
// or c) the src, dst blend coeffs are 1,0 and we will read Dst Color
GrBlendCoeff srcCoeff;
GrBlendCoeff dstCoeff;
GrDrawState::BlendOptFlags flag = this->getDrawState().getBlendOpts(true, &srcCoeff, &dstCoeff);
return this->caps()->dualSourceBlendingSupport() ||
GrDrawState::kNone_BlendOpt != this->getDrawState().getBlendOpts(true);
GrDrawState::kNone_BlendOpt != flag ||
(this->getDrawState().willEffectReadDstColor() &&
kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff);
}
////////////////////////////////////////////////////////////////////////////////