mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:27:34 +00:00
LibGfx: Use ReadonlyBytes in PNGChunk API
This commit is contained in:
parent
71b7e65a52
commit
75895bc892
1 changed files with 4 additions and 6 deletions
|
@ -36,8 +36,7 @@ public:
|
||||||
|
|
||||||
ErrorOr<void> add_u8(u8);
|
ErrorOr<void> add_u8(u8);
|
||||||
|
|
||||||
template<typename T>
|
ErrorOr<void> add(ReadonlyBytes);
|
||||||
ErrorOr<void> add(T*, size_t);
|
|
||||||
|
|
||||||
ErrorOr<void> store_type();
|
ErrorOr<void> store_type();
|
||||||
void store_data_length();
|
void store_data_length();
|
||||||
|
@ -84,10 +83,9 @@ ErrorOr<void> PNGChunk::add(T data)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
ErrorOr<void> PNGChunk::add(ReadonlyBytes bytes)
|
||||||
ErrorOr<void> PNGChunk::add(T* data, size_t size)
|
|
||||||
{
|
{
|
||||||
TRY(m_data.try_append(data, size));
|
TRY(m_data.try_append(bytes));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +264,7 @@ ErrorOr<void> PNGWriter::add_IDAT_chunk(Gfx::Bitmap const& bitmap)
|
||||||
|
|
||||||
auto zlib_buffer = TRY(Compress::ZlibCompressor::compress_all(uncompressed_block_data, Compress::ZlibCompressionLevel::Best));
|
auto zlib_buffer = TRY(Compress::ZlibCompressor::compress_all(uncompressed_block_data, Compress::ZlibCompressionLevel::Best));
|
||||||
|
|
||||||
TRY(png_chunk.add(zlib_buffer.data(), zlib_buffer.size()));
|
TRY(png_chunk.add(zlib_buffer));
|
||||||
TRY(add_chunk(png_chunk));
|
TRY(add_chunk(png_chunk));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue