mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
ICC: Make number_of_components_in_color_space() external
...and make its return type unsigned.
This commit is contained in:
parent
037d213fdf
commit
e76d2238bb
2 changed files with 15 additions and 14 deletions
|
@ -421,7 +421,19 @@ StringView data_color_space_name(ColorSpace color_space)
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int number_of_components_in_color_space(ColorSpace color_space)
|
StringView profile_connection_space_name(ColorSpace color_space)
|
||||||
|
{
|
||||||
|
switch (color_space) {
|
||||||
|
case ColorSpace::PCSXYZ:
|
||||||
|
return "PCSXYZ"sv;
|
||||||
|
case ColorSpace::PCSLAB:
|
||||||
|
return "PCSLAB"sv;
|
||||||
|
default:
|
||||||
|
return data_color_space_name(color_space);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned number_of_components_in_color_space(ColorSpace color_space)
|
||||||
{
|
{
|
||||||
switch (color_space) {
|
switch (color_space) {
|
||||||
case ColorSpace::Gray:
|
case ColorSpace::Gray:
|
||||||
|
@ -468,18 +480,6 @@ static int number_of_components_in_color_space(ColorSpace color_space)
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView profile_connection_space_name(ColorSpace color_space)
|
|
||||||
{
|
|
||||||
switch (color_space) {
|
|
||||||
case ColorSpace::PCSXYZ:
|
|
||||||
return "PCSXYZ"sv;
|
|
||||||
case ColorSpace::PCSLAB:
|
|
||||||
return "PCSLAB"sv;
|
|
||||||
default:
|
|
||||||
return data_color_space_name(color_space);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StringView primary_platform_name(PrimaryPlatform primary_platform)
|
StringView primary_platform_name(PrimaryPlatform primary_platform)
|
||||||
{
|
{
|
||||||
switch (primary_platform) {
|
switch (primary_platform) {
|
||||||
|
@ -1178,7 +1178,7 @@ ErrorOr<void> Profile::check_tag_types()
|
||||||
// "The device representation corresponds to the header’s “data colour space” field.
|
// "The device representation corresponds to the header’s “data colour space” field.
|
||||||
// This representation should be consistent with the “number of device coordinates” field in the namedColor2Type.
|
// This representation should be consistent with the “number of device coordinates” field in the namedColor2Type.
|
||||||
// If this field is 0, device coordinates are not provided."
|
// If this field is 0, device coordinates are not provided."
|
||||||
if (int number_of_device_coordinates = static_cast<NamedColor2TagData const&>(*type.value()).number_of_device_coordinates();
|
if (auto number_of_device_coordinates = static_cast<NamedColor2TagData const&>(*type.value()).number_of_device_coordinates();
|
||||||
number_of_device_coordinates != 0 && number_of_device_coordinates != number_of_components_in_color_space(data_color_space())) {
|
number_of_device_coordinates != 0 && number_of_device_coordinates != number_of_components_in_color_space(data_color_space())) {
|
||||||
return Error::from_string_literal("ICC::Profile: namedColor2Tag number of device coordinates inconsistent with data color space");
|
return Error::from_string_literal("ICC::Profile: namedColor2Tag number of device coordinates inconsistent with data color space");
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ enum class ColorSpace : u32 {
|
||||||
};
|
};
|
||||||
StringView data_color_space_name(ColorSpace);
|
StringView data_color_space_name(ColorSpace);
|
||||||
StringView profile_connection_space_name(ColorSpace);
|
StringView profile_connection_space_name(ColorSpace);
|
||||||
|
unsigned number_of_components_in_color_space(ColorSpace);
|
||||||
|
|
||||||
// ICC v4, 7.2.10 Primary platform field, Table 20 — Primary platforms
|
// ICC v4, 7.2.10 Primary platform field, Table 20 — Primary platforms
|
||||||
enum class PrimaryPlatform : u32 {
|
enum class PrimaryPlatform : u32 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue