1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

LibGfx: Fix typo in name of DeviceClass::InputDevice

This commit is contained in:
Nico Weber 2023-01-25 11:21:26 -05:00 committed by Linus Groh
parent 29e72bf381
commit cb4cbe3ae8
2 changed files with 15 additions and 14 deletions

View file

@ -164,7 +164,7 @@ ErrorOr<DeviceClass> parse_device_class(ICCHeader const& header)
{ {
// ICC v4, 7.2.5 Profile/device class field // ICC v4, 7.2.5 Profile/device class field
switch (header.profile_device_class) { switch (header.profile_device_class) {
case DeviceClass::InputDevce: case DeviceClass::InputDevice:
case DeviceClass::DisplayDevice: case DeviceClass::DisplayDevice:
case DeviceClass::OutputDevice: case DeviceClass::OutputDevice:
case DeviceClass::DeviceLink: case DeviceClass::DeviceLink:
@ -406,8 +406,8 @@ Optional<StringView> tag_signature_spec_name(TagSignature tag_signature)
StringView device_class_name(DeviceClass device_class) StringView device_class_name(DeviceClass device_class)
{ {
switch (device_class) { switch (device_class) {
case DeviceClass::InputDevce: case DeviceClass::InputDevice:
return "InputDevce"sv; return "InputDevice"sv;
case DeviceClass::DisplayDevice: case DeviceClass::DisplayDevice:
return "DisplayDevice"sv; return "DisplayDevice"sv;
case DeviceClass::OutputDevice: case DeviceClass::OutputDevice:
@ -1071,10 +1071,11 @@ ErrorOr<void> Profile::check_required_tags()
// FIXME: Check for chromaticAdaptationTag after figuring out when exactly it needs to be present. // FIXME: Check for chromaticAdaptationTag after figuring out when exactly it needs to be present.
} }
auto has_all_tags = [&]<class T>(T tags) { return all_of(tags, [&](auto& key) { return m_tag_table.contains(key); }); }; auto has_tag = [&](auto& tag) { return m_tag_table.contains(tag); };
auto has_all_tags = [&]<class T>(T tags) { return all_of(tags, has_tag); };
switch (device_class()) { switch (device_class()) {
case DeviceClass::InputDevce: { case DeviceClass::InputDevice: {
// ICC v4, 8.3 Input profiles // ICC v4, 8.3 Input profiles
// "8.3.1 General // "8.3.1 General
// Input profiles are generally used with devices such as scanners and digital cameras. The types of profiles // Input profiles are generally used with devices such as scanners and digital cameras. The types of profiles
@ -1095,13 +1096,13 @@ ErrorOr<void> Profile::check_required_tags()
// 8.3.4 Monochrome Input profiles // 8.3.4 Monochrome Input profiles
// In addition to the tags listed in 8.2, a monochrome Input profile shall contain the following tag: // In addition to the tags listed in 8.2, a monochrome Input profile shall contain the following tag:
// - grayTRCTag (see 9.2.29). // - grayTRCTag (see 9.2.29).
bool has_n_component_lut_based_tags = m_tag_table.contains(AToB0Tag); bool has_n_component_lut_based_tags = has_tag(AToB0Tag);
bool has_three_component_matrix_based_tags = has_all_tags(Array { redMatrixColumnTag, greenMatrixColumnTag, blueMatrixColumnTag, redTRCTag, greenTRCTag, blueTRCTag }); bool has_three_component_matrix_based_tags = has_all_tags(Array { redMatrixColumnTag, greenMatrixColumnTag, blueMatrixColumnTag, redTRCTag, greenTRCTag, blueTRCTag });
bool has_monochrome_tags = m_tag_table.contains(grayTRCTag); bool has_monochrome_tags = has_tag(grayTRCTag);
if (!has_n_component_lut_based_tags && !has_three_component_matrix_based_tags && !has_monochrome_tags) if (!has_n_component_lut_based_tags && !has_three_component_matrix_based_tags && !has_monochrome_tags)
return Error::from_string_literal("ICC::Profile: InputDevce required tags are missing"); return Error::from_string_literal("ICC::Profile: InputDevice required tags are missing");
if (!has_n_component_lut_based_tags && has_three_component_matrix_based_tags && connection_space() != ColorSpace::PCSXYZ) if (!has_n_component_lut_based_tags && has_three_component_matrix_based_tags && connection_space() != ColorSpace::PCSXYZ)
return Error::from_string_literal("ICC::Profile: InputDevce three-component matrix-based profile must use PCSXYZ"); return Error::from_string_literal("ICC::Profile: InputDevice three-component matrix-based profile must use PCSXYZ");
break; break;
} }
case DeviceClass::DisplayDevice: { case DeviceClass::DisplayDevice: {
@ -1128,7 +1129,7 @@ ErrorOr<void> Profile::check_required_tags()
// - grayTRCTag (see 9.2.29)." // - grayTRCTag (see 9.2.29)."
bool has_n_component_lut_based_tags = has_all_tags(Array { AToB0Tag, BToA0Tag }); bool has_n_component_lut_based_tags = has_all_tags(Array { AToB0Tag, BToA0Tag });
bool has_three_component_matrix_based_tags = has_all_tags(Array { redMatrixColumnTag, greenMatrixColumnTag, blueMatrixColumnTag, redTRCTag, greenTRCTag, blueTRCTag }); bool has_three_component_matrix_based_tags = has_all_tags(Array { redMatrixColumnTag, greenMatrixColumnTag, blueMatrixColumnTag, redTRCTag, greenTRCTag, blueTRCTag });
bool has_monochrome_tags = m_tag_table.contains(grayTRCTag); bool has_monochrome_tags = has_tag(grayTRCTag);
if (!has_n_component_lut_based_tags && !has_three_component_matrix_based_tags && !has_monochrome_tags) if (!has_n_component_lut_based_tags && !has_three_component_matrix_based_tags && !has_monochrome_tags)
return Error::from_string_literal("ICC::Profile: DisplayDevice required tags are missing"); return Error::from_string_literal("ICC::Profile: DisplayDevice required tags are missing");
if (!has_n_component_lut_based_tags && has_three_component_matrix_based_tags && connection_space() != ColorSpace::PCSXYZ) if (!has_n_component_lut_based_tags && has_three_component_matrix_based_tags && connection_space() != ColorSpace::PCSXYZ)
@ -1158,7 +1159,7 @@ ErrorOr<void> Profile::check_required_tags()
if (is_v4() && is_xCLR(connection_space())) if (is_v4() && is_xCLR(connection_space()))
required_n_component_lut_based_tags.append(colorantTableTag); required_n_component_lut_based_tags.append(colorantTableTag);
bool has_n_component_lut_based_tags = has_all_tags(required_n_component_lut_based_tags); bool has_n_component_lut_based_tags = has_all_tags(required_n_component_lut_based_tags);
bool has_monochrome_tags = m_tag_table.contains(grayTRCTag); bool has_monochrome_tags = has_tag(grayTRCTag);
if (!has_n_component_lut_based_tags && !has_monochrome_tags) if (!has_n_component_lut_based_tags && !has_monochrome_tags)
return Error::from_string_literal("ICC::Profile: OutputDevice required tags are missing"); return Error::from_string_literal("ICC::Profile: OutputDevice required tags are missing");
break; break;
@ -1202,14 +1203,14 @@ ErrorOr<void> Profile::check_required_tags()
// "In addition to the tags listed in 8.2, an Abstract profile shall contain the following tag: // "In addition to the tags listed in 8.2, an Abstract profile shall contain the following tag:
// - AToB0Tag (see 9.2.1). // - AToB0Tag (see 9.2.1).
// [...] Abstract profiles cannot be embedded in images." // [...] Abstract profiles cannot be embedded in images."
if (!m_tag_table.contains(AToB0Tag)) if (!has_tag(AToB0Tag))
return Error::from_string_literal("ICC::Profile: Abstract required AToB0Tag is missing"); return Error::from_string_literal("ICC::Profile: Abstract required AToB0Tag is missing");
break; break;
case DeviceClass::NamedColor: case DeviceClass::NamedColor:
// ICC v4, 8.9 NamedColor profile // ICC v4, 8.9 NamedColor profile
// "In addition to the tags listed in 8.2, a NamedColor profile shall contain the following tag: // "In addition to the tags listed in 8.2, a NamedColor profile shall contain the following tag:
// - namedColor2Tag (see 9.2.35)." // - namedColor2Tag (see 9.2.35)."
if (!m_tag_table.contains(namedColor2Tag)) if (!has_tag(namedColor2Tag))
return Error::from_string_literal("ICC::Profile: NamedColor required namedColor2Tag is missing"); return Error::from_string_literal("ICC::Profile: NamedColor required namedColor2Tag is missing");
break; break;
} }

View file

@ -141,7 +141,7 @@ private:
// ICC v4, 7.2.5 Profile/device class field // ICC v4, 7.2.5 Profile/device class field
enum class DeviceClass : u32 { enum class DeviceClass : u32 {
InputDevce = 0x73636E72, // 'scnr' InputDevice = 0x73636E72, // 'scnr'
DisplayDevice = 0x6D6E7472, // 'mntr' DisplayDevice = 0x6D6E7472, // 'mntr'
OutputDevice = 0x70727472, // 'prtr' OutputDevice = 0x70727472, // 'prtr'
DeviceLink = 0x6C696E6B, // 'link' DeviceLink = 0x6C696E6B, // 'link'