Bläddra i källkod

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.
Andreas Kling 2 år sedan
förälder
incheckning
eb4a69c377
1 ändrade filer med 2 tillägg och 1 borttagningar
  1. 2 1
      Userland/Libraries/LibImageDecoderClient/Client.cpp

+ 2 - 1
Userland/Libraries/LibImageDecoderClient/Client.cpp

@@ -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;