New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 733274 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature

Blocked on:
issue skia:6874

Blocking:
issue 634542



Sign in to add a comment

Turn on color correct rendering in canvas

Project Member Reported by zakerinasab@chromium.org, Jun 14 2017

Issue description

As discussed with ccameron@, we can remove canvas color extensions and turn on color correct rendering by default for canvas. The legacy behavior can be detected by using CanvasColorParams::UsesOutputSpaceBlending() API (and the fact that user has not provided a color space).
 
I'll check this to make sure, but I expect providing any part of CanvasRenderingContext2DSettings [1] or ImageDataColorSettings [2] trigger the color correct rendering in canvas code.

[1] https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md#the-colorspace-canvas-creation-parameter

[2] https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md#imagedata
There is only one issue with CreateImageBitmap colorSpaceConversion option. The legacy behavior for "default" is to color convert to display color space, and the current color corrected behavior is to color convert to SRGB. We should make a decision on what to do when color correct rendering is on by default.
Clarification: color correct rendering behavior will remain behind experimental canvas features.
Huh, it seems that we cannot do this as there is no way to find out if the provided attribute (for example the color space in CanvasContextCreationAttributes) is the default value or is provided in js.
Blockedon: skia:6874

Comment 6 by pdk...@gmail.com, Jul 26 2017

I have a question as to how to interpret this bug. It's not clear to me if the feature is implemented yet, but off by default, or not.

I enabled experimental canvas in flags, and it recognizes colorSpace in getContext (in that it complains about an invalid value such as "sRGB"), but a profile-less image displayed with drawImage was not assumed to be sRGB. I also tried "bitmaprenderer" rather than "2d", with the same effect.

Comment 7 by pdk...@gmail.com, Jul 26 2017

PS. It's a separate issue, but I was surprised how slow "bitmaprenderer" in combination with createImageBitmap and transferToImageBitmap is, compared to using drawImage on "2d". Perhaps there's already a bug for that someone can point me to.
@pdknsk #6: This feature is "almost" implemented but it might have some bugs, and it is off by default. I suggest waiting until we address the remaining issues.

To test the feature anyway, you need both --enable-experimental-canvas-features and --enable-color-correct-rendering flags. You should not need to set any color space or so, as it should silently set sRGB as the color space of the canvas and other resources.

Comment 9 by pdk...@gmail.com, Jul 27 2017

I enabled both flags now, but it doesn't have the desired effect. Instead,
it causes the image to not even be rendered. I'll wait.
Interesting. Would you please attach the test page?

Comment 11 by pdk...@gmail.com, Jul 27 2017

​It's from an internal page, so I'd have to reduce it.​

I figured out that it only affects images that don't match canvas-size.
(Using 1 + 8 parameters with drawImage to crop the image.) Images with
exact canvas-size render fine.

I also noticed severe (non-canvas) image corruption
when enable-color-correct-rendering is used with enable-gpu-rasterization,
like with this simple icon.

https://ssl.gstatic.com/ui/v1/icons/mail/no_photo.png
http://cdn.pwmon.org/chrome/no_photo.png
pdknsk@: I can see that the second icon has some artifacts (the first one is okay) but I don't think this is a Chromium bug. I can see the same artifacts in  Firefox or when using wget + gimp. I guess something might be happening on your server side (image manipulation may be? like  crbug.com/747640#c30 ?).

Comment 13 by pdk...@gmail.com, Aug 2 2017

