Fix modulation and gamma correction issues

Modulation is normally enabled in a shader when drawing with an alpha
mask (A8 texture.) Modulation is used to do one of two things:

- Colorize the primitive (to draw text in red for instance)
- Apply extra translucency (50% translucent circle filled with a bitmap)

The current implementation has four issues:

1. Unnecessary work is performed by assigning the modulation color
   to vec4 fragColor early in the shader
2. The modulation color's alpha is applied twice when the primitive
   is drawn with an SkShader
3. The decision to modulate is wrong and triggers when any of the
   RGB channels is < 1.0. Only the alpha channel needs to be taken
   into account to make the decision
4. Gamma correction is not applied properly

This change addresses all four issues above.

Change-Id: I73fcc74efc4b094bf2d1b835f10ffaa2ea4b9eb9
2 files changed