Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for customize inflate #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kanryu
Copy link

@kanryu kanryu commented Dec 27, 2018

hi,

I tried to customize inflate () in your library, but actually I could not. Because custom_inflate will always be 0.

Therefore, I propose to add lodepng_decoder_settings_user_regist() API. Calling this API before actually handling png first will customize the initialization by lodepng_decoder_settings_init() and will be able to use custom_inflate etc.

Another suggestion is to add size_t outbuffsize to the custom_inflate function. In other deflate implementations such as libdeflate, the memory size secured in the output destination buffer is required as a parameter. If you give 0 to this you can not actually return an error.

// initial setting
LodePNGDecoderSettings decoderSettings = { 0 };
lodepng_decoder_settings_init(&decoderSettings);
decoderSettings.zlibsettings.custom_inflate = my_custom_inflate;
lodepng_decoder_settings_user_regist(&decoderSettings);
// begin decoding
error = lodepng_decode32_file(&image, &width, &height, filename);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant