Optimized drawing memory usage. Now only keeps the minimum pixmap rectangle necessary to perform undo/redo.