angler-fishThe Vulnerability History Project

Implement ImageBitmap options premultiplyAlpha for ImageData

      With premultiplyAlpha=true, the implementation of this function creates
a premultiplied SkSurface and grab a snapshot from it.

To prevent any data loss, we should try to create a SkImage directly from
the raw unpremultiplied data. There are several tricky cases here. First,
we need to take care of the case when the crop region is not the same as
the original ImageData size, where we need to malloc a temporary buffer
and copy the data over. Also, we need to take care of the case when flipY
is set to be true, because we need to only flip the area that is inside
the crop region.

BUG=589131

Review URL: https://codereview.chromium.org/1680173003

Cr-Commit-Position: refs/heads/master@{#378080}
    
commit 455d762d883dae25439ca74d67bd84c297a6e135
+100
+2 -2
+56 -111
-2
expand_less