LibGfx: Introduce ICC::Profile::create

This can be used to programmatically create ICC::Profile objects.
This commit is contained in:
Nico Weber 2023-02-27 08:37:05 -05:00 committed by Linus Groh
commit 8f415e7b21
Notes: sideshowbarker 2024-07-17 05:02:42 +09:00
2 changed files with 13 additions and 7 deletions

View file

@ -1316,7 +1316,12 @@ ErrorOr<NonnullRefPtr<Profile>> Profile::try_load_from_externally_owned_memory(R
bytes = bytes.trim(header.on_disk_size);
auto tag_table = TRY(read_tag_table(bytes));
auto profile = TRY(try_make_ref_counted<Profile>(header, move(tag_table)));
return create(header, move(tag_table));
}
ErrorOr<NonnullRefPtr<Profile>> Profile::create(ProfileHeader const& header, OrderedHashMap<TagSignature, NonnullRefPtr<TagData>> tag_table)
{
auto profile = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Profile(header, move(tag_table))));
TRY(profile->check_required_tags());
TRY(profile->check_tag_types());