Re: [whatwg] Canvas in workers

On Tue, Oct 15, 2013 at 8:30 PM, Kenneth Russell <kbr@google.com> wrote:

> On Tue, Oct 15, 2013 at 4:41 PM, Robert O'Callahan <robert@ocallahan.org>
> wrote:
> > If you squint, WorkerCanvas.transferToImageBitmap is similar to
> detaching a
> > DrawingBuffer. But I don't see a need to reattach a buffer to a canvas
> for
> > further drawing. Do you?
>
> Not immediately. The ability to transfer out the canvas's contents,
> and render them in an HTMLImageElement without incurring an extra
> blit, should address the Maps team's requirements.
>

WorkerCanvas.copyToImageBitmap could be just as effective with a proper
lazy copy-on-write mechanism. It would offer the same performance in cases
where you would just need to transfer (as opposed to copy) the buffer, with
the added flexibility that it reattaches a new buffer to the canvas, only
if needed (at next draw).  Also the lazy copy can be skipped if the next
draw operation to the canvas context is a clear, in which case the UA only
needs to attach an uninitialized buffer.

Also, because ImageBitmaps are immutable objects, the API should probably
be more like var imageBitmap = createImageBitmap(myWorkerCanvas);

Received on Wednesday, 16 October 2013 12:39:30 UTC