mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 05:28:15 +08:00 
			
		
		
		
	Fix Wshadow warning in Color::Interpolate (#727)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							acbdb50747
						
					
				
				
					commit
					f7304c28c3
				
			@@ -224,17 +224,17 @@ Color Color::Interpolate(float t, const Color& a, const Color& b) {
 | 
			
		||||
 | 
			
		||||
  // 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;
 | 
			
		||||
    const float a_f = powf(a, gamma);
 | 
			
		||||
    const float b_f = powf(b, gamma);
 | 
			
		||||
    const float a_f = powf(a_u, gamma);
 | 
			
		||||
    const float b_f = powf(b_u, gamma);
 | 
			
		||||
    const float c_f = a_f * (1.0F - t) +  //
 | 
			
		||||
                      b_f * t;
 | 
			
		||||
    return static_cast<uint8_t>(powf(c_f, 1.F / gamma));
 | 
			
		||||
  };
 | 
			
		||||
  return Color::RGB(interp(a_r, b_r, t),   //
 | 
			
		||||
                    interp(a_g, b_g, t),   //
 | 
			
		||||
                    interp(a_b, b_b, t));  //
 | 
			
		||||
  return Color::RGB(interp(a_r, b_r),   //
 | 
			
		||||
                    interp(a_g, b_g),   //
 | 
			
		||||
                    interp(a_b, b_b));  //
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline namespace literals {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user