mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-14 18:30:38 +00:00
Ladybird: Simplify ImageCodecPluginLadybird a bit
No behavior change.
This commit is contained in:
parent
c9b8af70bf
commit
f3a58f3a5a
Notes:
sideshowbarker
2024-07-16 22:24:48 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/f3a58f3a5a Pull-request: https://github.com/SerenityOS/serenity/pull/19216 Issue: https://github.com/SerenityOS/serenity/issues/19141
1 changed files with 4 additions and 11 deletions
|
@ -21,22 +21,15 @@ Optional<Web::Platform::DecodedImage> ImageCodecPluginLadybird::decode_image(Rea
|
|||
return {};
|
||||
}
|
||||
|
||||
bool had_errors = false;
|
||||
Vector<Web::Platform::Frame> frames;
|
||||
for (size_t i = 0; i < decoder->frame_count(); ++i) {
|
||||
auto frame_or_error = decoder->frame(i);
|
||||
if (frame_or_error.is_error()) {
|
||||
frames.append({ {}, 0 });
|
||||
had_errors = true;
|
||||
} else {
|
||||
auto frame = frame_or_error.release_value();
|
||||
frames.append({ move(frame.image), static_cast<size_t>(frame.duration) });
|
||||
}
|
||||
if (frame_or_error.is_error())
|
||||
return {};
|
||||
auto frame = frame_or_error.release_value();
|
||||
frames.append({ move(frame.image), static_cast<size_t>(frame.duration) });
|
||||
}
|
||||
|
||||
if (had_errors)
|
||||
return {};
|
||||
|
||||
return Web::Platform::DecodedImage {
|
||||
decoder->is_animated(),
|
||||
static_cast<u32>(decoder->loop_count()),
|
||||
|
|
Loading…
Reference in a new issue