Open jdapena opened 11 months ago
I would contribute the PR with the fix myself, but contributing guidelines are quite explicit about not accepting external contributions (even under Google CLA, I guess?).
It's not just the missing header; it's also missing the std:: namespace for calls to abs(); at least with an older clang (14) and newer libstdc++ (13). Here's the patch that I wrote, but the CONTRIBUTING text saying they're not looking for external contributions is.. interesting.
--- a/cpp/palettes/tones.cc
+++ b/cpp/palettes/tones.cc
@@ -16,6 +16,8 @@
#include "cpp/palettes/tones.h"
+#include <cmath>
+
#include "cpp/cam/cam.h"
#include "cpp/cam/hct.h"
@@ -55,7 +57,7 @@ Argb TonalPalette::get(double tone) cons
Hct TonalPalette::createKeyColor(double hue, double chroma) {
double start_tone = 50.0;
Hct smallest_delta_hct(hue, chroma, start_tone);
- double smallest_delta = abs(smallest_delta_hct.get_chroma() - chroma);
+ double smallest_delta = std::abs(smallest_delta_hct.get_chroma() - chroma);
// Starting from T50, check T+/-delta to see if they match the requested
// chroma.
//
@@ -71,13 +73,13 @@ Hct TonalPalette::createKeyColor(double
return smallest_delta_hct;
}
Hct hct_add(hue, chroma, start_tone + delta);
- double hct_add_delta = abs(hct_add.get_chroma() - chroma);
+ double hct_add_delta = std::abs(hct_add.get_chroma() - chroma);
if (hct_add_delta < smallest_delta) {
smallest_delta = hct_add_delta;
smallest_delta_hct = hct_add;
}
Hct hct_subtract(hue, chroma, start_tone - delta);
- double hct_subtract_delta = abs(hct_subtract.get_chroma() - chroma);
+ double hct_subtract_delta = std::abs(hct_subtract.get_chroma() - chroma);
if (hct_subtract_delta < smallest_delta) {
smallest_delta = hct_subtract_delta;
smallest_delta_hct = hct_subtract;
Chromium build with GCC/libstdc++ library because of missing include in
tones.cc
. It should includemath.h
.