summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Piel <eric@triangle.(none)>2010-01-10 00:08:53 +0100
committerMatthias Hopf <mhopf@suse.de>2010-04-06 19:08:59 +0200
commitb5627bb72b3ca2c7f5a702b7134a5c6dd4f83687 (patch)
tree9a5cf4077c3ee42cdd7cd4d7fe7f664feb3e38bb
parentd138c73276226ce424d36e80ce745aa9461f110e (diff)
xrandr: fix maximum gamma set
Gamma is an array of 3 16-bit values. Currently, the maximum value assigned is 255*256, which is only 65280. Make sure that when we set the gamma, the maximum value is 65535. It's slightly brighter but also helps to avoid kludges to detect clamped values when reading back the gamma. Signed-off-by: √Čric Piel <eric.piel@tremplin-utc.net> Reviewed-by: Matthias Hopf <mhopf@suse.de>
-rw-r--r--xrandr.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/xrandr.c b/xrandr.c
index 65e0623..76c1342 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -1225,25 +1225,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;
if (output->gamma.green == 1.0 && output->brightness == 1.0)
- gamma->green[i] = i << 8;
+ gamma->green[i] = (i << 8) + i;
else
gamma->green[i] = dmin(pow((double)i/(double)(size - 1),
- (double)output->gamma.green) * (double)(size - 1)
- * (double)output->brightness * 256, 65535);
+ output->gamma.green) * output->brightness,
+ 1.0) * 65535.0;
if (output->gamma.blue == 1.0 && output->brightness == 1.0)
- gamma->blue[i] = i << 8;
+ gamma->blue[i] = (i << 8) + i;
else
gamma->blue[i] = dmin(pow((double)i/(double)(size - 1),
- (double)output->gamma.blue) * (double)(size - 1)
- * (double)output->brightness * 256, 65535);
+ output->gamma.blue) * output->brightness,
+ 1.0) * 65535.0;
}
XRRSetCrtcGamma(dpy, crtc->crtc.xid, gamma);