- Revision
- 271723
- Author
- wei...@apple.com
- Date
- 2021-01-21 16:55:04 -0800 (Thu, 21 Jan 2021)
Log Message
Remove support for now unused CMYKA<> color type
https://bugs.webkit.org/show_bug.cgi?id=220828
Reviewed by Wenson Hsieh.
We no longer have any users of the CMYKA<> type, so it, and it's conversion functions
can be removed.
* platform/graphics/ColorConversion.cpp:
(WebCore::toCMYKA): Deleted.
* platform/graphics/ColorConversion.h:
(WebCore::toCMYKA): Deleted.
* platform/graphics/ColorTypes.h:
(WebCore::CMYKA::CMYKA): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (271722 => 271723)
--- trunk/Source/WebCore/ChangeLog 2021-01-22 00:15:45 UTC (rev 271722)
+++ trunk/Source/WebCore/ChangeLog 2021-01-22 00:55:04 UTC (rev 271723)
@@ -1,3 +1,20 @@
+2021-01-21 Sam Weinig <wei...@apple.com>
+
+ Remove support for now unused CMYKA<> color type
+ https://bugs.webkit.org/show_bug.cgi?id=220828
+
+ Reviewed by Wenson Hsieh.
+
+ We no longer have any users of the CMYKA<> type, so it, and it's conversion functions
+ can be removed.
+
+ * platform/graphics/ColorConversion.cpp:
+ (WebCore::toCMYKA): Deleted.
+ * platform/graphics/ColorConversion.h:
+ (WebCore::toCMYKA): Deleted.
+ * platform/graphics/ColorTypes.h:
+ (WebCore::CMYKA::CMYKA): Deleted.
+
2021-01-21 Myles C. Maxfield <mmaxfi...@apple.com>
Add WebXR to features.json
Modified: trunk/Source/WebCore/platform/graphics/ColorConversion.cpp (271722 => 271723)
--- trunk/Source/WebCore/platform/graphics/ColorConversion.cpp 2021-01-22 00:15:45 UTC (rev 271722)
+++ trunk/Source/WebCore/platform/graphics/ColorConversion.cpp 2021-01-22 00:55:04 UTC (rev 271723)
@@ -403,33 +403,7 @@
};
}
-// CMYK conversions.
-SRGBA<float> toSRGBA(const CMYKA<float>& color)
-{
- auto [c, m, y, k, a] = color;
- float colors = 1 - k;
- float r = colors * (1.0f - c);
- float g = colors * (1.0f - m);
- float b = colors * (1.0f - y);
- return { r, g, b, a };
-}
-
-CMYKA<float> toCMYKA(const SRGBA<float>& color)
-{
- auto [r, g, b, a] = color;
-
- auto k = 1.0f - std::max({ r, g, b });
- if (k == 1.0f)
- return { 0, 0, 0, 1.0f, a };
-
- auto c = (1.0f - r - k) / (1.0f - k);
- auto m = (1.0f - g - k) / (1.0f - k);
- auto y = (1.0f - b - k) / (1.0f - k);
- return { c, m, y, k, a };
-}
-
-
// Combination conversions (constructed from more basic conversions above).
XYZA<float> toXYZA(const SRGBA<float>& color)
@@ -482,14 +456,4 @@
return toHSLA(toSRGBA(color));
}
-XYZA<float> toXYZA(const CMYKA<float>& color)
-{
- return toXYZA(toSRGBA(color));
-}
-
-CMYKA<float> toCMYKA(const XYZA<float>& color)
-{
- return toCMYKA(toSRGBA(color));
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/ColorConversion.h (271722 => 271723)
--- trunk/Source/WebCore/platform/graphics/ColorConversion.h 2021-01-22 00:15:45 UTC (rev 271722)
+++ trunk/Source/WebCore/platform/graphics/ColorConversion.h 2021-01-22 00:55:04 UTC (rev 271723)
@@ -49,7 +49,6 @@
// Additions
WEBCORE_EXPORT LinearSRGBA<float> toLinearSRGBA(const SRGBA<float>&);
WEBCORE_EXPORT HSLA<float> toHSLA(const SRGBA<float>&);
-WEBCORE_EXPORT CMYKA<float> toCMYKA(const SRGBA<float>&);
// ExtendedSRGBA
WEBCORE_EXPORT XYZA<float> toXYZA(const ExtendedSRGBA<float>&);
@@ -99,13 +98,7 @@
// Additions
WEBCORE_EXPORT SRGBA<float> toSRGBA(const HSLA<float>&);
-// CMYKA
-WEBCORE_EXPORT XYZA<float> toXYZA(const CMYKA<float>&);
-WEBCORE_EXPORT CMYKA<float> toCMYKA(const XYZA<float>&);
-// Additions
-WEBCORE_EXPORT SRGBA<float> toSRGBA(const CMYKA<float>&);
-
// Identity conversions (useful for generic contexts).
constexpr SRGBA<float> toSRGBA(const SRGBA<float>& color) { return color; }
@@ -117,7 +110,6 @@
constexpr Lab<float> toLab(const Lab<float>& color) { return color; }
constexpr LCHA<float> toLCHA(const LCHA<float>& color) { return color; }
constexpr HSLA<float> toHSLA(const HSLA<float>& color) { return color; }
-constexpr CMYKA<float> toCMYKA(const CMYKA<float>& color) { return color; }
constexpr XYZA<float> toXYZA(const XYZA<float>& color) { return color; }
@@ -171,9 +163,4 @@
return toHSLA(toXYZA(color));
}
-template<typename T> CMYKA<float> toCMYKA(const T& color)
-{
- return toCMYKA(toXYZA(color));
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/ColorTypes.h (271722 => 271723)
--- trunk/Source/WebCore/platform/graphics/ColorTypes.h 2021-01-22 00:15:45 UTC (rev 271722)
+++ trunk/Source/WebCore/platform/graphics/ColorTypes.h 2021-01-22 00:55:04 UTC (rev 271723)
@@ -53,7 +53,6 @@
template<typename> struct LabModel;
template<typename> struct LCHModel;
template<typename> struct HSLModel;
-template<typename> struct CMYKModel;
template<typename> struct XYZModel;
template<> struct RGBModel<uint8_t> {
@@ -110,16 +109,6 @@
static constexpr bool isInvertible = true;
};
-template<> struct CMYKModel<float> {
- static constexpr std::array<ColorComponentRange<float>, 4> ranges { {
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 }
- } };
- static constexpr bool isInvertible = true;
-};
-
template<> struct XYZModel<float> {
static constexpr std::array<ColorComponentRange<float>, 3> ranges { {
{ -std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity() },
@@ -644,43 +633,6 @@
}
-// FIXME: When ColorComponents supports more than length == 4, add conversion to/from ColorComponents<T> for CMYKA
-template<typename T> struct CMYKA : ColorWithAlphaHelper<CMYKA<T>> {
- using ComponentType = T;
- using Model = CMYKModel<T>;
-
- constexpr CMYKA(T cyan, T magenta, T yellow, T black, T alpha = AlphaTraits<T>::opaque)
- : cyan { cyan }
- , magenta { magenta }
- , yellow { yellow }
- , black { black }
- , alpha { alpha }
- {
- }
-
- constexpr CMYKA()
- : CMYKA { 0, 0, 0, 0, 0 }
- {
- }
-
- T cyan;
- T magenta;
- T yellow;
- T black;
- T alpha;
-};
-
-template<typename T> constexpr bool operator==(const CMYKA<T>& a, const CMYKA<T>& b)
-{
- return a.cyan == b.cyan && a.magenta == b.magenta && a.yellow == b.yellow && a.black == b.black && a.alpha == b.alpha;
-}
-
-template<typename T> constexpr bool operator!=(const CMYKA<T>& a, const CMYKA<T>& b)
-{
- return !(a == b);
-}
-
-
template<typename T> struct XYZA : ColorWithAlphaHelper<XYZA<T>> {
using ComponentType = T;
using Model = XYZModel<T>;