diff --git a/src/Magnum/Math/Color.cpp b/src/Magnum/Math/Color.cpp index ab7f7d76a..08735aac1 100644 --- a/src/Magnum/Math/Color.cpp +++ b/src/Magnum/Math/Color.cpp @@ -173,23 +173,12 @@ Containers::Pair> Twe return {TweakableState::Error, {}}; } - /* According to https://wg21.link/CWG2521, space between "" and literal - name is deprecated because _Uppercase or __double names could be treated - as reserved depending on whether the space was present or not, and - whitespace is not load-bearing in any other contexts. Clang 17+ adds an - off-by-default warning for this; GCC 4.8 however *requires* the space - there, so until GCC 4.8 support is dropped, we suppress this warning - instead of removing the space. */ - #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wdeprecated-literal-operator" - #endif + /* Both the _srgba and _rgba literals return the same value (but a + different type) as they're meant mainly for self-documenting purposes. + So here's no distinction either, and fromLinearRgbInt() is just + splitting up the 24-bit integer to 8-bit parts. */ return {TweakableState::Success, - isSrgb ? Magnum::Math::Literals::operator"" _srgb(result) : - Magnum::Math::Literals::operator"" _rgb(result)}; - #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 - #pragma clang diagnostic pop - #endif + Magnum::Math::Color3::fromLinearRgbInt(result)}; } Containers::Pair> TweakableParser>::parse(const Containers::StringView value) { @@ -219,23 +208,12 @@ Containers::Pair> Twe return {TweakableState::Error, {}}; } - /* According to https://wg21.link/CWG2521, space between "" and literal - name is deprecated because _Uppercase or __double names could be treated - as reserved depending on whether the space was present or not, and - whitespace is not load-bearing in any other contexts. Clang 17+ adds an - off-by-default warning for this; GCC 4.8 however *requires* the space - there, so until GCC 4.8 support is dropped, we suppress this warning - instead of removing the space. */ - #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wdeprecated-literal-operator" - #endif + /* Both the _srgba and _rgba literals return the same value (but a + different type) as they're meant mainly for self-documenting purposes. + So here's no distinction either, and fromLinearRgbaInt() is just + splitting up the 32-bit integer to 8-bit parts. */ return {TweakableState::Success, - isSrgb ? Magnum::Math::Literals::operator"" _srgba(result) : - Magnum::Math::Literals::operator"" _rgba(result)}; - #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 - #pragma clang diagnostic pop - #endif + Magnum::Math::Color4::fromLinearRgbaInt(result)}; } Containers::Pair> TweakableParser>::parse(const Containers::StringView value) { @@ -265,23 +243,9 @@ Containers::Pair> TweakableP return {TweakableState::Error, {}}; } - /* According to https://wg21.link/CWG2521, space between "" and literal - name is deprecated because _Uppercase or __double names could be treated - as reserved depending on whether the space was present or not, and - whitespace is not load-bearing in any other contexts. Clang 17+ adds an - off-by-default warning for this; GCC 4.8 however *requires* the space - there, so until GCC 4.8 support is dropped, we suppress this warning - instead of removing the space. */ - #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wdeprecated-literal-operator" - #endif - return {TweakableState::Success, - isSrgb ? Magnum::Math::Literals::operator"" _srgbf(result) : - Magnum::Math::Literals::operator"" _rgbf(result)}; - #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 - #pragma clang diagnostic pop - #endif + return {TweakableState::Success, isSrgb ? + Magnum::Math::Color3::fromSrgbInt(result) : + Magnum::Math::Color3::fromLinearRgbInt(result)}; } Containers::Pair> TweakableParser>::parse(const Containers::StringView value) { @@ -311,23 +275,9 @@ Containers::Pair> TweakableP return {TweakableState::Error, {}}; } - /* According to https://wg21.link/CWG2521, space between "" and literal - name is deprecated because _Uppercase or __double names could be treated - as reserved depending on whether the space was present or not, and - whitespace is not load-bearing in any other contexts. Clang 17+ adds an - off-by-default warning for this; GCC 4.8 however *requires* the space - there, so until GCC 4.8 support is dropped, we suppress this warning - instead of removing the space. */ - #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wdeprecated-literal-operator" - #endif - return {TweakableState::Success, - isSrgb ? Magnum::Math::Literals::operator"" _srgbaf(result) : - Magnum::Math::Literals::operator"" _rgbaf(result)}; - #if defined(CORRADE_TARGET_CLANG) && __clang_major__ >= 17 - #pragma clang diagnostic pop - #endif + return {TweakableState::Success, isSrgb ? + Magnum::Math::Color4::fromSrgbAlphaInt(result) : + Magnum::Math::Color4::fromLinearRgbaInt(result)}; } }}