aboutsummaryrefslogtreecommitdiffstats
path: root/fake-w32-gdi.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-03-07 22:51:21 +0100
committerMattias Andrée <maandree@kth.se>2021-03-07 22:51:21 +0100
commitbaa6a1cf7979c095c1081daa2a2d1134c76d2f1b (patch)
treed0525238a334091eb4d241b0b83da1a4a1793d5b /fake-w32-gdi.c
parentStart replacing info manual with man pages (diff)
downloadlibgamma-baa6a1cf7979c095c1081daa2a2d1134c76d2f1b.tar.gz
libgamma-baa6a1cf7979c095c1081daa2a2d1134c76d2f1b.tar.bz2
libgamma-baa6a1cf7979c095c1081daa2a2d1134c76d2f1b.tar.xz
misc
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'fake-w32-gdi.c')
-rw-r--r--fake-w32-gdi.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fake-w32-gdi.c b/fake-w32-gdi.c
index bee0e93..e5978a2 100644
--- a/fake-w32-gdi.c
+++ b/fake-w32-gdi.c
@@ -316,6 +316,7 @@ GetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp)
xcb_randr_get_crtc_gamma_cookie_t gamma_cookie;
xcb_randr_get_crtc_gamma_reply_t *restrict gamma_reply;
xcb_generic_error_t *error;
+ uint16_t *restrict ramp = lpRamp;
/* Read current gamma ramps */
gamma_cookie = xcb_randr_get_crtc_gamma(connection, *(xcb_randr_crtc_t *)hDC);
@@ -323,16 +324,10 @@ GetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp)
if (error)
return FALSE;
-#define DEST_RAMP(I) (&((uint16_t *)lpRamp)[(I) * GAMMA_RAMP_SIZE])
-#define SRC_RAMP(C) (xcb_randr_get_crtc_gamma_##C(gamma_reply))
-
/* Copy the ramps into the output parameter (coalesced) */
- memcpy(DEST_RAMP(0), SRC_RAMP(red), GAMMA_RAMP_SIZE * sizeof(uint16_t));
- memcpy(DEST_RAMP(1), SRC_RAMP(green), GAMMA_RAMP_SIZE * sizeof(uint16_t));
- memcpy(DEST_RAMP(2), SRC_RAMP(blue), GAMMA_RAMP_SIZE * sizeof(uint16_t));
-
-#undef SRC_RAMP
-#undef DEST_RAMP
+ memcpy(&ramp[0 * GAMMA_RAMP_SIZE], xcb_randr_get_crtc_gamma_red(gamma_reply), GAMMA_RAMP_SIZE * sizeof(*ramp));
+ memcpy(&ramp[1 * GAMMA_RAMP_SIZE], xcb_randr_get_crtc_gamma_green(gamma_reply), GAMMA_RAMP_SIZE * sizeof(*ramp));
+ memcpy(&ramp[2 * GAMMA_RAMP_SIZE], xcb_randr_get_crtc_gamma_blue(gamma_reply), GAMMA_RAMP_SIZE * sizeof(*ramp));
free(gamma_reply);
return TRUE;