LibDEFLATE: Support decompressing to/from partial buffer

We no longer require the user to pass full compressed data in one go,
instead the decompressor reports to the user if it needs more input or
output space.
This commit is contained in:
2026-04-13 01:48:52 +03:00
parent ad12bf3e1d
commit 0156d06cdc
4 changed files with 526 additions and 151 deletions

View File

@@ -431,8 +431,8 @@ namespace LibImage
total_size += stream.size();
dprintln_if(DEBUG_PNG, "PNG has {} byte zlib stream", total_size);
LibDEFLATE::Decompressor decompressor(zlib_stream.span(), LibDEFLATE::StreamType::Zlib);
auto inflated_buffer = TRY(decompressor.decompress());
LibDEFLATE::Decompressor decompressor(LibDEFLATE::StreamType::Zlib);
auto inflated_buffer = TRY(decompressor.decompress(zlib_stream.span()));
auto inflated_data = inflated_buffer.span();
dprintln_if(DEBUG_PNG, " uncompressed size {}", inflated_data.size());