mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
LibGfx/JPEG: Take the quality as an argument instead of hardcoding it
This commit is contained in:
parent
05c8ad4e91
commit
a58c7fe322
2 changed files with 10 additions and 6 deletions
|
@ -475,14 +475,12 @@ ErrorOr<void> add_scan_header(Stream& stream)
|
|||
|
||||
}
|
||||
|
||||
ErrorOr<void> JPEGWriter::encode(Stream& stream, Bitmap const& bitmap)
|
||||
ErrorOr<void> JPEGWriter::encode(Stream& stream, Bitmap const& bitmap, Options const& options)
|
||||
{
|
||||
JPEGEncodingContext context { JPEGBigEndianOutputBitStream { stream } };
|
||||
|
||||
// FIXME: Let's take the quality as an option instead of hardcoding it
|
||||
// (there might also be a bug with quantization tables :^)).
|
||||
context.set_luminance_quantization_table(s_default_luminance_quantization_table, 100);
|
||||
context.set_chrominance_quantization_table(s_default_chrominance_quantization_table, 100);
|
||||
context.set_luminance_quantization_table(s_default_luminance_quantization_table, options.quality);
|
||||
context.set_chrominance_quantization_table(s_default_chrominance_quantization_table, options.quality);
|
||||
|
||||
context.dc_luminance_huffman_table = s_default_dc_luminance_huffman_table;
|
||||
context.dc_chrominance_huffman_table = s_default_dc_chrominance_huffman_table;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue