[whatwg] I believe source rectangles for HTML5 Canvas drawImage are specified incorrectly

Justin Novosad junov at chromium.org
Mon Dec 17 11:49:33 PST 2012


> Isn't this the same as what Ian suggested: copy it to a temporary canvas
> and use the temporary canvas scales.
> It seems that you can optimize that case too.
>

Hmm... It would one of those optimizations that only works if you perform
the secret handshake just right.
If I understand correctly, the hypothetical optimization would work
something like this: When a 2d canvas context is created, do not allocate a
backing store immediately. If the first draw operation into the canvas is a
drawImage from an image element and covers the entire canvas, then use a
shallow copy of the bitmap as the backing store. If anything else is drawn
into the canvas, then a proper backing store should be allocated and used.
I guess it could work... but I would fear that this behavior would be
perceived as idiosyncratic.



More information about the whatwg mailing list