From 8a866b051a7a6826c456d2cb91a7fd557cb2fd35 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 13 Jul 2016 02:32:08 +0200 Subject: Applying filters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/server.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/server.c') diff --git a/src/server.c b/src/server.c index d046a95..06d88da 100644 --- a/src/server.c +++ b/src/server.c @@ -603,7 +603,24 @@ static int get_gamma(size_t conn, char* message_id, char* crtc, char* coalesce, n = (size_t)m; if (coal) { - /* TODO coalesce */ + if (start == 0) + memcpy(buf + n, output->table_sums[end].u8.red, output->ramps_size); + else + { + union gamma_ramps ramps; + if (make_plain_ramps(&ramps, output)) + { + int saved_errno = errno; + free(buf); + errno = saved_errno; + return -1; + } + for (i = start; i < end; i++) + apply(&ramps, output->table_filters[i].ramps, output->depth, &ramps); + memcpy(buf + n, ramps.u8.red, output->ramps_size); + libgamma_gamma_ramps8_destroy(&(ramps.u8)); + } + n += output->ramps_size; } else for (i = start; i < end; i++) -- cgit v1.2.3-70-g09d2