The HTML standard is not clear on how CanvasRenderingContext2D.getImageData should handle floating point parameters:
https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-getimagedata
This has led to different behavior of browsers when floating point parameters are passed to getImageData. Here is the number of pixels returned by each browser when the given set of parameters is passed to getImageData:
Parameters Chrome Opera Firefox IE & Edge
(1, 1, 1, 1) 1 1 1 1
(1.5, 1.5, 1, 1) 4 4 1 1
(1, 1, 1.5, 1) 2 2 1 2
(1, 1, 1.5, 1.5) 4 4 1 4
(1.01, 1.01, 1.01, 1.01) 4 4 1 1
(1.5, 1.5, 1.5, 1.5) 4 4 1 1
(1.99, 1.99, 1.99, 1.99) 9 9 1 4
Safari is not tested. The test script is attached.
|
Deleted:
getImageData-floatingPointParameters.html
808 bytes
|
|
getImageData-floatingPointParameters.html
808 bytes
View
Download
|
Comment 1 by fs...@chromium.org
, Mar 9 2017