Userland: Remove remaining callers of synchronous ImageDecoder API

Most of these now just await the image decoding, equivalent (ish) to
the old behavior. A more async-aware refactor should happen some time
in the future.
This commit is contained in:
Andrew Kaster 2024-04-19 16:10:57 -06:00 committed by Andrew Kaster
commit 1c3f11a5a6
Notes: sideshowbarker 2024-07-16 21:39:23 +09:00
7 changed files with 21 additions and 41 deletions

View file

@ -717,9 +717,9 @@ static ErrorOr<NonnullRefPtr<Gfx::Bitmap>> render_thumbnail(StringView path)
}
auto mime_type = Core::guess_mime_type_based_on_filename(path);
auto decoded_image = maybe_client->decode_image(file->bytes(), thumbnail_size, mime_type);
if (!decoded_image.has_value())
return Error::from_string_literal("Unable to decode the image.");
// FIXME: Refactor thumbnail rendering to be more async-aware. Possibly return this promise to the caller.
auto decoded_image = TRY(maybe_client->decode_image(file->bytes(), {}, {}, thumbnail_size, mime_type)->await());
return decoded_image;
}));