LibGfx: Use NonnullRefPtr<Bitmap> for frame descriptors
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This makes it a bit easier to reason about where bitmaps should be
available.
This commit is contained in:
Jelle Raaijmakers 2025-06-25 10:25:28 +02:00 committed by Shannon Booth
commit 2687246808
Notes: github-actions[bot] 2025-06-25 10:55:58 +00:00
12 changed files with 35 additions and 42 deletions

View file

@ -86,15 +86,17 @@ Messages::ImageDecoderServer::ConnectNewClientsResponse ConnectionFromClient::co
static void decode_image_to_bitmaps_and_durations_with_decoder(Gfx::ImageDecoder const& decoder, Optional<Gfx::IntSize> ideal_size, Vector<RefPtr<Gfx::Bitmap>>& bitmaps, Vector<u32>& durations)
{
bitmaps.ensure_capacity(decoder.frame_count());
durations.ensure_capacity(decoder.frame_count());
for (size_t i = 0; i < decoder.frame_count(); ++i) {
auto frame_or_error = decoder.frame(i, ideal_size);
if (frame_or_error.is_error()) {
bitmaps.append({});
durations.append(0);
bitmaps.unchecked_append({});
durations.unchecked_append(0);
} else {
auto frame = frame_or_error.release_value();
bitmaps.append(frame.image.release_nonnull());
durations.append(frame.duration);
bitmaps.unchecked_append(frame.image);
durations.unchecked_append(frame.duration);
}
}
}