markfarnan/go-canvas

Remove copybuff

amis-shokoohi opened this issue · 0 comments

// TODO: This currently does multiple data copies. go image buffer -> JS Uint8Array, Then JS Uint8Array -> ImageData, then ImageData into the Canvas.

It is possible to copy
c.image.Pix ( []uint8 ) to
c.imgData.Get("data") ( Uint8ClampedArray ) in one shot:

js.CopyBytesToJs(c.imgData.Get("data"), c.image.Pix)

So c.copybuff is not needed anymore.