New issue
Advanced search Search tips

Issue 725372 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 713891



Sign in to add a comment

color: images/color-profile-image-canvas.html layout test ignores image color spaces

Project Member Reported by ccameron@chromium.org, May 23 2017

Issue description

To reproduce:
1. Apply the patch inhttps://codereview.chromium.org/2893243003/
2. Run with and with the command line
  --disable-gpu-rasterization \
  --enable-color-correct-rendering \
  --force-color-profile=srgb \
  --enable-experimental-canvas-features \
  --disable-accelerated-2d-canvas \
3. Open the images/color-profile-image-canvas.html layout test

Expect: Red is at the top
Actual: Blue is at the top
 
This is another instance of us creating a SkSpecialSurface and rendering to its canvas without wrapping that canvas in a SkCreateColorSpaceXformCanvas. This instance is in SkPictureImageFilter::drawPictureAtLocalResolution.

Cc: enne@chromium.org
Actually, the bug in #1 doesn't affect layout tests (only running stand-alone).

The bug that is hitting layout tests is that in the following stack, we don't create an intercepting color transform canvas.

SkCanvas::drawImageRect(SkImage const*, SkRect const&, SkRect const&, SkPaint const*, SkCanvas::SrcRectConstraint) + 197
cc::DrawImageRectOp::RasterWithFlags(cc::PaintOpWithFlags const*, cc::PaintFlags const*, SkCanvas*, SkMatrix const&) + 148 
cc::DrawImageRectOp::Raster(cc::PaintOp const*, SkCanvas*, SkMatrix const&) + 64
cc::PaintOp::Raster(SkCanvas*, SkMatrix const&) const + 68
cc::PaintOpBuffer::playback(SkCanvas*) const + 1423
cc::DrawRecordOp::Raster(cc::PaintOp const*, SkCanvas*, SkMatrix const&) + 56
cc::PaintOp::Raster(SkCanvas*, SkMatrix const&) const + 68
cc::PaintOpBuffer::playback(SkCanvas*) const + 1423
cc::SkiaPaintCanvas::drawPicture(sk_sp<cc::PaintOpBuffer const>) + 44
blink::GraphicsLayer::CheckPaintUnderInvalidations(sk_sp<cc::PaintOpBuffer>) + 863
blink::GraphicsLayer::Paint(blink::IntRect const*, blink::GraphicsContext::DisabledMode) + 225
blink::FrameView::PaintGraphicsLayerRecursively(blink::GraphicsLayer*) + 241
blink::FrameView::PaintGraphicsLayerRecursively(blink::GraphicsLayer*) + 458
blink::FrameView::PaintGraphicsLayerRecursively(blink::GraphicsLayer*) + 458
blink::FrameView::PaintGraphicsLayerRecursively(blink::GraphicsLayer*) + 458
blink::FrameView::PaintGraphicsLayerRecursively(blink::GraphicsLayer*) + 458
blink::FrameView::PaintTree() + 1286
blink::FrameView::UpdateLifecyclePhasesInternal(blink::DocumentLifecycle::LifecycleState) + 2317
blink::FrameView::UpdateAllLifecyclePhases() + 50
blink::PageAnimator::UpdateAllLifecyclePhases(blink::LocalFrame&) + 85
blink::PageWidgetDelegate::UpdateAllLifecyclePhases(blink::Page&, blink::LocalFrame&) + 37
blink::WebViewImpl::UpdateAllLifecyclePhases() + 413

This is relatively easy to fix in this particular situation -- we can create an intercepting color transform canvas in GraphicsLayer::CheckPaintUnderInvalidations.

But ... 

There are ~40 instances where we create a SkiaPaintCanvas for an SkBitmap. Should we automatically create a color-transform canvas ... always? If the SkBitmap has a color space attached? That's a lot of callsites to audit.

There are also ~10 instances where we create a SkiaPaintCanvas for a SkCanvas. Those should probably also be audited.

Comment 3 by enne@chromium.org, May 23 2017

Yeah, I think any place where there is raster occurring you're going to need to add an intercepting color transform canvas.  Maybe we need a SkiaPaintCanvas that knows about color (either in that same class or another derived class).

At least I've made these locations easier to spot for you.  ;)

Comment 4 by enne@chromium.org, May 23 2017

Cc: danakj@chromium.org
+danakj fyi
Project Member

Comment 5 by bugdroid1@chromium.org, May 30 2017

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

commit 30a7f83076be71351b71dfcb6cefee6ec2a9faca
Author: ccameron <ccameron@chromium.org>
Date: Tue May 30 03:10:15 2017

color: Perform color transform in ImageBufferSurface

When we draw a canvas element to a AcceleratedImageBufferSurface or
to a UnacceleratedImageBufferSurface, we must transform the inputs to
the color space specified by the CanvasColorParams it was initialized
with.

To do this, make the SkiaPaintCanvas wrap the SkCanvas in a
SkColorSpaceXformCanvas.

BUG= 725372 
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

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

[modify] https://crrev.com/30a7f83076be71351b71dfcb6cefee6ec2a9faca/cc/paint/skia_paint_canvas.cc
[modify] https://crrev.com/30a7f83076be71351b71dfcb6cefee6ec2a9faca/cc/paint/skia_paint_canvas.h
[modify] https://crrev.com/30a7f83076be71351b71dfcb6cefee6ec2a9faca/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
[modify] https://crrev.com/30a7f83076be71351b71dfcb6cefee6ec2a9faca/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp

Status: Fixed (was: Assigned)

Sign in to add a comment