Commit Graph

2 Commits

Author SHA1 Message Date
Andrew Kaster
b58fb57a2c LibGfx: Use more Span methods in BitmapSequence instead of memcpy
And a few assorted cleanups to use more moves() to avoid copying Vectors
and NonnullRefPtrs.

(cherry picked from commit 1322a7e91794893755ae5a3510241e74d45720c5)
2024-11-10 17:42:37 -05:00
Zachary Huang
f341138c70 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.

(cherry picked from commit e0bd42be9590b967d0b5788ce7537a861a35ba74;
amended to fix conflict on build files since we still BitmapMixer.cpp
that upstream removed in LadybirdBrowser/ladybird#41, and
BitmapSequence.cpp conflicted with that. Also amended to not have
AlphaType in BitmapMetadata since we don't have that, and to have
scale instead, which we still do have. Also updated encode() and
decode() to send things in the order they're in in the struct.)
2024-11-04 19:29:13 -05:00