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

Issue 786381 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

getImageData return different data when call twice with setInterval/setTimeout/requestAnimationFrame

Reported by liuhao...@gmail.com, Nov 17 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36

Steps to reproduce the problem:
1. create a canvas element and then fill in a picture
2. run below code in console (developer tools)

var canvas = document.querySelector('canvas');
var context = canvas.getContext('2d');
var count = 0;
var fragment = [];
var timerId = setInterval(function () {
    const isEqualView = (buf1, buf2) => buf1.byteLength === buf2.byteLength && buf1.every((value, index) => value === buf2[index]);
    const imgData = context.getImageData(0, 0, canvas.width, canvas.height);
    if (count > 2) {
        console.log(isEqualView(fragment[fragment.length - 1].data, imgData.data));
        clearInterval(timerId);
        return;
    }
    fragment.push(imgData);
    count++;
}, 10);

3. first output in console: false
4. then run again, output: true

What is the expected behavior?
always output true value

What went wrong?
getImageData return different data when call twice

WebStore page: 

Did this work before? N/A 

Chrome version: 62.0.3202.94  Channel: stable
OS Version: 10.0
Flash Version: 

also test on 64.0.3271.0 (正式版本) canary (64 位) (cohort: Clang-64)
 
Labels: Needs-Triage-M62

Comment 2 Deleted

Comment 3 by woxxom@gmail.com, Nov 18 2017

Using example link in #c2
Expected: all console output is "true"
Observed: one console output is "false"

Bisect info: 463299 (good) - 463312 (bad)
https://chromium.googlesource.com/chromium/src/+log/5ba2e0f7..2aa39598?pretty=fuller
Suspecting r463307 = 67774f8b275a884f3571cbb0f24a687c73380a7e = https://crrev.com/2802353002 by fserb@chromium.org
"getImageData now finalizesFrame and disableAcceleration updates composit"
Landed in 59.0.3068.0

Since there's also a V8 update in the found range, doing a per-revision bisect might be reasonable.
Cc: sc00335...@techmahindra.com
Components: Blink>Canvas
Labels: -Type-Bug -Pri-2 Triaged-ET M-64 hasbisect OS-Linux OS-Mac Pri-1 Type-Bug-Regression
Owner: fs...@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce this issue on reported version 62.0.3202.94 and on latest canary 64.0.3274.0 using Mac 10.12.6,Ubuntu 14.04 and Windows 10.

As per comment#3 Suspecting https://crrev.com/2802353002  from above changelog.

@fserb: Please confirm the issue and help in re-assigning if it is not related to your change.

Thanks!
Bump. This is a P1 Regression bug that has fallen outside the 30 day window for fixing. Please let us know if you are unable to work on this.

Comment 6 by fs...@chromium.org, Jan 23 2018

Cc: fs...@chromium.org
Components: -Platform>Extensions
Labels: -Pri-1 Pri-2
Owner: zakerinasab@chromium.org
Those different pixels are off-by-one errors on semi transparent pixels, due to the change between accelerated and non-accelerated canvas.

Although it's probably a mistake in Skia pixel loading on premul (which is why I'm assigning to @zakerinasab) it's not a high priority thing, but we should keep track of it just in case. It kinda sucks that GetImageData gets sideeffects. :/

Comment 7 by liuhao...@gmail.com, Mar 20 2018

Update example.(I delete above example link)
example.zip
40.1 KB Download
Owner: ----
Status: Available (was: Assigned)

Sign in to add a comment