[whatwg] [canvas] request for {create, get, put}ImageDataHD and ctx.backingStorePixelRatio

Boris Zbarsky bzbarsky at MIT.EDU
Tue Mar 20 15:41:56 PDT 2012


On 3/20/12 6:36 PM, Glenn Maynard wrote:
> The drawing calls that happen after would need to be buffered (or
> otherwise flush the queue, akin to calling glFinish), so the operations
> still happen in order.

The former seems like it could get pretty expensive and the latter would 
negate the benefits of making it async, imo.

> putImageData being async makes sense, too, for the same reason: it
> avoids having to flush drawing commands earlier in the queue, which
> helps keep putImageData from blocking.

I don't see why it needs to block at all.  At least in Gecko the 
putImageData basically just becomes a drawing command itself; you send 
it over to the graphics card and forget about it.

> what happens if the argument passed to putImageData is modified before
> it's written?

You have to copy it, yes.  Which you may have to do anyway, because 
imagedata is not premultiplied and for most drawing you want 
premultiplied data.

> You'd either need a mechanism to detect changes, so you
> can make a copy (eg. a copy-on-write mechanism for ArrayBuffer--though
> that sort of sounds useful in its own right), or to just say that any
> changes to made to the buffer before the async operation completes will
> be reflected in the copy.

That seems unfortunately racy.  Also unnecessary, imo.

-Boris



More information about the whatwg mailing list