Skip to content
Commit a938f569 authored by Romain Guy's avatar Romain Guy
Browse files

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
parent 494ac35c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment