From: Michel Dänzer <[email protected]>

The reciprocal gamma value was missed in the first copy and this mistake was
propagated to the second one.
---
 hw/xfree86/modes/xf86Crtc.c    |    6 +++---
 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 1b241cd..0ab2f3d 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 f941a3b..c71cfe5 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);
     }
 }
-- 
1.6.2.4

_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to