diff options
author | Mattias Andrée <maandree@kth.se> | 2016-08-19 20:39:05 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-08-19 20:39:05 +0200 |
commit | 215dae7424c98292e17607db2bb08b0935ee5cfe (patch) | |
tree | c94b732b961ba438e717b0a955d97d6abd7afc4c /src/libcoopgamma_native.pyx.gpp | |
parent | work on test + fix errors (diff) | |
download | pylibcoopgamma-215dae7424c98292e17607db2bb08b0935ee5cfe.tar.gz pylibcoopgamma-215dae7424c98292e17607db2bb08b0935ee5cfe.tar.bz2 pylibcoopgamma-215dae7424c98292e17607db2bb08b0935ee5cfe.tar.xz |
test + fix errors
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/libcoopgamma_native.pyx.gpp')
-rw-r--r-- | src/libcoopgamma_native.pyx.gpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/libcoopgamma_native.pyx.gpp b/src/libcoopgamma_native.pyx.gpp index 1597e0c..60d9f4a 100644 --- a/src/libcoopgamma_native.pyx.gpp +++ b/src/libcoopgamma_native.pyx.gpp @@ -1784,17 +1784,20 @@ def libcoopgamma_native_set_gamma_send(filtr, address : int, async : int): cdef libcoopgamma_filter_t flr crtc_bs = filtr.crtc.encode('utf-8') + bytes([0]) clss_bs = filtr.fclass.encode('utf-8') + bytes([0]) - flr.priority = <int64_t>(filtr.priority) + flr.priority = <int64_t>(0 if filtr.priority is None else filtr.priority) flr.lifespan = <libcoopgamma_lifespan_t>(filtr.lifespan) - flr.depth = <libcoopgamma_depth_t>(filtr.depth) + flr.depth = <libcoopgamma_depth_t>(0 if filtr.depth is None else filtr.depth) flr.fclass = NULL flr.crtc = NULL - flr.ramps.u_red_size = len(filtr.ramps.red) - flr.ramps.u_green_size = len(filtr.ramps.green) - flr.ramps.u_blue_size = len(filtr.ramps.blue) - flr.ramps.u_red = NULL + flr.ramps.u_red_size = len(filtr.ramps.red) if filtr.ramps is not None else 0 + flr.ramps.u_green_size = len(filtr.ramps.green) if filtr.ramps is not None else 0 + flr.ramps.u_blue_size = len(filtr.ramps.blue) if filtr.ramps is not None else 0 + flr.ramps.u_red = NULL + flr.ramps.u_green = NULL + flr.ramps.u_blue = NULL try: - libcoopgamma_native_copy_ramps(<intptr_t><void*>&(flr.ramps), filtr.ramps, flr.depth) + if filtr.ramps is not None: + libcoopgamma_native_copy_ramps(<intptr_t><void*>&(flr.ramps), filtr.ramps, flr.depth) flr.crtc = <char*>malloc(len(crtc_bs) * sizeof(char)) if flr.crtc is NULL: return int(errno) @@ -1857,17 +1860,20 @@ def libcoopgamma_native_set_gamma_sync(filtr, address : int): cdef bytes bs crtc_bs = filtr.crtc.encode('utf-8') + bytes([0]) clss_bs = filtr.fclass.encode('utf-8') + bytes([0]) - flr.priority = <int64_t>(filtr.priority) + flr.priority = <int64_t>(0 if filtr.priority is None else filtr.priority) flr.lifespan = <libcoopgamma_lifespan_t>(filtr.lifespan) - flr.depth = <libcoopgamma_depth_t>(filtr.depth) + flr.depth = <libcoopgamma_depth_t>(0 if filtr.depth is None else filtr.depth) flr.fclass = NULL flr.crtc = NULL - flr.ramps.u_red_size = len(filtr.ramps.red) - flr.ramps.u_green_size = len(filtr.ramps.green) - flr.ramps.u_blue_size = len(filtr.ramps.blue) - flr.ramps.u_red = NULL + flr.ramps.u_red_size = len(filtr.ramps.red) if filtr.ramps is not None else 0 + flr.ramps.u_green_size = len(filtr.ramps.green) if filtr.ramps is not None else 0 + flr.ramps.u_blue_size = len(filtr.ramps.blue) if filtr.ramps is not None else 0 + flr.ramps.u_red = NULL + flr.ramps.u_green = NULL + flr.ramps.u_blue = NULL try: - libcoopgamma_native_copy_ramps(<intptr_t><void*>&(flr.ramps), filtr.ramps, flr.depth) + if filtr.ramps is not None: + libcoopgamma_native_copy_ramps(<intptr_t><void*>&(flr.ramps), filtr.ramps, flr.depth) flr.crtc = <char*>malloc(len(crtc_bs) * sizeof(char)) if flr.crtc is NULL: return int(errno) |