summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-04-28 09:08:34 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-29 06:49:36 +0200
commite76d2238bbe2fc9940258460ec8e577c3ff3f1b3 (patch)
tree90163e691373b32c706efe8bb0fbd7fa709ecf03
parent037d213fdf48283192fb0c6e3494f627fbc6af06 (diff)
downloadserenity-e76d2238bbe2fc9940258460ec8e577c3ff3f1b3.zip
ICC: Make number_of_components_in_color_space() external
...and make its return type unsigned.
-rw-r--r--Userland/Libraries/LibGfx/ICC/Profile.cpp28
-rw-r--r--Userland/Libraries/LibGfx/ICC/Profile.h1
2 files changed, 15 insertions, 14 deletions
diff --git a/Userland/Libraries/LibGfx/ICC/Profile.cpp b/Userland/Libraries/LibGfx/ICC/Profile.cpp
index 983304c453..bd852cff4d 100644
--- a/Userland/Libraries/LibGfx/ICC/Profile.cpp
+++ b/Userland/Libraries/LibGfx/ICC/Profile.cpp
@@ -421,7 +421,19 @@ StringView data_color_space_name(ColorSpace color_space)
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) {
case ColorSpace::Gray:
@@ -468,18 +480,6 @@ static int number_of_components_in_color_space(ColorSpace color_space)
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)
{
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.
// 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 (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())) {
return Error::from_string_literal("ICC::Profile: namedColor2Tag number of device coordinates inconsistent with data color space");
}
diff --git a/Userland/Libraries/LibGfx/ICC/Profile.h b/Userland/Libraries/LibGfx/ICC/Profile.h
index 709fd97423..864074b8b7 100644
--- a/Userland/Libraries/LibGfx/ICC/Profile.h
+++ b/Userland/Libraries/LibGfx/ICC/Profile.h
@@ -87,6 +87,7 @@ enum class ColorSpace : u32 {
};
StringView data_color_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
enum class PrimaryPlatform : u32 {