[Bug 14326] 2d.imageData.object.round should be updated

https://www.w3.org/Bugs/Public/show_bug.cgi?id=14326

Qiankun Miao <qkmiao@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qkmiao@gmail.com

--- Comment #2 from Qiankun Miao <qkmiao@gmail.com> 2012-03-05 05:30:09 UTC ---
As defined in latest spec (Editor's Draft 29 February 2012) at
http://dev.w3.org/html5/2dcontext/#imagedata, the data of imagedata is
initialized to a Uint8ClampedArray object which maps to a octet type in Web
IDL.  
According to the mapping rule defined at
http://dev.w3.org/2006/webapi/WebIDL/#es-octet, an attribute annotated with the
[Clamp] extended attribute should handle as follows:
1. Round x to the nearest integer, choosing the even integer if it lies halfway
between two.
2. Set x to min(max(x, 0), 2^8 − 1).
3. Return the IDL octet value that represents the same numeric value as x.

e.g.
0.499 -> 0
0.5 -> 0
0.501 -> 1
1.499 -> 1
1.5 -> 2
1.501 -> 2
2.5 -> 2
3.5 -> 4
252.5 -> 252
253.5 -> 254
254.5 -> 254
256.5 -> 255
-0.5 -> 0
-1.5 -> 0

So this test should be updated.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 5 March 2012 05:30:12 UTC