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:
parent
74d80eba37
commit
f8449babdc
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user