summaryrefslogtreecommitdiffstats
path: root/src/blueshift_vidmode_c.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-23 17:49:30 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-23 17:49:30 +0100
commit71f64125e8f66cf0e504c8b35f7ab89f22765ae4 (patch)
treed524163236bd911b9113843a0eabafbbc17801d2 /src/blueshift_vidmode_c.c
parenttypo (diff)
downloadblueshift-71f64125e8f66cf0e504c8b35f7ab89f22765ae4.tar.gz
blueshift-71f64125e8f66cf0e504c8b35f7ab89f22765ae4.tar.bz2
blueshift-71f64125e8f66cf0e504c8b35f7ab89f22765ae4.tar.xz
fix errors in getting current curves + add getting curent curves to tests + fix multimonitor mistakes in examples
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/blueshift_vidmode_c.c')
-rw-r--r--src/blueshift_vidmode_c.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/blueshift_vidmode_c.c b/src/blueshift_vidmode_c.c
index 8b9994d..42b501e 100644
--- a/src/blueshift_vidmode_c.c
+++ b/src/blueshift_vidmode_c.c
@@ -129,7 +129,7 @@ uint16_t* blueshift_vidmode_read(int use_crtc)
/* Read curves */
- uint16_t* r_gamma = ((uint16_t*)malloc((3 + 3 * curve_size) * sizeof(uint16_t))) + 1;
+ uint16_t* r_gamma = malloc((3 + 3 * curve_size) * sizeof(uint16_t));
uint16_t* g_gamma = r_gamma + curve_size + 1;
uint16_t* b_gamma = g_gamma + curve_size + 1;
if (r_gamma == NULL)
@@ -139,6 +139,10 @@ uint16_t* blueshift_vidmode_read(int use_crtc)
return NULL;
}
+ *r_gamma++ = curve_size;
+ *g_gamma++ = curve_size;
+ *b_gamma++ = curve_size;
+
if (XF86VidModeGetGammaRamp(display, screen, curve_size, r_gamma, g_gamma, b_gamma) == 0)
{
fprintf(stderr, "VidMode gamma query failed\n");
@@ -147,10 +151,7 @@ uint16_t* blueshift_vidmode_read(int use_crtc)
return NULL;
}
- *(r_gamma - 1) = curve_size;
- *(g_gamma - 1) = curve_size;
- *(b_gamma - 1) = curve_size;
- return r_gamma;
+ return r_gamma - 1;
}