Fix Wshadow warning in Color::Interpolate (#727)

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
Stefan Ravn van Overeem 2023-08-17 22:18:33 +02:00 committed by GitHub
parent acbdb50747
commit f7304c28c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,17 +224,17 @@ Color Color::Interpolate(float t, const Color& a, const Color& b) {
// Gamma correction: // Gamma correction:
// https://en.wikipedia.org/wiki/Gamma_correction // https://en.wikipedia.org/wiki/Gamma_correction
auto interp = [](uint8_t a, uint8_t b, float t) { auto interp = [t](uint8_t a_u, uint8_t b_u) {
constexpr float gamma = 2.2F; constexpr float gamma = 2.2F;
const float a_f = powf(a, gamma); const float a_f = powf(a_u, gamma);
const float b_f = powf(b, gamma); const float b_f = powf(b_u, gamma);
const float c_f = a_f * (1.0F - t) + // const float c_f = a_f * (1.0F - t) + //
b_f * t; b_f * t;
return static_cast<uint8_t>(powf(c_f, 1.F / gamma)); return static_cast<uint8_t>(powf(c_f, 1.F / gamma));
}; };
return Color::RGB(interp(a_r, b_r, t), // return Color::RGB(interp(a_r, b_r), //
interp(a_g, b_g, t), // interp(a_g, b_g), //
interp(a_b, b_b, t)); // interp(a_b, b_b)); //
} }
inline namespace literals { inline namespace literals {