[whatwg] Hardware accelerated canvas
glenn at zewt.org
Sun Sep 2 17:36:46 PDT 2012
On Sun, Sep 2, 2012 at 4:24 PM, Ian Hickson <ian at hixie.ch> wrote:
> Realistically, there are too many pages that have 2D canvases that are
> drawn to once and never updated for any solution other than "don't lose
> the data" to be adopted. How exactly this is implemented is a quality of
> implementation issue.
If the choice becomes "follow the spec and don't hardware-accelerate
canvas" vs. "don't follow the spec and get orders of magnitude better
performance", I suspect I can guess the choice implementors will make
(implementors invited to speak for themselves, of course). If I was
playing a game rendered with Canvas and one browser had GPU-acceleration
and one did not, I know for sure which one I'd choose.
It wouldn't be very hard to special-case the drawn-one-time case; take a
backing store snapshot after the first render (or the first few), eg. at
the end of the task where drawing was performed. That would allow
restoring those one-shot canvases without imposing a huge cost on canvases
that are drawn to continuously. It'd be a hack and wouldn't work
everywhere (or every time--you can lose the context mid-script, at least in
theory), but it would avoid most breakage while still allowing
GPU-acceleration, so I wouldn't be surprised if implementations compromised
on something like this.
More information about the whatwg