LibGfx: Move ICC::Profile::read_tag() out of class

This commit is contained in:
Nico Weber 2023-02-14 12:57:11 -05:00 committed by Andreas Kling
parent 7f530c0753
commit 006dff6878
Notes: sideshowbarker 2024-07-17 00:25:02 +09:00
2 changed files with 2 additions and 3 deletions

View File

@ -603,7 +603,7 @@ ErrorOr<void> Profile::read_header(ReadonlyBytes bytes)
return {};
}
ErrorOr<NonnullRefPtr<TagData>> Profile::read_tag(ReadonlyBytes bytes, u32 offset_to_beginning_of_tag_data_element, u32 size_of_tag_data_element)
static ErrorOr<NonnullRefPtr<TagData>> read_tag(ReadonlyBytes bytes, u32 offset_to_beginning_of_tag_data_element, u32 size_of_tag_data_element)
{
// "All tag data elements shall start on a 4-byte boundary (relative to the start of the profile data stream)"
if (offset_to_beginning_of_tag_data_element % 4 != 0)
@ -709,7 +709,7 @@ ErrorOr<void> Profile::read_tag_table(ReadonlyBytes bytes)
// FIXME: optionally ignore tags with unknown signature
// Dedupe identical offset/sizes.
NonnullRefPtr<TagData> tag_data = TRY(offset_to_tag_data.try_ensure(tag_table_entries[i].offset_to_beginning_of_tag_data_element, [=, this]() {
NonnullRefPtr<TagData> tag_data = TRY(offset_to_tag_data.try_ensure(tag_table_entries[i].offset_to_beginning_of_tag_data_element, [&]() {
return read_tag(bytes, tag_table_entries[i].offset_to_beginning_of_tag_data_element, tag_table_entries[i].size_of_tag_data_element);
}));

View File

@ -226,7 +226,6 @@ public:
private:
ErrorOr<void> read_header(ReadonlyBytes);
ErrorOr<NonnullRefPtr<TagData>> read_tag(ReadonlyBytes bytes, u32 offset_to_beginning_of_tag_data_element, u32 size_of_tag_data_element);
ErrorOr<void> read_tag_table(ReadonlyBytes);
ErrorOr<void> check_required_tags();
ErrorOr<void> check_tag_types();