From 795c311aae4b718585bc6194189f061000c823a1 Mon Sep 17 00:00:00 2001 From: Stephan Hartmann Date: Fri, 23 Dec 2022 14:28:55 +0000 Subject: [PATCH] libstdc++: fix narrowing in blink::DarkModeLABColorSpace Clang-14 errors out with narrowing from double to float. Use std::pow instead. --- .../renderer/platform/graphics/dark_mode_lab_color_space.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h b/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h index 999c3e5..c18ea7b 100644 --- a/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h +++ b/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h @@ -125,7 +125,7 @@ class DarkModeLABColorSpace { // https://en.wikipedia.org/wiki/CIELAB_color_space#Reverse_transformation. SkV3 FromXYZ(const SkV3& v) const { auto f = [](float x) { - return x > kSigma3 ? pow(x, 1.0f / 3.0f) + return x > kSigma3 ? std::pow(x, 1.0f / 3.0f) : x / (3 * kSigma2) + 4.0f / 29.0f; }; @@ -145,7 +145,8 @@ class DarkModeLABColorSpace { // https://en.wikipedia.org/wiki/CIELAB_color_space#Forward_transformation. SkV3 ToXYZ(const SkV3& lab) const { auto invf = [](float x) { - return x > kSigma ? pow(x, 3.0f) : 3.0f * kSigma2 * (x - 4.0f / 29.0f); + return x > kSigma ? std::pow(x, 3.0f) + : 3.0f * kSigma2 * (x - 4.0f / 29.0f); }; SkV3 v = {Clamp(lab.x, 0.0f, 100.0f), Clamp(lab.y, -128.0f, 128.0f), -- 2.38.2