1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

LibGfx: Store the size of the chunk from start in PNGWriter

Before this change PNGWriter::add_chunk used to make a copy of
PNGChunk's ByteBuffer to prepend the size of the data.
With this change, 4-byte space is saved from the beginning and written
at the end of the operation. Avoiding this copy yields significant
speed up.
This commit is contained in:
Aziz Berkay Yesilyurt 2021-07-11 21:33:37 +02:00 committed by Andreas Kling
parent db36ddc763
commit b70f2b00a3
2 changed files with 24 additions and 11 deletions

View file

@ -22,7 +22,7 @@ private:
PNGWriter() { }
Vector<u8> m_data;
void add_chunk(PNGChunk const&);
void add_chunk(PNGChunk&);
void add_png_header();
void add_IHDR_chunk(u32 width, u32 height, u8 bit_depth, u8 color_type, u8 compression_method, u8 filter_method, u8 interlace_method);
void add_IDAT_chunk(Gfx::Bitmap const&);