Issue metadata
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 descriptionUserAgent: 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)
,
Sep 20 2016
,
Sep 21 2016
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!
,
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?
,
Sep 28 2016
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).
,
Oct 3 2016
,
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/
,
Dec 7 2016
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.
,
Dec 8 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d9b157453d029d17966766dfcf7564fbc03d7c6e commit d9b157453d029d17966766dfcf7564fbc03d7c6e Author: junov <junov@chromium.org> Date: Thu Dec 08 02:11:17 2016 Add missing paint invalidation when creating canvas 2d context with no alpha BUG= 647903 Review-Url: https://codereview.chromium.org/2558973002 Cr-Commit-Position: refs/heads/master@{#437143} [add] https://crrev.com/d9b157453d029d17966766dfcf7564fbc03d7c6e/third_party/WebKit/LayoutTests/fast/canvas/canvas-no-alpha-invalidation-expected.html [add] https://crrev.com/d9b157453d029d17966766dfcf7564fbc03d7c6e/third_party/WebKit/LayoutTests/fast/canvas/canvas-no-alpha-invalidation.html [modify] https://crrev.com/d9b157453d029d17966766dfcf7564fbc03d7c6e/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
,
Dec 12 2016
,
Dec 12 2016
@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)
,
Dec 12 2016
Right. That is a separate bug. I filed it as issue 673416 |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by f...@opera.com
, Sep 19 2016