clamp before premul

When alpha is <1, it's possible to fit r,g,b >1 into premul unorms,
and that subverts the expectations users who consume the output of

When working with unorm pixels, downstream consumers will assume the
r,g,b values are also within [0,1], i.e. are less than the alpha
channel.  Put another way, they assume the colors are in gamut.

So clamp earlier, before premul.  (The reordering has no effect on
force_opaque or swap_rb.)

Bug: chromium:867813
Bug: chromium:862908
Change-Id: I553b42df06482a4e3cd3a9377c2adddb8ff3d1bc
Reviewed-by: Brian Osman <>
Commit-Queue: Brian Osman <>
Auto-Submit: Mike Klein <>
1 file changed