summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-image-data.html
Commit message (Collapse)AuthorAgeFilesLines
* Use ImageDecoder for createImageBitmap(HTMLImageElement, premultiplyAlpha=false)xidachen2016-03-241-0/+96
This is specifically for the case of premultiplyAlpha=false. Following is an example. Given an image with only one pixel with value of (255, 0, 0, 26), and we load the this image either as a Blob or a HTMLImageElement and call createImageBitmap with premultiplyAlpha=false. the ImageBitmap::copyBitmapData will return a pixel value of (197, 0, 0, 26) which is totally wrong. The reason it fails is that the SkImage that is extracted from ImageDecoder is always in kPremul alphaType even if "AlphaNotPremultiplied" is given to the ImageDecoder. With this CL: https://codereview.chromium.org/1820733004/, the extracted SkImage now has a kUnpremul alphaType. ImageBitmap should adapt to this change as well. So this CL make correction for the case of createImageBitmap from Blob and HTMLImageElement so that copyBitmapData will succeed with the SkImage extracted from ImageDecoder. We have also updated corresponding layout tests. In particular, we change an existing image's alpha channel from 128 to 26. In this case, if the ImageBitmap constructor handles premultiplyAlpha=false by first premultiply and then un-premultiply, we will see a large loss comparing with input. Here we can see that the color is very close (tolerance of 2) to its input image. Additionally, we added several new layout tests to test the cases of createImageBitmap(ImageBitmap) where the parameter ImageBitmap is created from various kinds of sources. 2 layout tests are deleted under fast/canvas/. The reason is that these layout tests uses 2d canvas to display an ImageBitmap, and it cannot distinguish an ImageBitmap created with premultiplyAlpha= false with an ImageBitmap created with true. Now that we have a large set of layout tests under fast/canvas/webgl, these 2 tests are redundant. Review URL: https://codereview.chromium.org/1809603004 Cr-Commit-Position: refs/heads/master@{#383004}