gromit-mpx
gromit-mpx copied to clipboard
Added options for editing max undo-history depth
When using the tool I noticed the default amount of undo steps we could make was really low for my needs. It was probably done for memory issues as increasing the max depth to 1000 filled my 16GB ram. Fyi at 2K resolution 100 steps take 1.4GB in my machine.
I added the ability for users to change that through either the .cfg file or the cli.
There is a repeating section of code now throughout the code:
data->undo_steps = (gint) scanner->value.v_float;
data->undobuffer = calloc(data->undo_steps, sizeof(cairo_surface_t*));
for (int i = 0; i < data->undo_steps; i++)
{
cairo_surface_destroy(data->undobuffer[i]);
data->undobuffer[i] = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, data->width, data->height);
}
maybe it should be put inside some function?
Thanks for the contribution! How many steps would suit your use case? Maybe we can simply increase GROMIT_MAX_UNDO?
50 would be sufficient for me. But that will cause the program to claim around a GB of memory due to the way undo is handled on different surfaces.
This way let's people with different specs to decide on their own.
OK, 50 is a lot. I'll review your patch ASAP!
Tentatively closing, feel free to re-open once comments are addressed :-)