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

Issue 709695 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 667431
issue 701942



Sign in to add a comment

canvas: Image color profiles are ignore in color correct rendering mode

Project Member Reported by ccameron@chromium.org, Apr 8 2017

Issue description

When running with --enable-color-correct-rendering, images' embedded color spaces are ignored when they are drawn to a <canvas>.

For non-canvas rasterized content (in  issue 701942 ), we are using SkCreateColorSpaceXformCanvas to wrap our canvas, which will provide appropriate color space conversion.
 
Attached example page -- the green bars should be on the top.
Cc: msarett@chromium.org brianosman@chromium.org
Components: Blink>Canvas
Summary: canvas: Image color profiles are ignore in color correct rendering mode (was: canvas: Image color profiles are ignore in color correct rendering modee)
In the case of non-displaylist canvas, throwing a SkCreateColorSpaceXformCanvas into Canvas2DLayerBridge::flushRecordingOnly seems to be good enough

For displaylist canvas, it's not as clear -- we're playing back into a SkCreateColorSpaceXformCanvas through RasterSource, but the conversion isn't happening. A quick stack of one of the places where we're not requesting the color space is:

        blink::DecodingImageGenerator::onGetPixels(
        SkImageGenerator::getPixels(
        SkImageGenerator::tryGenerateBitmap(
        SkImageCacherator::generateBitmap(
        SkImageCacherator::tryLockAsBitmap(
        SkImageCacherator::lockAsBitmap(
        SkImage_Generator::getROPixels(
        SkBaseDevice::drawImageRect(
        SkCanvas::onDrawImageRect(
        SkCanvas::drawImageRect(
        SkCanvas::legacy_drawImageRect(
        void SkRecords::Draw::draw<SkRecords::DrawImageRect>(
        void SkRecords::Draw::operator(
        decltype(
        decltype(
        SkRecordDraw(
        SkBigPicture::playback(
        SkCanvas::drawPicture(
        SkCanvas::drawPicture(
        SkCanvas::drawPicture(
        SkPictureImageFilter::drawPictureAtDeviceResolution(
        SkPictureImageFilter::onFilterImage(
        SkImageFilter::filterImage(
        SkBitmapDevice::drawSpecial(
        SkCanvas::internalDrawDevice(
        SkCanvas::internalRestore(
        SkCanvas::restore(
     *  SkColorSpaceXformCanvas::willRestore(
        SkCanvas::restore(
        void SkRecords::Draw::draw<SkRecords::Restore>(
        void SkRecords::Draw::operator(
        decltype(
        decltype(
        SkRecordDraw(
        SkBigPicture::playback(
        cc::(
        cc::DisplayItemList::Raster(
        cc::RasterSource::RasterCommon(

I'll dig into it more next week.
I updated the test page and attached it, and it appears that it isn't just the images that aren't being converted during playback. It appears that none of the <canvas> draw commands are color converted.
canvas.html
900 bytes View Download
rgb-profile-spin.png
4.4 KB View Download
Filed https://bugs.chromium.org/p/skia/issues/detail?id=6512 on the display-list mode (with a hacky fix...).

Uploaded https://codereview.chromium.org/2820823004/ which fixes the layer-bridge issue, but I may want to refactor things a bit there.
Project Member

Comment 6 by bugdroid1@chromium.org, Apr 18 2017

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

commit 2639037b06c07f5613640e1a5f5a98c5932cb8a0
Author: ccameron <ccameron@chromium.org>
Date: Tue Apr 18 00:05:45 2017

Make Canvas2DLayerBridge use SkColorSpaceXformCanvas

This makes legacy mode canvases render into sRGB (transforming images
as needed).

BUG= 709695 

Review-Url: https://codereview.chromium.org/2820823004
Cr-Commit-Position: refs/heads/master@{#465069}

[modify] https://crrev.com/2639037b06c07f5613640e1a5f5a98c5932cb8a0/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Blocking: 667431
Status: Fixed (was: Assigned)
These two examples are working on ToT now, closing.

Sign in to add a comment