1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

LibImageDecoderClient: Fix minor const-correctness issue

By taking ownership of the bitmaps after decoding them, we avoid having
to call an API that would give us a const Bitmap.
This commit is contained in:
Andreas Kling 2023-02-19 23:52:10 +01:00
parent 456f12c5c8
commit eb4a69c377

View file

@ -49,9 +49,10 @@ Optional<DecodedImage> Client::decode_image(ReadonlyBytes encoded_data, Optional
image.is_animated = response.is_animated();
image.loop_count = response.loop_count();
image.frames.resize(response.bitmaps().size());
auto bitmaps = response.take_bitmaps();
for (size_t i = 0; i < image.frames.size(); ++i) {
auto& frame = image.frames[i];
frame.bitmap = response.bitmaps()[i].bitmap();
frame.bitmap = bitmaps[i].bitmap();
frame.duration = response.durations()[i];
}
return image;