Fix unpremul stage.
The existing invert() logic explodes when a == 0.
Less terribly, invert() also does not turn 1.0f into 1.0f, so we now use a float divide. This will cause a small diff in the matrix color filter GM due to increased unpremul precision.
There's an alternative to try if this stage turns out to be speed critical:
auto scale = (a == 0.0f).thenElse(0.0f,
a.invert() * (1.0f / SkNf(1.0f).invert()));
The (1.0f / SkNf(1.0f).invert()) bit there is a constant, scaling a bit to make 1.0f produce 1.0f.
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD
Change-Id: I9db72eda108d3d28583a4357f90a0dcd7e4d8a6f
Reviewed-on: https://skia-review.googlesource.com/5227
Reviewed-by: Mike Reed <reed@google.com>
1 file changed