From 9b299132ef8912910df5a90b1628cc3af1efc54d Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Sun, 28 Dec 2014 22:58:54 -0500 Subject: colorramp: Use supplied gamma ramps as initial value This changes colorramp_fill() to base the ramp calculations on the existing values in the supplied tables, instead of basing it on a pure `i/size` value computed on the fly. All gamma adjustment methods are changed to explicitly initialize the ramps to the `i/size` value before calls to colorramp_fill(). --- src/gamma-drm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/gamma-drm.c') diff --git a/src/gamma-drm.c b/src/gamma-drm.c index cbdafe5..d431395 100644 --- a/src/gamma-drm.c +++ b/src/gamma-drm.c @@ -268,6 +268,16 @@ drm_set_temperature(drm_state_t *state, const color_setting_t *setting) } last_gamma_size = crtcs->gamma_size; } + + /* Initialize gamma ramps to pure state */ + int ramp_size = crtcs->gamma_size; + for (int i = 0; i < ramp_size; i++) { + uint16_t value = (double)i/ramp_size * (UINT16_MAX+1); + r_gamma[i] = value; + g_gamma[i] = value; + b_gamma[i] = value; + } + colorramp_fill(r_gamma, g_gamma, b_gamma, crtcs->gamma_size, setting); drmModeCrtcSetGamma(state->fd, crtcs->crtc_id, crtcs->gamma_size, -- cgit v1.2.3-70-g09d2