LibGfx+ImageDecoder: Use RefPtr<Bitmap> instead of optional

Simplify the list of bitmaps a bit by changing
`Optional<NonnullRefPtr<Bitmap>>` into `RefPtr<Bitmap>`. No functional
changes.
This commit is contained in:
Jelle Raaijmakers 2025-02-26 16:36:09 +01:00 committed by Alexander Kalenik
parent 19bee8393d
commit e4a5be0206
Notes: github-actions[bot] 2025-03-22 16:50:52 +00:00
4 changed files with 11 additions and 12 deletions

View file

@ -76,13 +76,13 @@ void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gf
image.frames.ensure_capacity(bitmaps.size());
image.color_space = move(color_space);
for (size_t i = 0; i < bitmaps.size(); ++i) {
if (!bitmaps[i].has_value()) {
if (!bitmaps[i]) {
dbgln("ImageDecoderClient: Invalid bitmap for request {} at index {}", image_id, i);
promise->reject(Error::from_string_literal("Invalid bitmap"));
return;
}
image.frames.empend(bitmaps[i].release_value(), durations[i]);
image.frames.empend(bitmaps[i].release_nonnull(), durations[i]);
}
promise->resolve(move(image));