more sophisticated opacity in SkImageShader

The tricky bit here is tracking when we care if the image is opaque,
and when we care if the shader output is opaque. These are usually
the same, except for decal tiling modes.

We can exploit both of these properties:
   - if the shader output is opaque, set alpha to 1.0f after all
     sampling and interpolation to retroactively skip any the unpacking
     and interpolation we did to calculate alpha.
   - if the input is opaque, set alpha to 1.0f after each sample to skip
     unpacking it.  This mostly just helps decal modes, as this will
     itself all be skipped when the output is opaque.

Change-Id: Ie2954e59f0f9da8be7ad5d11f30fdfd4635c4b70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270656
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
1 file changed