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

Issue 647903 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

getContext('2D', {alpha:false}) dispalys the canvas with white background instead of black

Reported by tristan....@gmail.com, Sep 17 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:49.0) Gecko/20100101 Firefox/49.0

Example URL:
https://jsfiddle.net/hbs4nyub/

Steps to reproduce the problem:
1. Request a new CanvasContext2D with alpha option set to false
2. [Facultative] do any drawing on this context but leave some non-drawn area

What is the expected behavior?
All normally transparent pixels should shown as opaque black.

What went wrong?
At first all transparent pixels are drawn as opaque white.
After some (random ?) time, some pixels are correctly converted to black.
When calling any export methods, every transparent pixels are correctly converted to black.
Also, when a CSS repaint occurs on the canvas, it comes back to normal.

Does it occur on multiple sites: N/A

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 55.0.2862.0 (Official Build) canary (64-bit)  Channel: canary
OS Version: OS X 10.9
Flash Version: Shockwave Flash 23.0 r0

This is already there in stable 53.0.2785.116 (Official Build) (64-bit) still on osX (didn't tried on win)
 

Comment 1 by f...@opera.com, Sep 19 2016

Components: Blink>Canvas
Labels: Needs-Bisect

Comment 3 by ajha@chromium.org, Sep 21 2016

Cc: ajha@chromium.org
Labels: -Pri-2 -Type-Compat -Needs-Bisect M-55 has-Bisect Pri-1 Type-Bug-Regression
Owner: ccameron@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on the latest canary(55.0.2867.0) and the latest stable(53.0.2785.116) on Mac OS 10.11.6, same works fine on Windows 10 and Linux Ubuntu 14.04.

This is a regression issue broken in M-49.

Last good build: 49.0.2566.0
First bad build: 49.0.2567.0

Changelog: https://chromium.googlesource.com/chromium/src/+log/74f8c3c9cb1093bc7c8e88ff6334658b124ea0c8..aaf14fcb702dd2b733eaccb3307c54e18010fb71

Suspected change: https://codereview.chromium.org/1430813002

ccameron@: Could you please take a look at this.

Thank you!

Comment 4 by junov@chromium.org, Sep 23 2016

I was wondering if this could be a paint invalidation bug where only the bounding rect of the drawn primitive was getting updated. So I tried an experiment by drawing a non fillRect primitive in order to get an update rect that is different from the primitive.

I tried changing the fillRect to a strokeRect in the fiddle, and the inside of the rect was initially white.  This means what we have is a compositing bug, not a paint invalidation bug.

The canvas in this example is in "display list" mode and the call to getImageData/toDataURL/toBlob causes the canvas to switch to software rendering mode.

In display list mode, the content of the canvas get rasterized by the compositor into a skia "saveLayer".  with the alpha:false option, we end up using the 'source' composite operation (as opposed to source-over) when painting the saveLayer onto its parent layer.  This step seems to be what is broken.  Al of this happen withing impl-side painting.

@ccameron: your change does not affect Impl-side painting AFAICT, but is it possible that it may be changing the GL state of the compositor's GL context in a way that interferes with ganesh?  Ganesh keeps it's own cache of the GL state in order to optimize-out unnecessary GL API calls. If ganesh's cached state falls out of sync with the GL context due to GL being used directly, ganesh needs to be notified (cache dirtied).  Do you think that could be it?
Owner: ----
Status: Available (was: Assigned)
I see lots of flickering here. I also ran this without the CoreAnimation renderer enabled (which is related to that patch), and I still got flickering.

Of note is that the flickering is very flakey, so I'd be careful about trusting a bisect (or guarantees that it is Mac-specific).
flicker.mov
987 KB Download

Comment 6 by junov@chromium.org, Oct 3 2016

Owner: junov@chromium.org
Status: Assigned (was: Available)

Comment 7 by tbe...@gmail.com, Nov 2 2016

We see a potentially related issue here: http://stackoverflow.com/questions/40353969/html-canvas-silently-drops-frames-requestanimationframe

And here's a jsfiddle that occasionally shows some ghosting or partial draws on both Linux and OS X: https://jsfiddle.net/gdbsb564/7/

Comment 8 by junov@chromium.org, Dec 7 2016

Status: Started (was: Assigned)
Had trouble reproducing in recent build.  Here is an updated fiddle that reproduces the problem more reliably by adding a delay before the first draw: https://jsfiddle.net/hbs4nyub/2/

In this case, even uncommenting one of the lines that triggers a software rendering fallback doe not fix the problem.  This is clearly a paint invalidation issue.

Comment 10 by junov@chromium.org, Dec 12 2016

Status: Fixed (was: Started)
@junov, Glad you fixed it, does it also pass this test https://jsfiddle.net/kpkov098/ ? Because I found this this week-end and it would tend to say that it's not only a display bug, since at this point the display is ok, but the value returned by getImageData is not. (according to specs (https://html.spec.whatwg.org/multipage/scripting.html#output-bitmap), clearRect() should set the alpha bits to 255)

Comment 12 by junov@chromium.org, Dec 12 2016

Right.  That is a separate bug. I filed it as issue 673416

Sign in to add a comment