mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +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:
parent
456f12c5c8
commit
eb4a69c377
Notes:
sideshowbarker
2024-07-16 23:56:28 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/eb4a69c377 Pull-request: https://github.com/SerenityOS/serenity/pull/17557 Reviewed-by: https://github.com/linusg
1 changed files with 2 additions and 1 deletions
|
@ -49,9 +49,10 @@ Optional<DecodedImage> Client::decode_image(ReadonlyBytes encoded_data, Optional
|
||||||
image.is_animated = response.is_animated();
|
image.is_animated = response.is_animated();
|
||||||
image.loop_count = response.loop_count();
|
image.loop_count = response.loop_count();
|
||||||
image.frames.resize(response.bitmaps().size());
|
image.frames.resize(response.bitmaps().size());
|
||||||
|
auto bitmaps = response.take_bitmaps();
|
||||||
for (size_t i = 0; i < image.frames.size(); ++i) {
|
for (size_t i = 0; i < image.frames.size(); ++i) {
|
||||||
auto& frame = image.frames[i];
|
auto& frame = image.frames[i];
|
||||||
frame.bitmap = response.bitmaps()[i].bitmap();
|
frame.bitmap = bitmaps[i].bitmap();
|
||||||
frame.duration = response.durations()[i];
|
frame.duration = response.durations()[i];
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
|
|
Loading…
Reference in a new issue