diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-05-14 11:35:25 +0200 |
---|---|---|
committer | Michel Dänzer <daenzer@vmware.com> | 2009-05-14 11:35:25 +0200 |
commit | fc3ce861cdab8606610726ce7c53f57d950c2407 (patch) | |
tree | eac2a7bd70836273faaf2161e23c1bf4f4cb99c3 /hw/xfree86/modes | |
parent | f3c61377d0fb1f09a18833995556fc9ffd11e097 (diff) |
randr12: Fix calculation of gamma ramp values.
The reciprocal gamma value was missed in the first copy and this mistake was
propagated to the second one.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Diffstat (limited to 'hw/xfree86/modes')
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.c | 6 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86RandR12.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 1b241cd33..0ab2f3df9 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -2228,19 +2228,19 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green, red[i] = i << 8; else red[i] = (CARD16)(pow((double)i/(double)(size - 1), - (double)gamma_red) * (double)(size - 1) * 256); + 1. / (double)gamma_red) * (double)(size - 1) * 256); if (gamma_green == 1.0) green[i] = i << 8; else green[i] = (CARD16)(pow((double)i/(double)(size - 1), - (double)gamma_green) * (double)(size - 1) * 256); + 1. / (double)gamma_green) * (double)(size - 1) * 256); if (gamma_blue == 1.0) blue[i] = i << 8; else blue[i] = (CARD16)(pow((double)i/(double)(size - 1), - (double)gamma_blue) * (double)(size - 1) * 256); + 1. / (double)gamma_blue) * (double)(size - 1) * 256); } /* Default size is 256, so anything else is failure. */ diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index f941a3b4a..c71cfe5c3 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -1703,7 +1703,7 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size) if (gamma == 1.0) ramp[i] = i << 8; else - ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), gamma) + ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), 1. / gamma) * (double)(size - 1) * 256); } } |