From 6c48bac954014628681b211ff5c2575c026eee06 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 13 Sep 2014 11:32:05 +0200 Subject: update gamma-helper to support 8-bit ramps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/lib/gamma-helper.c | 3 +++ src/test/test.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/gamma-helper.c b/src/lib/gamma-helper.c index 41a27e0..e1386e0 100644 --- a/src/lib/gamma-helper.c +++ b/src/lib/gamma-helper.c @@ -189,6 +189,7 @@ static void translate_to_64(signed depth, size_t n, uint64_t* restrict out, libg switch (depth) { /* Translate integer. */ + case 8: __translate(out[i] = (uint64_t)(in.bits8. ALL[i]) * 0x0101010101010101ULL); case 16: __translate(out[i] = (uint64_t)(in.bits16.ALL[i]) * 0x0001000100010001ULL); case 32: __translate(out[i] = (uint64_t)(in.bits32.ALL[i]) * 0x0000000100000001ULL); /* Identity translation. */ @@ -218,6 +219,7 @@ static void translate_from_64(signed depth, size_t n, libgamma_gamma_ramps_any_t switch (depth) { /* Translate integer. */ + case 8: __translate(out.bits8. ALL[i] = (uint8_t)(in[i] / 0x0101010101010101ULL)); case 16: __translate(out.bits16.ALL[i] = (uint16_t)(in[i] / 0x0001000100010001ULL)); case 32: __translate(out.bits32.ALL[i] = (uint32_t)(in[i] / 0x0000000100000001ULL)); /* Identity translation. */ @@ -251,6 +253,7 @@ static int allocated_any_ramp(libgamma_gamma_ramps_any_t* restrict ramps_sys, size_t d, n = ramps.ANY.red_size + ramps.ANY.green_size + ramps.ANY.blue_size; switch (depth) { + case 8: d = sizeof(uint8_t); break; case 16: d = sizeof(uint16_t); break; case 32: d = sizeof(uint32_t); break; case 64: d = sizeof(uint64_t); break; diff --git a/src/test/test.c b/src/test/test.c index 5604efe..988b4a2 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -273,10 +273,9 @@ int main(void) { /* ramps16 is last because we want to make sure that the gamma ramps are preserved exactly on exit, and we assume RandR X is used. */ -#define LIST_INTEGER_RAMPS X(ramps32) X(ramps64) X(ramps16) +#define LIST_INTEGER_RAMPS X(ramps8) X(ramps32) X(ramps64) X(ramps16) #define LIST_FLOAT_RAMPS X(rampsf) X(rampsd) #define LIST_RAMPS LIST_FLOAT_RAMPS LIST_INTEGER_RAMPS - /* TODO X(ramps8) */ libgamma_site_state_t* restrict site_state = malloc(sizeof(libgamma_site_state_t)); libgamma_partition_state_t* restrict part_state = malloc(sizeof(libgamma_partition_state_t)); -- cgit v1.2.3-70-g09d2