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)
,
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.
,
Nov 21 2017
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!
,
Jan 2 2018
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.
,
Jan 23 2018
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. :/
,
Mar 20 2018
Update example.(I delete above example link)
,
Jul 30
|
||||
►
Sign in to add a comment |
||||
Comment 1 by manoranj...@chromium.org
, Nov 17 2017