diff options
author | 2014-11-25 10:24:56 -0800 | |
---|---|---|
committer | 2014-11-25 10:24:56 -0800 | |
commit | f8449babdc430bb522c0eb87ce18f05c54d83714 (patch) | |
tree | eac8bfd2fc7f7d9a5e3c532b2c57ef2eafcb31d4 /src/gpu/effects | |
parent | 74d80eba370557c22cebef6c3be0875c32e1b17b (diff) |
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
Diffstat (limited to 'src/gpu/effects')
-rw-r--r-- | src/gpu/effects/GrCustomCoordsTextureEffect.cpp | 4 | ||||
-rw-r--r-- | src/gpu/effects/GrSingleTextureEffect.h | 4 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureDomain.cpp | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp index 39f44820b0..f61a37bb6f 100644 --- a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp +++ b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp @@ -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(); diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h index efdf255552..6fd6819e92 100644 --- a/src/gpu/effects/GrSingleTextureEffect.h +++ b/src/gpu/effects/GrSingleTextureEffect.h @@ -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(); diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index db3ef2cd98..de552c0ac9 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -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); } |