LibGfx: Remove use of ByteBuffer::wrap() in BMP decoder

This commit is contained in:
Andreas Kling 2020-12-19 13:05:48 +01:00
parent 8cf6b75dd9
commit 77515fead2
Notes: sideshowbarker 2024-07-19 00:44:48 +09:00

View file

@ -1187,15 +1187,17 @@ static bool decode_bmp_pixel_data(BMPLoadingContext& context)
return false;
}
auto buffer = ByteBuffer::wrap(const_cast<u8*>(context.file_bytes + context.data_offset), context.file_size - context.data_offset);
ByteBuffer rle_buffer;
ReadonlyBytes bytes { context.file_bytes + context.data_offset, context.file_size - context.data_offset };
if (context.dib.info.compression == Compression::RLE4 || context.dib.info.compression == Compression::RLE8
|| context.dib.info.compression == Compression::RLE24) {
if (!uncompress_bmp_rle_data(context, buffer))
if (!uncompress_bmp_rle_data(context, rle_buffer))
return false;
bytes = rle_buffer.bytes();
}
Streamer streamer(buffer.data(), buffer.size());
Streamer streamer(bytes.data(), bytes.size());
auto process_row = [&](u32 row) -> bool {
u32 space_remaining_before_consuming_row = streamer.remaining();