mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +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
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…
Add table
Add a link
Reference in a new issue