mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 18:15:58 +00:00
Ladybird: Simplify ImageCodecPluginLadybird a bit
No behavior change.
This commit is contained in:
parent
c9b8af70bf
commit
f3a58f3a5a
|
@ -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