mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-16 14:32:18 +00:00
LibGfx/WebPWriter: Use write_VP8L_chunk() in animation frame writing
This code path still has a redundant copy of the compressed data after this change, but it's less code this way. No behavior change.
This commit is contained in:
parent
885a3d8c5c
commit
c183f73922
Notes:
sideshowbarker
2024-07-17 08:13:43 +09:00
Author: https://github.com/nico
Commit: c183f73922
Pull-request: https://github.com/SerenityOS/serenity/pull/24332
1 changed files with 1 additions and 7 deletions
|
@ -440,17 +440,11 @@ ErrorOr<void> WebPAnimationWriter::add_frame(Bitmap& bitmap, int duration_ms, In
|
|||
return Error::from_string_literal("Frame does not fit in animation dimensions");
|
||||
|
||||
// FIXME: The whole writing-and-reading-into-buffer over-and-over is awkward and inefficient.
|
||||
AllocatingMemoryStream vp8l_header_stream;
|
||||
TRY(write_VP8L_header(vp8l_header_stream, bitmap.width(), bitmap.height(), true));
|
||||
auto vp8l_header_bytes = TRY(vp8l_header_stream.read_until_eof());
|
||||
|
||||
auto vp8l_data_bytes = TRY(compress_VP8L_image_data(bitmap));
|
||||
|
||||
AllocatingMemoryStream vp8l_chunk_stream;
|
||||
TRY(write_chunk_header(vp8l_chunk_stream, "VP8L"sv, vp8l_header_bytes.size() + vp8l_data_bytes.size()));
|
||||
TRY(vp8l_chunk_stream.write_until_depleted(vp8l_header_bytes));
|
||||
TRY(vp8l_chunk_stream.write_until_depleted(vp8l_data_bytes));
|
||||
TRY(align_to_two(vp8l_chunk_stream));
|
||||
TRY(write_VP8L_chunk(vp8l_chunk_stream, bitmap.width(), bitmap.height(), true, vp8l_data_bytes));
|
||||
auto vp8l_chunk_bytes = TRY(vp8l_chunk_stream.read_until_eof());
|
||||
|
||||
ANMFChunk chunk;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue