Remove coverage multiplies when it is known to be fully opaque.
BUG=skia: Review URL: https://codereview.chromium.org/1132883002
This commit is contained in:
parent
f36cca8a61
commit
7dfc27ca42
@ -49,18 +49,17 @@ public:
|
||||
|
||||
bool hasVertexCoverage = SkToBool(fInCoverage) && !init.fCoverageIgnored;
|
||||
bool covIsSolidWhite = !hasVertexCoverage && 0xff == this->coverage();
|
||||
if (covIsSolidWhite) {
|
||||
if (init.fCoverageIgnored) {
|
||||
local->fInputCoverageType = kIgnored_GrGPInput;
|
||||
} else if (covIsSolidWhite) {
|
||||
local->fInputCoverageType = kAllOnes_GrGPInput;
|
||||
} else if (!hasVertexCoverage) {
|
||||
local->fInputCoverageType = kUniform_GrGPInput;
|
||||
local->fCoverage = this->coverage();
|
||||
} else if (hasVertexCoverage) {
|
||||
SkASSERT(fInCoverage);
|
||||
local->fInputCoverageType = kAttribute_GrGPInput;
|
||||
} else {
|
||||
local->fInputCoverageType = kIgnored_GrGPInput;
|
||||
local->fInputCoverageType = kUniform_GrGPInput;
|
||||
local->fCoverage = this->coverage();
|
||||
}
|
||||
|
||||
local->fUsesLocalCoords = init.fUsesLocalCoords;
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,8 @@ PorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
|
||||
// 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
|
||||
fDstBlend = kZero_GrBlendCoeff;
|
||||
return GrXferProcessor::kNone_Opt;
|
||||
return GrXferProcessor::kNone_Opt |
|
||||
GrXferProcessor::kIgnoreCoverage_OptFlag;
|
||||
} else if (kZero_GrBlendCoeff == fSrcBlend) {
|
||||
// if the op is "clear" then we don't need to emit a color
|
||||
// or blend, just write transparent black into the dst.
|
||||
@ -416,7 +417,9 @@ PorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
|
||||
GrXferProcessor::kIgnoreCoverage_OptFlag;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return GrXferProcessor::kIgnoreCoverage_OptFlag;
|
||||
}
|
||||
|
||||
// check whether coverage can be safely rolled into alpha
|
||||
// of if we can skip color computation and just emit coverage
|
||||
if (can_tweak_alpha_for_coverage(fDstBlend)) {
|
||||
@ -463,7 +466,6 @@ PorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
|
||||
}
|
||||
return GrXferProcessor::kSetCoverageDrawing_OptFlag;
|
||||
}
|
||||
}
|
||||
|
||||
return GrXferProcessor::kNone_Opt;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user