bk138 / gromit-mpx

Gromit-MPX is an on-screen annotation tool that works with any Unix desktop environment under X11 as well as Wayland.
GNU General Public License v2.0
1.01k stars 84 forks source link

Unlimited (100x) undo buffer with compression #201

Closed pascal-niklaus closed 7 months ago

pascal-niklaus commented 8 months ago

This (small) PR implements LZ4 compression of the undo buffers.

LZ4 compression/decompression is very fast, and with the drawings I tested, achieves a compression down to 1.5-2.5% of the original buffer. Hence, this allows for a very deep undo buffer without significant memory penalty. I have fixed it at 100 which for practical purposes is unlimited.

The entire logic of the undo system remains unaltered.

The only difference is that swap_surface includes a compression/decompression step.

The undo buffers are only allocated once they are needed, and they are successively grown when this is necessary.

pascal-niklaus commented 8 months ago

Sorry, I have parts in the PR that were not meant to be in there. Not sure how this happens. I will tidy this up now...