LibGfx: Mark a few ICC:NamedColor2TagData methods as const

This commit is contained in:
Nico Weber 2023-02-19 09:41:51 -05:00 committed by Andreas Kling
parent 47cfcf5dca
commit 7ad11fa59a
Notes: sideshowbarker 2024-07-16 23:58:58 +09:00
2 changed files with 5 additions and 5 deletions

View file

@ -776,7 +776,7 @@ ErrorOr<NonnullRefPtr<NamedColor2TagData>> NamedColor2TagData::from_bytes(Readon
move(prefix), move(suffix), move(root_names), move(pcs_coordinates), move(device_coordinates));
}
ErrorOr<String> NamedColor2TagData::color_name(u32 index)
ErrorOr<String> NamedColor2TagData::color_name(u32 index) const
{
StringBuilder builder;
builder.append(prefix());

View file

@ -545,7 +545,7 @@ public:
// "If this field is 0, device coordinates are not provided."
u32 number_of_device_coordinates() const { return m_number_of_device_coordinates; }
u32 size() { return m_root_names.size(); }
u32 size() const { return m_root_names.size(); }
// "In order to maintain maximum portability, it is strongly recommended that
// special characters of the 7-bit ASCII set not be used."
@ -554,13 +554,13 @@ public:
String const& root_name(u32 index) const { return m_root_names[index]; } // "7-bit ASCII"
// Returns 7-bit ASCII.
ErrorOr<String> color_name(u32 index);
ErrorOr<String> color_name(u32 index) const;
// "The PCS representation corresponds to the headers PCS field."
XYZOrLAB const& pcs_coordinates(u32 index) { return m_pcs_coordinates[index]; }
XYZOrLAB const& pcs_coordinates(u32 index) const { return m_pcs_coordinates[index]; }
// "The device representation corresponds to the headers “data colour space” field."
u16 const* device_coordinates(u32 index)
u16 const* device_coordinates(u32 index) const
{
VERIFY((index + 1) * m_number_of_device_coordinates <= m_device_coordinates.size());
return m_device_coordinates.data() + index * m_number_of_device_coordinates;