Skip to content

Truly independent web browser

LibGfx: Remove unused polar color conversions

Aliaksandr Kalenik1314f2cc7b06
diff --git a/Libraries/LibGfx/ColorConversion.cpp b/Libraries/LibGfx/ColorConversion.cpp
index 68551c073f0..0634b80c377 100644
--- a/Libraries/LibGfx/ColorConversion.cpp
+++ b/Libraries/LibGfx/ColorConversion.cpp
@@ -305,38 +305,6 @@ ColorComponents oklab_to_xyz65(ColorComponents const& components)
};
}
-static ColorComponents rectangular_to_polar(ColorComponents const& components)
-{
- float a = components[1];
- float b = components[2];
-
- float chroma = sqrtf(a * a + b * b);
- float hue = atan2f(b, a) * 180.0f / AK::Pi<float>;
- if (hue < 0.0f)
- hue += 360.0f;
-
- return { components[0], chroma, hue, components.alpha() };
-}
-
-static ColorComponents polar_to_rectangular(ColorComponents const& components)
-{
- float chroma = components[1];
- float hue_radians = components[2] * AK::Pi<float> / 180.0f;
-
- return {
- components[0],
- chroma * cosf(hue_radians),
- chroma * sinf(hue_radians),
- components.alpha(),
- };
-}
-
-// https://drafts.csswg.org/css-color-4/#lab-to-lch
-ColorComponents oklab_to_oklch(ColorComponents const& components) { return rectangular_to_polar(components); }
-
-// https://drafts.csswg.org/css-color-4/#lch-to-lab
-ColorComponents oklch_to_oklab(ColorComponents const& components) { return polar_to_rectangular(components); }
-
// https://drafts.csswg.org/css-color-4/#color-conversion-code
ColorComponents xyz50_to_lab(ColorComponents const& components)
{
@@ -366,12 +334,6 @@ ColorComponents xyz50_to_lab(ColorComponents const& components)
};
}
-// https://drafts.csswg.org/css-color-4/#lab-to-lch
-ColorComponents lab_to_lch(ColorComponents const& components) { return rectangular_to_polar(components); }
-
-// https://drafts.csswg.org/css-color-4/#lch-to-lab
-ColorComponents lch_to_lab(ColorComponents const& components) { return polar_to_rectangular(components); }
-
// https://drafts.csswg.org/css-color-4/#rgb-to-hsl
ColorComponents srgb_to_hsl(ColorComponents const& components)
{
diff --git a/Libraries/LibGfx/ColorConversion.h b/Libraries/LibGfx/ColorConversion.h
index e4a1daeae27..e1eba41f7a3 100644
--- a/Libraries/LibGfx/ColorConversion.h
+++ b/Libraries/LibGfx/ColorConversion.h
@@ -239,14 +239,8 @@ ColorComponents xyz50_to_xyz65(ColorComponents const&);
ColorComponents xyz65_to_oklab(ColorComponents const&);
ColorComponents oklab_to_xyz65(ColorComponents const&);
-ColorComponents oklab_to_oklch(ColorComponents const&);
-ColorComponents oklch_to_oklab(ColorComponents const&);
-
ColorComponents xyz50_to_lab(ColorComponents const&);
-ColorComponents lab_to_lch(ColorComponents const&);
-ColorComponents lch_to_lab(ColorComponents const&);
-
ColorComponents srgb_to_hsl(ColorComponents const&);
ColorComponents srgb_to_hwb(ColorComponents const&);