summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-04-28 14:04:27 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-29 06:49:36 +0200
commit227072a5afa8db3b8e1e9c400404604d882a392d (patch)
treee1a627f0c8f4b768e9e26d22d69d605a21bcf18e /Userland/Libraries
parent1e5ececf751ee454101aeaaa69a2eac111b2f1ff (diff)
downloadserenity-227072a5afa8db3b8e1e9c400404604d882a392d.zip
ICC: Rename XYZ and XYZNumber fields to uppercase
Given that XYZ and xyz are distinct things, let's use the correct case for these member variables. No behavior change.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGfx/ICC/BinaryFormat.h14
-rw-r--r--Userland/Libraries/LibGfx/ICC/Profile.cpp12
-rw-r--r--Userland/Libraries/LibGfx/ICC/TagTypes.h8
3 files changed, 17 insertions, 17 deletions
diff --git a/Userland/Libraries/LibGfx/ICC/BinaryFormat.h b/Userland/Libraries/LibGfx/ICC/BinaryFormat.h
index 851d10d51a..c15486f06f 100644
--- a/Userland/Libraries/LibGfx/ICC/BinaryFormat.h
+++ b/Userland/Libraries/LibGfx/ICC/BinaryFormat.h
@@ -33,22 +33,22 @@ using u16Fixed16Number = u32;
// ICC V4, 4.14 XYZNumber
struct XYZNumber {
- BigEndian<s15Fixed16Number> x;
- BigEndian<s15Fixed16Number> y;
- BigEndian<s15Fixed16Number> z;
+ BigEndian<s15Fixed16Number> X;
+ BigEndian<s15Fixed16Number> Y;
+ BigEndian<s15Fixed16Number> Z;
XYZNumber() = default;
XYZNumber(XYZ const& xyz)
- : x(round(xyz.x * 0x1'0000))
- , y(round(xyz.y * 0x1'0000))
- , z(round(xyz.z * 0x1'0000))
+ : X(round(xyz.X * 0x1'0000))
+ , Y(round(xyz.Y * 0x1'0000))
+ , Z(round(xyz.Z * 0x1'0000))
{
}
operator XYZ() const
{
- return XYZ { x / (float)0x1'0000, y / (float)0x1'0000, z / (float)0x1'0000 };
+ return XYZ { X / (float)0x1'0000, Y / (float)0x1'0000, Z / (float)0x1'0000 };
}
};
diff --git a/Userland/Libraries/LibGfx/ICC/Profile.cpp b/Userland/Libraries/LibGfx/ICC/Profile.cpp
index 59e53a22e2..a294e2cde5 100644
--- a/Userland/Libraries/LibGfx/ICC/Profile.cpp
+++ b/Userland/Libraries/LibGfx/ICC/Profile.cpp
@@ -273,7 +273,7 @@ ErrorOr<XYZ> parse_pcs_illuminant(ICCHeader const& header)
XYZ xyz = (XYZ)header.pcs_illuminant;
/// "The value, when rounded to four decimals, shall be X = 0,9642, Y = 1,0 and Z = 0,8249."
- if (round(xyz.x * 10'000) != 9'642 || round(xyz.y * 10'000) != 10'000 || round(xyz.z * 10'000) != 8'249)
+ if (round(xyz.X * 10'000) != 9'642 || round(xyz.Y * 10'000) != 10'000 || round(xyz.Z * 10'000) != 8'249)
return Error::from_string_literal("ICC::Profile: Invalid pcs illuminant");
return xyz;
@@ -1124,9 +1124,9 @@ ErrorOr<void> Profile::check_tag_types()
auto& xyz_type = static_cast<XYZTagData const&>(*type.value());
if (xyz_type.xyzs().size() != 1)
return Error::from_string_literal("ICC::Profile: luminanceTag has unexpected size");
- if (is_v4() && xyz_type.xyzs()[0].x != 0)
+ if (is_v4() && xyz_type.xyzs()[0].X != 0)
return Error::from_string_literal("ICC::Profile: luminanceTag.x unexpectedly not 0");
- if (is_v4() && xyz_type.xyzs()[0].z != 0)
+ if (is_v4() && xyz_type.xyzs()[0].Z != 0)
return Error::from_string_literal("ICC::Profile: luminanceTag.z unexpectedly not 0");
}
@@ -1448,9 +1448,9 @@ ErrorOr<FloatVector3> Profile::to_pcs(ReadonlyBytes color)
auto const& greenMatrixColumn = green_matrix_column();
auto const& blueMatrixColumn = blue_matrix_column();
- float X = redMatrixColumn.x * linear_r + greenMatrixColumn.x * linear_g + blueMatrixColumn.x * linear_b;
- float Y = redMatrixColumn.y * linear_r + greenMatrixColumn.y * linear_g + blueMatrixColumn.y * linear_b;
- float Z = redMatrixColumn.z * linear_r + greenMatrixColumn.z * linear_g + blueMatrixColumn.z * linear_b;
+ float X = redMatrixColumn.X * linear_r + greenMatrixColumn.X * linear_g + blueMatrixColumn.X * linear_b;
+ float Y = redMatrixColumn.Y * linear_r + greenMatrixColumn.Y * linear_g + blueMatrixColumn.Y * linear_b;
+ float Z = redMatrixColumn.Z * linear_r + greenMatrixColumn.Z * linear_g + blueMatrixColumn.Z * linear_b;
return FloatVector3 { X, Y, Z };
}
diff --git a/Userland/Libraries/LibGfx/ICC/TagTypes.h b/Userland/Libraries/LibGfx/ICC/TagTypes.h
index c2a6446bc8..5c320690e7 100644
--- a/Userland/Libraries/LibGfx/ICC/TagTypes.h
+++ b/Userland/Libraries/LibGfx/ICC/TagTypes.h
@@ -21,9 +21,9 @@ using S15Fixed16 = FixedPoint<16, i32>;
using U16Fixed16 = FixedPoint<16, u32>;
struct XYZ {
- float x { 0 };
- float y { 0 };
- float z { 0 };
+ float X { 0 };
+ float Y { 0 };
+ float Z { 0 };
bool operator==(const XYZ&) const = default;
};
@@ -906,6 +906,6 @@ template<>
struct AK::Formatter<Gfx::ICC::XYZ> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, Gfx::ICC::XYZ const& xyz)
{
- return Formatter<FormatString>::format(builder, "X = {}, Y = {}, Z = {}"sv, xyz.x, xyz.y, xyz.z);
+ return Formatter<FormatString>::format(builder, "X = {}, Y = {}, Z = {}"sv, xyz.X, xyz.Y, xyz.Z);
}
};