Update invariant output computation for various texture effects.

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
This commit is contained in:
egdaniel 2014-11-25 10:24:56 -08:00 committed by Commit bot
parent 74d80eba37
commit f8449babdc
4 changed files with 14 additions and 4 deletions

View File

@ -229,7 +229,9 @@ bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
}
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();

View File

@ -68,7 +68,9 @@ bool GrCustomCoordsTextureEffect::onIsEqual(const GrGeometryProcessor& other) co
}
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();

View File

@ -40,7 +40,9 @@ protected:
* 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();

View File

@ -271,7 +271,11 @@ bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
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);
}