VOCC / vocc

A web-based Gameboy Advance image editor and converter
9 stars 5 forks source link

Canvas performance improvements #55

Closed lbussell closed 4 years ago

lbussell commented 4 years ago

Turns out you can draw canvases on other canvases. See the "Compositing" section of the CanvasRenderingContext2D documentation.

If we create a sub-canvas for drawable images, it only needs to be re-drawn when we change a pixel, and we would only have to draw over that pixel. Then we can just draw the sub-canvas at whatever zoom/pan we want on the main canvas (ImageCanvas). We can also have another sub-canvas for gridlines so that we never have to redraw it