From a8cede88dc170cf39f430e44fd9d659d3173032b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 16 Aug 2016 11:53:49 +0200 Subject: ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/include-libcoopgamma.h | 9 +++ src/libcoopgamma_native.pyx.gpp | 172 ++++++++++++++++++++-------------------- 2 files changed, 95 insertions(+), 86 deletions(-) (limited to 'src') diff --git a/src/include-libcoopgamma.h b/src/include-libcoopgamma.h index 19d83e4..5150bf3 100644 --- a/src/include-libcoopgamma.h +++ b/src/include-libcoopgamma.h @@ -17,3 +17,12 @@ */ #include + +#define fclass class +#define u_red_size u8.red_size +#define u_green_size u8.green_size +#define u_blue_size u8.blue_size +#define u_red u8.red +#define u_green u8.green +#define u_blue u8.blue + diff --git a/src/libcoopgamma_native.pyx.gpp b/src/libcoopgamma_native.pyx.gpp index f5a4925..e750b02 100644 --- a/src/libcoopgamma_native.pyx.gpp +++ b/src/libcoopgamma_native.pyx.gpp @@ -46,17 +46,17 @@ cdef extern from "include-libcoopgamma.h": ctypedef struct libcoopgamma_ramps_t: # Gamma ramp structure - size_t red_size + size_t u_red_size # The number of stops in the red ramp - size_t green_size + size_t u_green_size # The number of stops in the green ramp - size_t blue_size + size_t u_blue_size # The number of stops in the blue ramp - void* red + void* u_red # The red ramp - void* green + void* u_green # The green ramp - void* blue + void* u_blue # The blue ramp ctypedef struct libcoopgamma_filter_t: @@ -1446,52 +1446,52 @@ def libcoopgamma_native_get_gamma_recv(address : int, async : int): for i in range(int(table.filter_count)): rampsp = &(table.filters[i].ramps) fclass = table.filters[i].fclass - red = [None] * rampsp.red_size - green = [None] * rampsp.green_size - blue = [None] * rampsp.blue_size + red = [None] * rampsp.u_red_size + green = [None] * rampsp.u_green_size + blue = [None] * rampsp.u_blue_size if table.depth == -2: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == -1: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == 8: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == 16: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == 32: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == 64: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] - ramps = (rampsp.red_size, rampsp.green_size, rampsp.blue_size, red, green, blue) + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] + ramps = (rampsp.u_red_size, rampsp.u_green_size, rampsp.u_blue_size, red, green, blue) filters[i] = (int(table.filters[i].priority), fclass.decode('utf-8', 'strict'), ramps) ret = (True, (int(table.red_size), int(table.green_size), int(table.blue_size), int(table.depth), filters)) @@ -1547,52 +1547,52 @@ def libcoopgamma_native_get_gamma_sync(query, address : int): for i in range(int(table.filter_count)): rampsp = &(table.filters[i].ramps) fclass = table.filters[i].fclass - red = [None] * rampsp.red_size - green = [None] * rampsp.green_size - blue = [None] * rampsp.blue_size + red = [None] * rampsp.u_red_size + green = [None] * rampsp.u_green_size + blue = [None] * rampsp.u_blue_size if table.depth == -2: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == -1: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == 8: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == 16: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == 32: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] elif table.depth == 64: - for i in range(rampsp.red_size): - red[i] = ((rampsp.red))[i] - for i in range(rampsp.green_size): - green[i] = ((rampsp.green))[i] - for i in range(rampsp.blue_size): - blue[i] = ((rampsp.blue))[i] - ramps = (rampsp.red_size, rampsp.green_size, rampsp.blue_size, red, green, blue) + for i in range(rampsp.u_red_size): + red[i] = ((rampsp.u_red))[i] + for i in range(rampsp.u_green_size): + green[i] = ((rampsp.u_green))[i] + for i in range(rampsp.u_blue_size): + blue[i] = ((rampsp.u_blue))[i] + ramps = (rampsp.u_red_size, rampsp.u_green_size, rampsp.u_blue_size, red, green, blue) filters[i] = (int(table.filters[i].priority), fclass.decode('utf-8', 'strict'), ramps) ret = (True, (int(table.red_size), int(table.green_size), int(table.blue_size), int(table.depth), filters)) -- cgit v1.2.3-70-g09d2