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

[whatwg] Offscreen canvas (or canvas for web workers).

From: Maciej Stachowiak <mjs@apple.com>
Date: Mon, 15 Mar 2010 04:22:00 -0700
Message-ID: <6F50DCC7-1273-45C9-BD08-EAFD844C3CBC@apple.com>

On Mar 15, 2010, at 3:46 AM, Philip Taylor wrote:

> On Mon, Mar 15, 2010 at 7:05 AM, Maciej Stachowiak <mjs at apple.com>  
> wrote:
>> Copying from one canvas to another is much faster than copying to/ 
>> from
>> ImageData. To make copying to a Worker worthwhile as a responsiveness
>> improvement for rotations or downscales, in addition to the  
>> OffscreenCanvas
>> proposal we would need a faster way to copy image data to a Worker.  
>> One
>> possibility is to allow an OffscreenCanvas to be copied to and from a
>> background thread. It seems this would be much much faster than  
>> copying via
>> ImageData.
>
> Maybe this indicates that implementations of getImageData/putImageData
> ought to be optimised? e.g. do the expensive multiplications and
> divisions in the premultiplication code with SIMD. (A seemingly
> similar thing at http://bugzilla.openedhand.com/show_bug.cgi?id=1939
> suggests SSE2 makes things 3x as fast). That would avoid the need to
> invent new API, and would also benefit anyone who wants to use
> ImageData for other purposes.

It might be possible to make getImageData/putImageData faster than  
they are currently, certainly the browsers at the slower end of the  
ImageData performance spectrum must have a lot of headroom. But they  
probably also probably have room to optimize drawImage. (Looking back  
at my data I noticed that getImageData + putImageData in Safari is  
about as fast or faster than two drawImage calls in the other browsers  
tested).

In the end, though, I doubt that it's possible for getImageData or  
putImageData to be as fast as drawImage, since drawImage doesn't have  
to do any conversion of the pixel format.

Regards,
Maciej
Received on Monday, 15 March 2010 04:22:00 UTC

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