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

Re: [whatwg] Hardware accelerated canvas

From: Charles Pritchard <chuck@jumis.com>
Date: Tue, 04 Sep 2012 22:38:38 -0700
Message-ID: <5046E55E.4000406@jumis.com>
To: Rik Cabanier <cabanier@gmail.com>
Cc: whatwg@lists.whatwg.org, Erik Möller <emoller@opera.com>
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
Received on Wednesday, 5 September 2012 05:39:07 UTC

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