From 29b840451f15c6285dcb26522bd33f3ff90db43a Mon Sep 17 00:00:00 2001 From: Fernando Serboncini Date: Wed, 22 Mar 2017 03:42:29 -0400 Subject: [PATCH] Change {get,put,create}ImageData() arguments to long getImageData(), putImageData(), and createImageData() double arguments had undefined behavior and implementation incompatibilities. Reverting them back to long makes it well defined. Tests: https://github.com/w3c/web-platform-tests/pull/5180. Fixes #2433. --- source | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/source b/source index b212dcbbd58..bf52f596ad8 100644 --- a/source +++ b/source @@ -60166,11 +60166,11 @@ interface CanvasDrawImage { [NoInterfaceObject, Exposed=(Window,Worker)] interface CanvasImageData { // pixel manipulation - ImageData createImageData(double sw, double sh); + ImageData createImageData(long sw, long sh); ImageData createImageData(ImageData imagedata); - ImageData getImageData(double sx, double sy, double sw, double sh); - void putImageData(ImageData imagedata, double dx, double dy); - void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); + ImageData getImageData(long sx, long sy, long sw, long sh); + void putImageData(ImageData imagedata, long dx, long dy); + void putImageData(ImageData imagedata, long dx, long dy, long dirtyX, long dirtyY, long dirtyWidth, long dirtyHeight); }; enum CanvasLineCap { "butt", "round", "square" }; @@ -64454,26 +64454,6 @@ v6DVT (also check for '- -' bits in the part above) --> -

The handling of pixel rounding when the specified coordinates are not integers is not defined - by this specification, except that the following must result in no visible changes to the - rendering:

- -
context.putImageData(context.getImageData(x, y, w, h), p, q);
- -

...for any value of x, y, w, and - h and where p is the smaller of x - and the sum of x and w, and q is - the smaller of y and the sum of y and h; and except that the following two calls:

- -
context.createImageData(w, h);
-context.getImageData(0, 0, w, h);
- -

...must return ImageData objects with the same dimensions as each other, for any - value of w and h. In other words, while user agents may - round the arguments of these methods, any rounding performed must be performed consistently for - all of the methods described in this section. (The constructors only work with integer - values.)

-

Due to the lossy nature of converting to and from premultiplied alpha color values, pixels that have just been set using putImageData() might be returned to an equivalent @@ -120023,6 +120003,7 @@ INSERT INTERFACES HERE fantasai, Felix Sanz, Felix Sasaki, + Fernando Altomare Serboncini, Francesco Schwarz, Francis Brosnan Blazquez, Franck 'Shift' Quélain,