LibGfx/GIF: Move the code to read the header to its own function
By header, I include the logical screen descriptor here, so all the information that is not specific to each frame.
This commit is contained in:
parent
b8bc84a3e8
commit
294217586b
Notes:
sideshowbarker
2024-07-17 09:37:30 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/294217586b Pull-request: https://github.com/SerenityOS/serenity/pull/20029
1 changed files with 8 additions and 1 deletions
|
@ -381,7 +381,7 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
|
||||
static ErrorOr<void> load_header_and_logical_screen(GIFLoadingContext& context)
|
||||
{
|
||||
if (TRY(context.stream.size()) < 32)
|
||||
return Error::from_string_literal("Size too short for GIF frame descriptors");
|
||||
|
@ -412,6 +412,13 @@ static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
|
|||
context.logical_screen.color_map[i] = { r, g, b };
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
|
||||
{
|
||||
TRY(load_header_and_logical_screen(context));
|
||||
|
||||
NonnullOwnPtr<GIFImageDescriptor> current_image = make<GIFImageDescriptor>();
|
||||
for (;;) {
|
||||
u8 sentinel = TRY(context.stream.read_value<u8>());
|
||||
|
|
Loading…
Add table
Reference in a new issue