Fixes a bug in viewflif : use of pointer after delete
Adds a void *user_data parameter to the callback function. This allows, for example, C++ code to register a class member variable as a callback. C code can similarly benefit by having user_data point to a context holding structure. This avoid ugly hacks such as using global context for the callback.
The creation of partial_images is now lazy. The callback function can now decide when to render the partial_images and thus when to create them.
Since the number of parameters to the callback function has grown, and has some private members, I have created a structure callback_info_t to hold them.
The above changes have changed the APIs related to callbacks. Does this require a bump of library version number?
viewflif has been modified to work with the new API.
I have run some benchmarks on small to medium images and measured improvements in overall decode times. The amount of improvement depends on the image, the quality threshold setting, the timeout for rendering the preview, etc. Seems to be in tune with what I would expect. However, I was not able to test with larger images; there are bugs in progressive decode logic (not related to these changes). I see the same bugs on master. One such bug is #381.
void *user_data
parameter to the callback function. This allows, for example, C++ code to register a class member variable as a callback. C code can similarly benefit by havinguser_data
point to a context holding structure. This avoid ugly hacks such as using global context for the callback.partial_images
is now lazy. The callback function can now decide when to render the partial_images and thus when to create them.callback_info_t
to hold them.viewflif
has been modified to work with the new API.Closes #333