From 227072a5afa8db3b8e1e9c400404604d882a392d Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 28 Apr 2023 14:04:27 -0400 Subject: 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. --- Userland/Libraries/LibGfx/ICC/BinaryFormat.h | 14 +++++++------- Userland/Libraries/LibGfx/ICC/Profile.cpp | 12 ++++++------ Userland/Libraries/LibGfx/ICC/TagTypes.h | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'Userland/Libraries') 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 x; - BigEndian y; - BigEndian z; + BigEndian X; + BigEndian Y; + BigEndian 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 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 Profile::check_tag_types() auto& xyz_type = static_cast(*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 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 : Formatter { ErrorOr format(FormatBuilder& builder, Gfx::ICC::XYZ const& xyz) { - return Formatter::format(builder, "X = {}, Y = {}, Z = {}"sv, xyz.x, xyz.y, xyz.z); + return Formatter::format(builder, "X = {}, Y = {}, Z = {}"sv, xyz.X, xyz.Y, xyz.Z); } }; -- cgit v1.2.3