[whatwg] Hardware accelerated canvas

Charles Pritchard chuck at jumis.com
Tue Sep 4 22:38:38 PDT 2012


On 9/4/2012 10:12 PM, Rik Cabanier wrote:
> Rereading the mail thread, it seems like most people want/can live with a
> callback that informs the developer that the canvas needs to be recreated.

Wouldn't this be more appropriate as a "webgl-2d" extension?

It seems like webgl support is a prerequisite for this kind of work.

If we are going to go down this route, I would like to reiterate my 
prior requests:
low memory condition events, reporting of the Microsoft window.screen 
extensions (for pixel ratios)
and a consideration of on-screen magnification as a reason for 
requesting a per-canvas re-paint.

The latter would be pretty cool to have supported as a UA feature. 
Currently, authors can zoom in with browser zoom (thus the window.screen 
extensions + window.onresize).
I'd love to see magnification added on as well. That's something that we 
do see at the OS-level, where the user zooms in on a particular portion 
of the screen and moves around.

With a per-canvas repaint request, as authors, we could listen for that 
event, and the UA would simply have a transformation matrix appropriate 
to the user's zoom level.
With some consideration of low memory conditions (and perhaps media 
stream processing), we might have more incentive as authors to want to 
hook into these APIs.

I came across the low-memory issue while working on a very memory hungry 
application on the iPhone. At some point, I had to do my own memory 
management and estimation
to keep from running out of RAM (at which point, iOS terminates the 
application).


This whole cluster of use-case has been brought up before on these 
lists. If those cases are taken into account, I think it makes a lot 
more sense to accommodate this hypothetical lost-context issue.
Otherwise, this does just seem like "webgl-2d".

As for performance: nobody has touched the obvious items, like using 
array buffers to describe scenes, instead of using thousands of method 
calls.
It's a hell of a lot better to upload a float16 array of x/y coordinates 
than to run a thousands of drawImage calls (for something like the IE 
fish demo).

I'm asking that, if we're going to take the plunge, we go one way or the 
other. Satisfy this broad range of real-world uses for canvas 2d,
or go the other route, and think about a webgl-2d, which authors could 
select when doing getContext().

-Charles







More information about the whatwg mailing list