Commit a5ba6f9b authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

color_utils: Use std::sqrt() instead of std::sqrtf()

This fixes the build with libstdc++:

    ../../ui/gfx/color_utils.cc: In function ‘SkColor color_utils::SetDarkestColorForTesting(SkColor)’:
    ../../ui/gfx/color_utils.cc:434:12: error: ‘sqrtf’ is not a member of ‘std’
           std::sqrtf((dark_luminance + 0.05f) * (kWhiteLuminance + 0.05f)) - 0.05f;
                ^~~~~
    ../../ui/gfx/color_utils.cc:434:12: note: suggested alternative: ‘sqrt’
           std::sqrtf((dark_luminance + 0.05f) * (kWhiteLuminance + 0.05f)) - 0.05f;
                ^~~~~
                sqrt

sqrtf() is not formally part of C++14 as far as I can see even though libc++
has it in <cmath>. Additionally, we're only dealing with floats in all parts
of the expression above, so using the float sqrt() overload should be
harmless anyway.

Bug: 819294
Change-Id: If6c7bf31819df97a761e6963def6d6506154c34d
Reviewed-on: https://chromium-review.googlesource.com/c/1458193
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#630140}
parent 26efe998
...@@ -431,7 +431,7 @@ SkColor SetDarkestColorForTesting(SkColor color) { ...@@ -431,7 +431,7 @@ SkColor SetDarkestColorForTesting(SkColor color) {
// GetContrastRatio(kWhiteLuminance, g_luminance_midpoint). The formula below // GetContrastRatio(kWhiteLuminance, g_luminance_midpoint). The formula below
// can be verified by plugging it into how GetContrastRatio() operates. // can be verified by plugging it into how GetContrastRatio() operates.
g_luminance_midpoint = g_luminance_midpoint =
std::sqrtf((dark_luminance + 0.05f) * (kWhiteLuminance + 0.05f)) - 0.05f; std::sqrt((dark_luminance + 0.05f) * (kWhiteLuminance + 0.05f)) - 0.05f;
return previous_darkest_color; return previous_darkest_color;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment