mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-01 07:35:02 +03:00
LibGfx/JPEGWriter: Move image data writing into new add_image() function
No behavior change.
This commit is contained in:
parent
e449dba85b
commit
e8788d4023
Notes:
sideshowbarker
2024-07-17 04:41:05 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/e8788d4023 Pull-request: https://github.com/SerenityOS/serenity/pull/23034 Reviewed-by: https://github.com/LucasChollet ✅
@ -547,19 +547,22 @@ ErrorOr<void> add_headers(Stream& stream, JPEGEncodingContext& context, JPEGWrit
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> add_image(Stream& stream, JPEGEncodingContext& context)
|
||||
{
|
||||
context.fdct_and_quantization();
|
||||
TRY(context.write_huffman_stream());
|
||||
TRY(add_end_of_image(stream));
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ErrorOr<void> JPEGWriter::encode(Stream& stream, Bitmap const& bitmap, Options const& options)
|
||||
{
|
||||
JPEGEncodingContext context { JPEGBigEndianOutputBitStream { stream } };
|
||||
TRY(add_headers(stream, context, options, bitmap.size()));
|
||||
|
||||
TRY(context.initialize_mcu(bitmap));
|
||||
context.fdct_and_quantization();
|
||||
|
||||
TRY(context.write_huffman_stream());
|
||||
|
||||
TRY(add_end_of_image(stream));
|
||||
TRY(add_image(stream, context));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user