Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Issue 1809603004: Use ImageDecoder for createImageBitmap(HTMLImageElement, premultiplyAlpha=false) (Closed)

Created:
4 years, 9 months ago by xidachen
Modified:
4 years, 9 months ago
Reviewers:
Justin Novosad
CC:
chromium-reviews, blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use ImageDecoder for createImageBitmap(HTMLImageElement, premultiplyAlpha=false) 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. Committed: https://crrev.com/eb0d622c183ae08eb51e1ca68b84cbb16c564363 Cr-Commit-Position: refs/heads/master@{#383004}

Patch Set 1 #

Patch Set 2 : needs rebase, DONOT COMMIT this PS #

Patch Set 3 : rebase done #

Total comments: 3

Patch Set 4 : halfRed-->darkRed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+71 lines, -4200 lines) Patch
M third_party/WebKit/LayoutTests/SlowTests View 1 2 1 chunk +0 lines, -1 line 0 comments Download
D third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-with-options.html View 1 1 chunk +0 lines, -272 lines 0 comments Download
D third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-with-options-expected.txt View 1 1 chunk +0 lines, -357 lines 0 comments Download
D third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-with-options.html View 1 1 chunk +0 lines, -576 lines 0 comments Download
D third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-with-options-expected.txt View 1 1 chunk +0 lines, -2833 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/red-green-semi-transparent.png View Binary file 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-image-bitmap-utils.js View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-blob.html View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-canvas.html View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image.html View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap.html View 1 1 chunk +0 lines, -96 lines 0 comments Download
D third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-expected.txt View 1 1 chunk +0 lines, -5 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-blob.html View 1 2 3 4 chunks +15 lines, -14 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-blob-expected.txt View 1 0 chunks +-1 lines, --1 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html View 1 2 3 4 chunks +25 lines, -12 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas-expected.txt View 1 0 chunks +-1 lines, --1 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-image.html View 1 2 3 4 chunks +11 lines, -14 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-image-data.html View 1 2 3 3 chunks +5 lines, -5 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-image-data-expected.txt View 1 0 chunks +-1 lines, --1 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-image-expected.txt View 1 0 chunks +-1 lines, --1 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-data.html View 1 2 3 3 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-video.html View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/frame/ImageBitmap.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 20 (9 generated)
xidachen
PTAL
4 years, 9 months ago (2016-03-23 11:03:35 UTC) #4
Justin Novosad
Can you explain the deleted tests? Please provide a more descriptive subject. It should at ...
4 years, 9 months ago (2016-03-23 14:08:25 UTC) #5
Justin Novosad
On 2016/03/23 14:08:25, Justin Novosad wrote: > Weird that this file is marled as modified, ...
4 years, 9 months ago (2016-03-23 14:09:26 UTC) #6
xidachen
On 2016/03/23 14:09:26, Justin Novosad wrote: > On 2016/03/23 14:08:25, Justin Novosad wrote: > > ...
4 years, 9 months ago (2016-03-23 14:25:55 UTC) #8
xidachen
https://codereview.chromium.org/1809603004/diff/40001/third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html File third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html (right): https://codereview.chromium.org/1809603004/diff/40001/third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html#newcode21 third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html:21: var halfRed = [26, 0, 0]; On 2016/03/23 14:08:25, ...
4 years, 9 months ago (2016-03-23 15:51:36 UTC) #9
Justin Novosad
On 2016/03/23 15:51:36, xidachen wrote: > https://codereview.chromium.org/1809603004/diff/40001/third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html > File > third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html > (right): > > ...
4 years, 9 months ago (2016-03-23 20:43:15 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1809603004/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1809603004/60001
4 years, 9 months ago (2016-03-23 20:45:28 UTC) #12
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 9 months ago (2016-03-23 23:05:42 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1809603004/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1809603004/60001
4 years, 9 months ago (2016-03-24 01:19:54 UTC) #16
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 9 months ago (2016-03-24 01:25:31 UTC) #18
commit-bot: I haz the power
4 years, 9 months ago (2016-03-24 01:28:06 UTC) #20
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/eb0d622c183ae08eb51e1ca68b84cbb16c564363
Cr-Commit-Position: refs/heads/master@{#383004}

Powered by Google App Engine
This is Rietveld 408576698