(​It's a cropped screenshot of the icon.​)

Comment 14 by pdk...@gmail.com, Aug 3 2017

I've recorded a video in which I switch between the affected tab, and an empty tab, in order to redraw the affected tab.

Comment 15 by pdk...@gmail.com, Aug 3 2017

Oh, Monorail doesn't like such narrow videos.

http://cdn.pwmon.org/chrome/icon.webm
Project Member

Comment 16 by bugdroid1@chromium.org, Aug 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/037613aa74af94a82dce77e1e246f1f5364c0cfa

commit 037613aa74af94a82dce77e1e246f1f5364c0cfa
Author: Reza.Zakerinasab <zakerinasab@chromium.org>
Date: Mon Aug 14 16:26:25 2017

Respect color correct rendering mode in canvas 2D

This change respects color correct rendering mode in canvas for layout
tests. Color correct rendering was turned on before for layout tests but
was not correctly applied to canvas code.

Bug:  733274 
Change-Id: I668162a9ea2b0851b3d68dff83898f442496fcc9
Reviewed-on: https://chromium-review.googlesource.com/598500
Commit-Queue: Mohammad Reza Zakerinasab <zakerinasab@chromium.org>
Reviewed-by: Justin Novosad <junov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#494067}
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/TestExpectations
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/2x2-srgb.png
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8_srgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_srgb.html
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-linear-rgb.html
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-p3.html
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-rec2020.html
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/images/color-profile-image-canvas-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/images/color-profile-image-canvas-pattern-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/images/color-profile-munsell-adobe-to-srgb-expected.txt
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/media/color-profile-munsell-bt601-smpte-to-srgb-expected.txt
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/media/color-profile-munsell-bt709-to-srgb-expected.txt
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/platform/linux/fast/canvas/canvas-imageSmoothingEnabled-patterns-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/media/color-profile-munsell-bt601-smpte-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/media/color-profile-munsell-bt709-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/virtual/display_list_2d_canvas/fast/canvas/canvas-composite-expected.png
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/platform/linux/virtual/display_list_2d_canvas/fast/canvas/canvas-imageSmoothingEnabled-patterns-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/virtual/display_list_2d_canvas/fast/canvas/canvas-incremental-repaint-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/virtual/display_list_2d_canvas/fast/canvas/fillrect_gradient-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/virtual/exotic-color-space/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac-mac10.10/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/exotic-color-space/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/gpu-rasterization/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/images/color-profile-image-canvas-svg-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/media/color-profile-munsell-bt601-smpte-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/media/color-profile-munsell-bt709-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/display_list_2d_canvas/fast/canvas/canvas-composite-expected.png
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/display_list_2d_canvas/fast/canvas/canvas-imageSmoothingEnabled-patterns-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/display_list_2d_canvas/fast/canvas/canvas-incremental-repaint-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/display_list_2d_canvas/fast/canvas/fillrect_gradient-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-image-canvas-svg-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/images/color-profile-image-canvas-svg-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/images/color-profile-image-canvas-svg-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/media/color-profile-munsell-bt601-smpte-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/media/color-profile-munsell-bt709-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/display_list_2d_canvas/fast/canvas/canvas-composite-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/display_list_2d_canvas/fast/canvas/canvas-imageSmoothingEnabled-patterns-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/display_list_2d_canvas/fast/canvas/canvas-incremental-repaint-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/display_list_2d_canvas/fast/canvas/fillrect_gradient-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-image-canvas-svg-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/color-profile-image-canvas-svg-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/color-profile-munsell-adobe-to-srgb-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/virtual/color_space/fast/canvas/color-space/canvas-createPutGetImageData-colorManaged.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/virtual/color_space/fast/canvas/color-space/canvas-getImageData-linear-rgb.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/virtual/color_space/fast/canvas/color-space/canvas-getImageData-p3.html
[add] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/virtual/color_space/fast/canvas/color-space/canvas-getImageData-rec2020.html
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-arc-circumference-expected.png
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-arc-circumference-fill-expected.png
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-composite-transformclip-expected.png
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-ellipse-circumference-expected.png
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-ellipse-circumference-fill-expected.png
[delete] https://crrev.com/d57e6fb2f36f4d08d5454276b28e192fd2b247ea/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-imageSmoothingEnabled-patterns-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/virtual/exotic-color-space/images/color-profile-image-canvas-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/virtual/exotic-color-space/images/color-profile-image-canvas-pattern-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/virtual/gpu-rasterization/images/color-profile-image-canvas-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/LayoutTests/virtual/gpu-rasterization/images/color-profile-image-canvas-pattern-expected.png
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/core/html/ImageData.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/core/imagebitmap/ImageBitmap.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/core/imagebitmap/ImageBitmap.h
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/core/imagebitmap/ImageBitmapTest.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/platform/graphics/CanvasColorParams.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/platform/graphics/CanvasColorParams.h
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
[modify] https://crrev.com/037613aa74af94a82dce77e1e246f1f5364c0cfa/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp

Status: Fixed (was: Assigned)
In the LayoutTests/TestExpectations, there are still a few lines there because of this bug, could you update that?
New bug is filed:  crbug.com/763933 .
Blocking: 634542

Comment 21 by pdk...@gmail.com, Dec 20 2017

Still have the problem in M65. Filed separately.

https://bugs.chromium.org/p/chromium/issues/detail?id=796507

Sign in to add a comment