From 2e5e800e4b334240689df5a4c2c4607f751da908 Mon Sep 17 00:00:00 2001 From: UjinT34 <41110182+UjinT34@users.noreply.github.com> Date: Thu, 26 Mar 2026 02:48:06 +0300 Subject: renderer/cm: Support wp-cm-v1 version 2 (#12817) --- src/helpers/cm/ColorManagement.cpp | 6 +++--- src/helpers/cm/ColorManagement.hpp | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src/helpers') diff --git a/src/helpers/cm/ColorManagement.cpp b/src/helpers/cm/ColorManagement.cpp index bac9f25a..829adbe7 100644 --- a/src/helpers/cm/ColorManagement.cpp +++ b/src/helpers/cm/ColorManagement.cpp @@ -72,7 +72,7 @@ const Hyprgraphics::CMatrix3& CPrimaries::convertMatrix(const WPid(); } @@ -87,7 +87,7 @@ PImageDescription CImageDescription::from(const SImageDescription& imageDescript return knownDescriptions.back(); } -PImageDescription CImageDescription::from(const uint32_t imageDescriptionId) { +PImageDescription CImageDescription::from(const uint64_t imageDescriptionId) { ASSERT(imageDescriptionId <= knownDescriptions.size()); return knownDescriptions[imageDescriptionId - 1]; } @@ -102,7 +102,7 @@ const SImageDescription& CImageDescription::value() const { return m_imageDescription; } -uint CImageDescription::id() const { +uint64_t CImageDescription::id() const { return m_id; } diff --git a/src/helpers/cm/ColorManagement.hpp b/src/helpers/cm/ColorManagement.hpp index 0103e2a4..0bb80f42 100644 --- a/src/helpers/cm/ColorManagement.hpp +++ b/src/helpers/cm/ColorManagement.hpp @@ -65,10 +65,16 @@ namespace NColorManagement { return sc(primaries); } inline wpColorManagerV1TransferFunction convertTransferFunction(eTransferFunction tf) { - return sc(tf); + switch (tf) { + case CM_TRANSFER_FUNCTION_SRGB: return WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_COMPOUND_POWER_2_4; + default: return sc(tf); + } } inline eTransferFunction convertTransferFunction(wpColorManagerV1TransferFunction tf) { - return sc(tf); + switch (tf) { + case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_COMPOUND_POWER_2_4: return CM_TRANSFER_FUNCTION_SRGB; + default: return sc(tf); + } } using SPCPRimaries = Hyprgraphics::SPCPRimaries; @@ -304,19 +310,19 @@ namespace NColorManagement { class CImageDescription { public: static WP from(const SImageDescription& imageDescription); - static WP from(const uint32_t imageDescriptionId); + static WP from(const uint64_t imageDescriptionId); WP with(const SImageDescription::SPCLuminances& luminances) const; const SImageDescription& value() const; - uint32_t id() const; + uint64_t id() const; WP getPrimaries() const; private: - CImageDescription(const SImageDescription& imageDescription, const uint imageDescriptionId); - uint32_t m_id = 0; - uint32_t m_primariesId = 0; + CImageDescription(const SImageDescription& imageDescription, const uint64_t imageDescriptionId); + uint64_t m_id = 0; + uint m_primariesId = 0; SImageDescription m_imageDescription; }; -- cgit v1.2.3