W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2012

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 20 Mar 2012 18:41:56 -0400
Message-ID: <4F6907B4.6050406@mit.edu>
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
Received on Tuesday, 20 March 2012 15:41:56 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:40 UTC