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

Issue 613513 link

Starred by 10 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jun 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

canvas drawImage not working with Android camera capture via file <input>

Reported by jimmy.ch...@gmail.com, May 20 2016

Issue description

Chrome Version       : 50.0.2661.89 (Android)
URLs (if applicable) : http://liveweave.com/rAHoR4 , http://js.do/code/95817
Other browsers tested:
  It's OK with Android 6.0 native browser and Opera browser

What steps will reproduce the problem?
(1)Click the button to choose a picture
(2)Select the "Camera" to take a photograph(2.png)

What is the expected result?
The photograph should be draw on canvas. 

What happens instead?
But it doesn't show. And the other canvas also affected. The content of the canvas become empty too.(3.png)
it's OK with select a picture with "Document".(2.png)

Please provide any additional information below. Attach a screenshot if
possible.

I also figure out a condition. 
1. use "Camera" in the left
2. use "Document" in the right
After the step 2, both canvas will show.(4.png)

 
Components: Blink>Canvas
Labels: OS-Android
Seems like an Android OS issue as per the description. Marking the OS label appropriately.

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

Cc: vmp...@chromium.org
Owner: junov@chromium.org
Status: Assigned (was: Unconfirmed)
Summary: canvas drawImage not working with Android camera capture via file <input> (was: canvas preview issue)
I found out that if you put the phone to sleep and wake it up, the canvas contents appear.

I suspect this is an issue with how "display list canvas" interacts with deferred decoding.

@vmpstr: when deferred-decoded images are passed to the compositor, embedded in an SkPicture, what is the mechanism that triggers the required decodes?  In this case, the images are embedded indirectly in a nested SkPicture via SkPictureImageFilter.

What I think is happening that the first time the compositor rasterizes the SkPicture, there are some not yet decoded images that get bypassed. The second time the the content is rasterized (due to some form of invalidation), the images appear.  It's as if rasterization did not force images to be synchronously decoded.
Cc: chrishtr@chromium.org
The deferred images are processed by the compositor right now if they appear as a drawImage{,Rect} calls. If there is an image that appears as an SkPictureImageFilter, then we just pass that straight to Skia and rely on Skia to do the decode.

It should never be the case that we skip the image altogether and rasterize content without it. That is, if the image isn't decoded at the time of raster, both Skia and the compositor should be decoding it synchronously. Is it possible that the first time the image appears there is no associated invalidation with it?

That is, if we rasterize content, and the image is inserted without invalidation, then we won't rerasterize the content. Later, when you force an invalidation the image is rasterized.


Comment 5 by junov@chromium.org, Jun 6 2016

Okay, so synchronous decodes are forced at raster time if necessary.  That's the bit I really needed to know.

Bad invalidations are definitely a possible cause, but I would expect the problem to be more widespread if that were the case. I will look deeper into that.
Project Member

Comment 6 by bugdroid1@chromium.org, Jun 8 2016

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

commit 6cfd221afcf593c701f2fce3ffbebdb4b2201968
Author: junov <junov@chromium.org>
Date: Wed Jun 08 21:26:40 2016

Fix 2D canvas entiring invalid state when painted during hibernation

painting a canvas while the canvas is in a hibernation state was causing
the canvas to allocate a non-accelerated surface backing, which would
later cause GPU texture preparation to fail after exiting from hibernation.
This fix prevents "Canvas2DLayerBridge::newImageSnapshot()" from triggering
the creation of a surface whil the canvas is in a hibernating state.

BUG= 613513 

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

[modify] https://crrev.com/6cfd221afcf593c701f2fce3ffbebdb4b2201968/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
[modify] https://crrev.com/6cfd221afcf593c701f2fce3ffbebdb4b2201968/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp

Comment 7 by junov@chromium.org, Jun 9 2016

Status: Fixed (was: Assigned)

Comment 8 by junov@chromium.org, Jun 13 2016

Cc: trchen@chromium.org junov@chromium.org timloh@chromium.org brajkumar@chromium.org
 Issue 602246  has been merged into this issue.

Comment 9 by junov@chromium.org, Jun 13 2016

 Issue 607243  has been merged into this issue.

Comment 10 by junov@chromium.org, Jun 13 2016

 Issue 599177  has been merged into this issue.

Sign in to add a comment