mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:27:34 +00:00
LibGfx: Remove a redundant copy of all data when writing a BMP
This commit is contained in:
parent
f1a3028ef1
commit
833d0d95c9
2 changed files with 3 additions and 3 deletions
|
@ -72,7 +72,7 @@ ErrorOr<ByteBuffer> BMPWriter::encode(Bitmap const& bitmap, Options options)
|
|||
return BMPWriter().dump(bitmap, options);
|
||||
}
|
||||
|
||||
ByteBuffer BMPWriter::compress_pixel_data(ByteBuffer const& pixel_data, BMPWriter::Compression compression)
|
||||
ByteBuffer BMPWriter::compress_pixel_data(ByteBuffer pixel_data, BMPWriter::Compression compression)
|
||||
{
|
||||
switch (compression) {
|
||||
case BMPWriter::Compression::BI_BITFIELDS:
|
||||
|
@ -112,7 +112,7 @@ ByteBuffer BMPWriter::dump(RefPtr<Bitmap const> bitmap, Options options)
|
|||
auto buffer = buffer_result.release_value();
|
||||
|
||||
auto pixel_data = write_pixel_data(bitmap, pixel_row_data_size, m_bytes_per_pixel, m_include_alpha_channel);
|
||||
pixel_data = compress_pixel_data(pixel_data, m_compression);
|
||||
pixel_data = compress_pixel_data(move(pixel_data), m_compression);
|
||||
|
||||
size_t file_size = pixel_data_offset + pixel_data.size();
|
||||
OutputStreamer streamer(buffer.data());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue