diff --git a/Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp b/Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp index a403734113..170e637f9f 100644 --- a/Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp +++ b/Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp @@ -11,13 +11,8 @@ namespace Gfx::ICC { -ErrorOr encode(Profile const& profile) +static ErrorOr encode_header(ByteBuffer& bytes, Profile const& profile) { - - // Leaves enough room for the profile header and the tag table count. - // FIXME: Serialize tag data and write tag table and tag data too. - auto bytes = TRY(ByteBuffer::create_zeroed(sizeof(ICCHeader) + sizeof(u32))); - VERIFY(bytes.size() >= sizeof(ICCHeader)); auto& raw_header = *bit_cast(bytes.data()); @@ -62,6 +57,17 @@ ErrorOr encode(Profile const& profile) static_assert(sizeof(id.data) == sizeof(raw_header.profile_id)); memcpy(raw_header.profile_id, id.data, sizeof(id.data)); + return {}; +} + +ErrorOr encode(Profile const& profile) +{ + // Leaves enough room for the profile header and the tag table count. + // FIXME: Serialize tag data and write tag table and tag data too. + auto bytes = TRY(ByteBuffer::create_zeroed(sizeof(ICCHeader) + sizeof(u32))); + + TRY(encode_header(bytes, profile)); + return bytes; }