It's not sensible to constantly re-allocate large chunks of memoery like this. Creating the maximum space you want a chunk of memoery to be able to take up, is standerd practice. It applies in exactly the same manner to a graphics buffer.
All that a canvas in the way you suggest would do, is constantly create new, copy bits from old to new, destroy old.
Although! a ResizeCanvas(canvas,w,h) that copies the existing data intao resized canvas.. would be good :)
All that a canvas in the way you suggest would do, is constantly create new, copy bits from old to new, destroy old.
Although! a ResizeCanvas(canvas,w,h) that copies the existing data intao resized canvas.. would be good :)