[whatwg] Canvas pixel manipulation and performance
Boris Zbarsky
bzbarsky at MIT.EDU
Sun Nov 29 20:48:04 PST 2009
On 11/29/09 11:22 PM, Oliver Hunt wrote:
> The CanvasPixelArray implementation in WebKit has always matched the
> spec and been a clamping bytearray, eg. one byte per channel, per
> pixel.
I assume you mean "the spec as it is now" and not "the spec as it was
when Gecko implemented get/putImageData"? The latter was quite
different, as I recall.
> Just for future reference for all who are interested: in WebKit the JS interface to a DOM object is merely a binding to a C++ implementation
Sure; the point is that in Gecko the thing returned by
getImageData().data is not a DOM object at all but a JS Array.
Similarly, the object returned by getImageData() is not a DOM object,
but a JS Object. Likewise, putImageData accepts any JS Object with the
right properties on it (width, height, and data).
I _think_ as of when the implementation was created some of this (e.g.
the putImageData behavior) was called for by the then-whatwg spec. See
http://www.whatwg.org/specs/web-apps/2007-10-26/ for example; I believe
there were other drafts between the 2005-01 draft and that one that had
still other behavior.
As you note the spec has since changed; the Gecko implementation hasn't
been changed yet pending us having some indication that the spec is
actually stable now. Once burnt, twice shy and all.
In any case, I simply didn't know whether CanvasPixelArray was
implemented as a host object or a native object in webkit, and didn't
want to make any claims about it as a result.
-Boris
More information about the whatwg
mailing list