diff --git a/src/colorramp.c b/src/colorramp.c index cd43e7b7..d4b3fee7 100644 --- a/src/colorramp.c +++ b/src/colorramp.c @@ -21,6 +21,8 @@ #include #include +#define min(x,y) ((x) < (y) ? (x) : (y)) + /* Whitepoint values for temperatures at 100K intervals. These will be interpolated for the actual temperature. @@ -292,11 +294,11 @@ colorramp_fill(uint16_t *gamma_r, uint16_t *gamma_g, uint16_t *gamma_b, &blackbody_color[temp_index+3], white_point); for (int i = 0; i < size; i++) { - gamma_r[i] = pow((float)i/size, 1.0/gamma[0]) * - (UINT16_MAX+1) * brightness * white_point[0]; - gamma_g[i] = pow((float)i/size, 1.0/gamma[1]) * - (UINT16_MAX+1) * brightness * white_point[1]; - gamma_b[i] = pow((float)i/size, 1.0/gamma[2]) * - (UINT16_MAX+1) * brightness * white_point[2]; + gamma_r[i] = min(pow((float)i/size, 1.0/gamma[0]) * + (UINT16_MAX+1) * brightness * white_point[0], UINT16_MAX); + gamma_g[i] = min(pow((float)i/size, 1.0/gamma[1]) * + (UINT16_MAX+1) * brightness * white_point[1], UINT16_MAX); + gamma_b[i] = min(pow((float)i/size, 1.0/gamma[2]) * + (UINT16_MAX+1) * brightness * white_point[2], UINT16_MAX); } } diff --git a/src/redshift.c b/src/redshift.c index af76e674..23ad5985 100644 --- a/src/redshift.c +++ b/src/redshift.c @@ -187,7 +187,7 @@ static const location_provider_t location_providers[] = { #define MIN_TEMP 1000 #define MAX_TEMP 25000 #define MIN_BRIGHTNESS 0.1 -#define MAX_BRIGHTNESS 1.0 +#define MAX_BRIGHTNESS 1.5 #define MIN_GAMMA 0.1 #define MAX_GAMMA 10.0