mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
ImageDecoder+LibGfx: Collate decoded bitmaps before sending over IPC
There is an issue where gifs with many frames cannot be loaded, as each bitmap is sent over IPC using a separate file descriptor, and there is limit on the maximum number of descriptors per IPC message. Thus, trying to load gifs with more than 64 frames (the current limit) causes the image decoder process to die. This commit introduces the BitmapSequence class, which is a thin wrapper around the type Vector<Optional<NonnullRefPtr<Gfx::Bitmap>>> and provides an IPC encode/decode routine that collates all bitmap data into a single buffer so that only a single file descriptor is required per IPC transfer, even if multiple frames are being sent.
This commit is contained in:
parent
b8a5e18a01
commit
e0bd42be95
Notes:
github-actions[bot]
2024-10-02 21:58:35 +00:00
Author: https://github.com/zack466 🔰
Commit: e0bd42be95
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1435
Reviewed-by: https://github.com/ADKaster ✅
9 changed files with 193 additions and 7 deletions
|
@ -57,8 +57,9 @@ NonnullRefPtr<Core::Promise<DecodedImage>> Client::decode_image(ReadonlyBytes en
|
|||
return promise;
|
||||
}
|
||||
|
||||
void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Vector<Optional<NonnullRefPtr<Gfx::Bitmap>>> const& bitmaps, Vector<u32> const& durations, Gfx::FloatPoint scale)
|
||||
void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gfx::BitmapSequence const& bitmap_sequence, Vector<u32> const& durations, Gfx::FloatPoint scale)
|
||||
{
|
||||
auto const& bitmaps = bitmap_sequence.bitmaps;
|
||||
VERIFY(!bitmaps.is_empty());
|
||||
|
||||
auto maybe_promise = m_pending_decoded_images.take(image_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue