mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:57:44 +00:00
LibGfx: Move TagTableEntry into read_tag_table
It's now used only there.
This commit is contained in:
parent
f7f592f5d3
commit
2f4a83215c
2 changed files with 10 additions and 16 deletions
|
@ -116,17 +116,7 @@ struct ICCHeader {
|
||||||
u8 reserved[28];
|
u8 reserved[28];
|
||||||
};
|
};
|
||||||
static_assert(sizeof(ICCHeader) == 128);
|
static_assert(sizeof(ICCHeader) == 128);
|
||||||
}
|
|
||||||
|
|
||||||
// ICC V4, 7.3 Tag table, Table 24 - Tag table structure
|
|
||||||
struct Detail::TagTableEntry {
|
|
||||||
BigEndian<TagSignature> tag_signature;
|
|
||||||
BigEndian<u32> offset_to_beginning_of_tag_data_element;
|
|
||||||
BigEndian<u32> size_of_tag_data_element;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(Detail::TagTableEntry) == 12);
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
ErrorOr<u32> parse_size(ICCHeader const& header, ReadonlyBytes icc_bytes)
|
ErrorOr<u32> parse_size(ICCHeader const& header, ReadonlyBytes icc_bytes)
|
||||||
{
|
{
|
||||||
// ICC v4, 7.2.2 Profile size field
|
// ICC v4, 7.2.2 Profile size field
|
||||||
|
@ -983,10 +973,18 @@ ErrorOr<void> Profile::read_tag_table(ReadonlyBytes bytes)
|
||||||
return Error::from_string_literal("ICC::Profile: Not enough data for tag count");
|
return Error::from_string_literal("ICC::Profile: Not enough data for tag count");
|
||||||
auto tag_count = *bit_cast<BigEndian<u32> const*>(tag_table_bytes.data());
|
auto tag_count = *bit_cast<BigEndian<u32> const*>(tag_table_bytes.data());
|
||||||
|
|
||||||
|
// ICC V4, 7.3 Tag table, Table 24 - Tag table structure
|
||||||
|
struct TagTableEntry {
|
||||||
|
BigEndian<TagSignature> tag_signature;
|
||||||
|
BigEndian<u32> offset_to_beginning_of_tag_data_element;
|
||||||
|
BigEndian<u32> size_of_tag_data_element;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(TagTableEntry) == 12);
|
||||||
|
|
||||||
tag_table_bytes = tag_table_bytes.slice(sizeof(u32));
|
tag_table_bytes = tag_table_bytes.slice(sizeof(u32));
|
||||||
if (tag_table_bytes.size() < tag_count * sizeof(Detail::TagTableEntry))
|
if (tag_table_bytes.size() < tag_count * sizeof(TagTableEntry))
|
||||||
return Error::from_string_literal("ICC::Profile: Not enough data for tag table entries");
|
return Error::from_string_literal("ICC::Profile: Not enough data for tag table entries");
|
||||||
auto tag_table_entries = bit_cast<Detail::TagTableEntry const*>(tag_table_bytes.data());
|
auto tag_table_entries = bit_cast<TagTableEntry const*>(tag_table_bytes.data());
|
||||||
|
|
||||||
for (u32 i = 0; i < tag_count; ++i) {
|
for (u32 i = 0; i < tag_count; ++i) {
|
||||||
// FIXME: optionally ignore tags with unknown signature
|
// FIXME: optionally ignore tags with unknown signature
|
||||||
|
|
|
@ -495,10 +495,6 @@ private:
|
||||||
Vector<XYZ, 1> m_xyzs;
|
Vector<XYZ, 1> m_xyzs;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Detail {
|
|
||||||
struct TagTableEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Profile : public RefCounted<Profile> {
|
class Profile : public RefCounted<Profile> {
|
||||||
public:
|
public:
|
||||||
static ErrorOr<NonnullRefPtr<Profile>> try_load_from_externally_owned_memory(ReadonlyBytes);
|
static ErrorOr<NonnullRefPtr<Profile>> try_load_from_externally_owned_memory(ReadonlyBytes);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue