diff options
author | Jon Lund Steffensen <jonlst@gmail.com> | 2015-01-04 16:35:05 -0500 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2015-01-04 16:35:05 -0500 |
commit | 6711be464ff2b8e08501d776e57b6f47e29af245 (patch) | |
tree | 9df16107d36ac46344fa1866ba957f105b2d5345 /src/gamma-drm.c | |
parent | redshift: Add gamma_is_valid function to check gamma (diff) | |
parent | w32gdi: Add preserve option to windows GDI method (diff) | |
download | redshift-ng-6711be464ff2b8e08501d776e57b6f47e29af245.tar.gz redshift-ng-6711be464ff2b8e08501d776e57b6f47e29af245.tar.bz2 redshift-ng-6711be464ff2b8e08501d776e57b6f47e29af245.tar.xz |
Merge branch 'preserve-gamma'
Diffstat (limited to 'src/gamma-drm.c')
-rw-r--r-- | src/gamma-drm.c | 10 |
1 files changed, 10 insertions, 0 deletions
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, |