javascript - canvas data out of range? problem in FF -
i run code every frame, works great in chrome
data[index + 0] = bgdata[dis + 0]; data[index + 1] = bgdata[dis + 1]; data[index + 2] = bgdata[dis + 2]; data[index + 3] = 255;
but firefox gives error:
an invalid or illegal string specified" code: "12
unless add -1 each line below:
data[index + 0] = bgdata[dis + 0] -1; data[index + 1] = bgdata[dis + 1] -1; data[index + 2] = bgdata[dis + 2] -1; data[index + 3] = 255;
any ideas why might happen? trying optimize code as possible, , understand! data shouldn't out of range obtained by:
bgdata = backgroundcanvasctx.getimagedata(mx, 0, 320, 400).data;
update line causes error is:
overlayimagecanvasctx.putimagedata(imgdata, 0, 0);
Comments
Post a Comment