[whatwg] Proposal: ImageData constructor or factory method with preexisting data

Boris Zbarsky bzbarsky at MIT.EDU
Mon Mar 11 21:52:34 PDT 2013


On 3/11/13 11:58 PM, Rik Cabanier wrote:
>> If there are use cases for creating an ImageData, I recommend not making a
>> copy, so all this is doing is taking an existing ArrayBuffer and creating a
>> thin wrapper around the same buffer.
>>
>
> I think that would make implementations that defer rendering much more
> complex and slower. (It would force putImage to execute immediately since
> it doesn't know if the buffer will change in JS)

You never know this anyway with an ImageData, since the data inside it 
can be mutated from JS.  So any existing implementation of putImageData 
must copy the data immediately or do COW or somehow prove that the data 
won't be mutated in JS or something.

-Boris



More information about the whatwg mailing list