[PATCH v2] xrandr: display gamma and brightness

Yang Zhao yang at yangman.ca
Mon Jan 18 12:56:50 PST 2010


A few small things:

2010/1/17 Éric Piel <E.A.B.Piel at tudelft.nl>:

> +/* Returns the index of the last value in an array < 65535 */
> +static int
> +find_last_non_clamped(CARD16 array[], int size)...

This is purely stylistic, but I generally think hexadecimal form for
values like this convey the meaning much more clearly. ie: 0xffff
instead of 65535.  YMMV.


> @@ -1225,25 +1311,25 @@ set_gamma(void)
>
>  	for (i = 0; i < size; i++) {
>  	    if (output->gamma.red == 1.0 && output->brightness == 1.0)
> -		gamma->red[i] = i << 8;
> +		gamma->red[i] = (i << 8) + i;
>  	    else
>  		gamma->red[i] = dmin(pow((double)i/(double)(size - 1),
> -			    (double)output->gamma.red) * (double)(size - 1)
> -			    * (double)output->brightness * 256, 65535.0);
> +					 output->gamma.red) * output->brightness,
> +				     1.0) * 65535.0;
> ...

These changes weren't part of the original patch, and seems to subtly
change the semantics of setting the gamma correction curve.  Included
by accident?

Otherwise, including what Matthias has already pointed out,

Reviewed-By: Yang Zhao <yang at yangman.ca>

-- 
Yang Zhao
http://yangman.ca


More information about the xorg-devel mailing list