Update various effects that read in textures to check whether or not the texture is alpha only.
This allows us to use a more specific mulByUnKnownAlpha instead of the more general mulByUnknownColor
BUG=skia:
Review URL: https://codereview.chromium.org/
759653004
}
void AlphaThresholdEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >= 1.f) {
+ if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ inout->mulByUnknownAlpha();
+ } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >= 1.f) {
inout->mulByUnknownOpaqueColor();
} else {
inout->mulByUnknownColor();
}
void GrCustomCoordsTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
+ if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ inout->mulByUnknownAlpha();
+ } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
inout->mulByUnknownOpaqueColor();
} else {
inout->mulByUnknownColor();
* texture.
*/
void updateInvariantOutputForModulation(GrInvariantOutput* inout) const {
- if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
+ if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ inout->mulByUnknownAlpha();
+ } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
inout->mulByUnknownOpaqueColor();
} else {
inout->mulByUnknownColor();
void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper
- inout->mulByUnknownColor();
+ if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ inout->mulByUnknownAlpha();
+ } else {
+ inout->mulByUnknownColor();
+ }
} else {
this->updateInvariantOutputForModulation(inout);
}