mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
Ladybird: Simplify ImageCodecPluginLadybird a bit
No behavior change.
This commit is contained in:
parent
c9b8af70bf
commit
f3a58f3a5a
1 changed files with 4 additions and 11 deletions
|
@ -21,22 +21,15 @@ Optional<Web::Platform::DecodedImage> ImageCodecPluginLadybird::decode_image(Rea
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool had_errors = false;
|
|
||||||
Vector<Web::Platform::Frame> frames;
|
Vector<Web::Platform::Frame> frames;
|
||||||
for (size_t i = 0; i < decoder->frame_count(); ++i) {
|
for (size_t i = 0; i < decoder->frame_count(); ++i) {
|
||||||
auto frame_or_error = decoder->frame(i);
|
auto frame_or_error = decoder->frame(i);
|
||||||
if (frame_or_error.is_error()) {
|
if (frame_or_error.is_error())
|
||||||
frames.append({ {}, 0 });
|
return {};
|
||||||
had_errors = true;
|
auto frame = frame_or_error.release_value();
|
||||||
} else {
|
frames.append({ move(frame.image), static_cast<size_t>(frame.duration) });
|
||||||
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 {
|
return Web::Platform::DecodedImage {
|
||||||
decoder->is_animated(),
|
decoder->is_animated(),
|
||||||
static_cast<u32>(decoder->loop_count()),
|
static_cast<u32>(decoder->loop_count()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue