mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:57:35 +00:00
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.
This commit is contained in:
parent
1e5ececf75
commit
227072a5af
4 changed files with 18 additions and 18 deletions
|
@ -114,7 +114,7 @@ TEST_CASE(to_pcs)
|
||||||
};
|
};
|
||||||
|
|
||||||
auto vec3_from_xyz = [](Gfx::ICC::XYZ const& xyz) {
|
auto vec3_from_xyz = [](Gfx::ICC::XYZ const& xyz) {
|
||||||
return FloatVector3 { xyz.x, xyz.y, xyz.z };
|
return FloatVector3 { xyz.X, xyz.Y, xyz.Z };
|
||||||
};
|
};
|
||||||
|
|
||||||
#define EXPECT_APPROXIMATE_VECTOR3(v1, v2) \
|
#define EXPECT_APPROXIMATE_VECTOR3(v1, v2) \
|
||||||
|
|
|
@ -33,22 +33,22 @@ using u16Fixed16Number = u32;
|
||||||
|
|
||||||
// ICC V4, 4.14 XYZNumber
|
// ICC V4, 4.14 XYZNumber
|
||||||
struct XYZNumber {
|
struct XYZNumber {
|
||||||
BigEndian<s15Fixed16Number> x;
|
BigEndian<s15Fixed16Number> X;
|
||||||
BigEndian<s15Fixed16Number> y;
|
BigEndian<s15Fixed16Number> Y;
|
||||||
BigEndian<s15Fixed16Number> z;
|
BigEndian<s15Fixed16Number> Z;
|
||||||
|
|
||||||
XYZNumber() = default;
|
XYZNumber() = default;
|
||||||
|
|
||||||
XYZNumber(XYZ const& xyz)
|
XYZNumber(XYZ const& xyz)
|
||||||
: x(round(xyz.x * 0x1'0000))
|
: X(round(xyz.X * 0x1'0000))
|
||||||
, y(round(xyz.y * 0x1'0000))
|
, Y(round(xyz.Y * 0x1'0000))
|
||||||
, z(round(xyz.z * 0x1'0000))
|
, Z(round(xyz.Z * 0x1'0000))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
operator XYZ() const
|
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 };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ ErrorOr<XYZ> parse_pcs_illuminant(ICCHeader const& header)
|
||||||
XYZ xyz = (XYZ)header.pcs_illuminant;
|
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."
|
/// "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 Error::from_string_literal("ICC::Profile: Invalid pcs illuminant");
|
||||||
|
|
||||||
return xyz;
|
return xyz;
|
||||||
|
@ -1124,9 +1124,9 @@ ErrorOr<void> Profile::check_tag_types()
|
||||||
auto& xyz_type = static_cast<XYZTagData const&>(*type.value());
|
auto& xyz_type = static_cast<XYZTagData const&>(*type.value());
|
||||||
if (xyz_type.xyzs().size() != 1)
|
if (xyz_type.xyzs().size() != 1)
|
||||||
return Error::from_string_literal("ICC::Profile: luminanceTag has unexpected size");
|
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");
|
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");
|
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& greenMatrixColumn = green_matrix_column();
|
||||||
auto const& blueMatrixColumn = blue_matrix_column();
|
auto const& blueMatrixColumn = blue_matrix_column();
|
||||||
|
|
||||||
float X = redMatrixColumn.x * linear_r + greenMatrixColumn.x * linear_g + blueMatrixColumn.x * 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 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 Z = redMatrixColumn.Z * linear_r + greenMatrixColumn.Z * linear_g + blueMatrixColumn.Z * linear_b;
|
||||||
|
|
||||||
return FloatVector3 { X, Y, Z };
|
return FloatVector3 { X, Y, Z };
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ using S15Fixed16 = FixedPoint<16, i32>;
|
||||||
using U16Fixed16 = FixedPoint<16, u32>;
|
using U16Fixed16 = FixedPoint<16, u32>;
|
||||||
|
|
||||||
struct XYZ {
|
struct XYZ {
|
||||||
float x { 0 };
|
float X { 0 };
|
||||||
float y { 0 };
|
float Y { 0 };
|
||||||
float z { 0 };
|
float Z { 0 };
|
||||||
|
|
||||||
bool operator==(const XYZ&) const = default;
|
bool operator==(const XYZ&) const = default;
|
||||||
};
|
};
|
||||||
|
@ -906,6 +906,6 @@ template<>
|
||||||
struct AK::Formatter<Gfx::ICC::XYZ> : Formatter<FormatString> {
|
struct AK::Formatter<Gfx::ICC::XYZ> : Formatter<FormatString> {
|
||||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::ICC::XYZ const& xyz)
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue