LibGfx: Compress PNGs with a better compression level

While for a general purpose encoder a good balance between compression
speed and size by default is important, in case of PNG it don't matter
that much, as it was said in #14594.

Also note that it's not the best we can have. We use zlib's compression
level, which has a range of 0-4, while our deflate implementation ranges
from 0 to 5.
This commit is contained in:
Karol Kosek 2022-07-15 18:37:27 +02:00 committed by Linus Groh
parent a0546318f9
commit cf69763b54
Notes: sideshowbarker 2024-07-17 08:29:50 +09:00

View File

@ -250,7 +250,7 @@ void PNGWriter::add_IDAT_chunk(Gfx::Bitmap const& bitmap)
uncompressed_block_data.append(best_filter.buffer);
}
auto maybe_zlib_buffer = Compress::ZlibCompressor::compress_all(uncompressed_block_data);
auto maybe_zlib_buffer = Compress::ZlibCompressor::compress_all(uncompressed_block_data, Compress::ZlibCompressionLevel::Best);
if (!maybe_zlib_buffer.has_value()) {
// FIXME: Handle errors.
VERIFY_NOT_REACHED();