Assume the user creates an ImageData in color space A and puts the ImageData onto a canvas in color space B, where A or B or both have a non-linear transfer function. The correct procedure must be as follows:
- ImageData pixels are "gamma encoded unpremul" in color space A.
- If the transfer function of A is non-linear, pixels must get converted to "premul". Otherwise, do nothing.
- If the transfer function of color space B is non-linear, pixels must get color converted to "premul in color space B" and then "read in gamma encoded unpremul".
- Otherwise, if the transfer function of color space B is linear, pixels can directly get color converted to "unpremul in color space B".
It seems that the current color managed ImageData does not properly handle the premul/unpremul in gamma encoded space. This seems to be the root of the trybot failures observed in https://chromium-review.googlesource.com/c/chromium/src/+/693219/2.
Comment 1 by zakerinasab@chromium.org
, Oct 2 2017