From 904a592ff51ff40afd2a96fb492e47f3628d94a9 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 22 May 2014 00:36:14 +0200 Subject: do ramp translations in the façade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/gamma-dummy.c | 1 - src/gamma-helper.h | 8 +- src/gamma-linux-drm.c | 132 --------------------------- src/gamma-linux-drm.h | 91 ------------------- src/gamma-quartz-cg.c | 132 --------------------------- src/gamma-quartz-cg.h | 91 ------------------- src/gamma-w32-gdi.c | 132 --------------------------- src/gamma-w32-gdi.h | 91 ------------------- src/gamma-x-randr.c | 133 ---------------------------- src/gamma-x-randr.h | 91 ------------------- src/gamma-x-vidmode.c | 133 ---------------------------- src/gamma-x-vidmode.h | 91 ------------------- src/libgamma-facade.c | 241 ++++++++++++++------------------------------------ 13 files changed, 69 insertions(+), 1298 deletions(-) (limited to 'src') diff --git a/src/gamma-dummy.c b/src/gamma-dummy.c index ba3c55a..d35e3bb 100644 --- a/src/gamma-dummy.c +++ b/src/gamma-dummy.c @@ -22,7 +22,6 @@ #include "gamma-dummy.h" #include "libgamma-error.h" -#include "gamma-helper.h" /** diff --git a/src/gamma-helper.h b/src/gamma-helper.h index 00eaa85..4324b84 100644 --- a/src/gamma-helper.h +++ b/src/gamma-helper.h @@ -78,8 +78,8 @@ typedef int libgamma_set_ramps_any_fun(libgamma_crtc_state_t* restrict this, * @return Zero on success, otherwise (negative) the value of an * error identifier provided by this library */ -#define libgamma_translated_ramp_get(this, ramps, depth_user, depth_system, fun) \ - libgamma_translated_ramp_get_(this, (libgamma_gamma_ramps_any_t*)(ramps), depth_user, depth_system, \ +#define libgamma_translated_ramp_get(this, ramps, depth_user, depth_system, fun) \ + libgamma_translated_ramp_get_(this, ramps, depth_user, depth_system, \ (libgamma_get_ramps_any_fun*)(fun)) @@ -98,8 +98,8 @@ typedef int libgamma_set_ramps_any_fun(libgamma_crtc_state_t* restrict this, * @return Zero on success, otherwise (negative) the value of an * error identifier provided by this library */ -#define libgamma_translated_ramp_set(this, ramps, depth_user, depth_system, fun) \ - libgamma_translated_ramp_set_(this, (libgamma_gamma_ramps_any_t)(ramps), depth_user, depth_system, \ +#define libgamma_translated_ramp_set(this, ramps, depth_user, depth_system, fun) \ + libgamma_translated_ramp_set_(this, ramps, depth_user, depth_system, \ (libgamma_set_ramps_any_fun*)(fun)) diff --git a/src/gamma-linux-drm.c b/src/gamma-linux-drm.c index f33e07a..ff41aa3 100644 --- a/src/gamma-linux-drm.c +++ b/src/gamma-linux-drm.c @@ -22,7 +22,6 @@ #include "gamma-linux-drm.h" #include "libgamma-error.h" -#include "gamma-helper.h" #include @@ -237,134 +236,3 @@ int libgamma_linux_drm_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this { } - - -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 32, 16, - libgamma_linux_drm_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 32, 16, - libgamma_linux_drm_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 64, 16, - libgamma_linux_drm_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 64, 16, - libgamma_linux_drm_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -1, 16, - libgamma_linux_drm_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -1, 16, - libgamma_linux_drm_crtc_set_gamma_ramps); -} - - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -2, 16, - libgamma_linux_drm_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -2, 16, - libgamma_linux_drm_crtc_set_gamma_ramps); -} - diff --git a/src/gamma-linux-drm.h b/src/gamma-linux-drm.h index fb34eab..144e45d 100644 --- a/src/gamma-linux-drm.h +++ b/src/gamma-linux-drm.h @@ -159,96 +159,5 @@ int libgamma_linux_drm_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this libgamma_gamma_ramps_t ramps); -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t ramps); - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_linux_drm_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps); - - #endif diff --git a/src/gamma-quartz-cg.c b/src/gamma-quartz-cg.c index 582b12a..fc0a4e2 100644 --- a/src/gamma-quartz-cg.c +++ b/src/gamma-quartz-cg.c @@ -22,7 +22,6 @@ #include "gamma-quartz-cg.h" #include "libgamma-error.h" -#include "gamma-helper.h" /** @@ -194,105 +193,6 @@ int libgamma_quartz_cg_get_crtc_information(libgamma_crtc_information_t* restric } -/** - * Get current the gamma ramps for a CRTC, 16-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_get_gamma_ramps(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 16, -1, - libgamma_quartz_cg_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 16-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 16, -1, - libgamma_quartz_cg_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 32, -1, - libgamma_quartz_cg_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 32, -1, - libgamma_quartz_cg_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 64, -1, - libgamma_quartz_cg_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 64, -1, - libgamma_quartz_cg_crtc_set_gamma_ramps); -} - - - /** * Get current the gamma ramps for a CRTC, `float` version * @@ -320,35 +220,3 @@ int libgamma_quartz_cg_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict thi { } - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -2, -1, - libgamma_quartz_cg_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -2, -1, - libgamma_quartz_cg_crtc_set_gamma_ramps); -} - diff --git a/src/gamma-quartz-cg.h b/src/gamma-quartz-cg.h index 74432b6..2bb8fb4 100644 --- a/src/gamma-quartz-cg.h +++ b/src/gamma-quartz-cg.h @@ -136,75 +136,6 @@ int libgamma_quartz_cg_crtc_restore(libgamma_crtc_state_t* restrict this); int libgamma_quartz_cg_get_crtc_information(libgamma_crtc_information_t* restrict this, libgamma_crtc_state_t* restrict crtc, int32_t fields); -/** - * Get current the gamma ramps for a CRTC, 16-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_get_gamma_ramps(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 16-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps); - - /** * Get current the gamma ramps for a CRTC, `float` version * @@ -227,28 +158,6 @@ int libgamma_quartz_cg_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict thi int libgamma_quartz_cg_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, libgamma_gamma_rampsf_t ramps); -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_quartz_cg_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps); - #endif diff --git a/src/gamma-w32-gdi.c b/src/gamma-w32-gdi.c index 0819ac0..e6155a8 100644 --- a/src/gamma-w32-gdi.c +++ b/src/gamma-w32-gdi.c @@ -22,7 +22,6 @@ x/** #include "gamma-w32-gdi.h" #include "libgamma-error.h" -#include "gamma-helper.h" #ifndef WINVER # define WINVER 0x0500 @@ -311,134 +310,3 @@ int libgamma_w32_gdi_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this, return 0; } - - -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 32, 16, - libgamma_w32_gdi_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 32, 16, - libgamma_w32_gdi_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 64, 16, - libgamma_w32_gdi_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 64, 16, - libgamma_w32_gdi_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -1, 16, - libgamma_w32_gdi_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -1, 16, - libgamma_w32_gdi_crtc_set_gamma_ramps); -} - - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -2, 16, - libgamma_w32_gdi_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -2, 16, - libgamma_w32_gdi_crtc_set_gamma_ramps); -} - diff --git a/src/gamma-w32-gdi.h b/src/gamma-w32-gdi.h index dacc1c7..7bf8356 100644 --- a/src/gamma-w32-gdi.h +++ b/src/gamma-w32-gdi.h @@ -159,96 +159,5 @@ int libgamma_w32_gdi_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this, libgamma_gamma_ramps_t ramps); -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t ramps); - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_w32_gdi_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps); - - #endif diff --git a/src/gamma-x-randr.c b/src/gamma-x-randr.c index 67e2a3b..99a5a21 100644 --- a/src/gamma-x-randr.c +++ b/src/gamma-x-randr.c @@ -22,7 +22,6 @@ #include "gamma-x-randr.h" #include "libgamma-error.h" -#include "gamma-helper.h" #include #include @@ -252,135 +251,3 @@ int libgamma_x_randr_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this, /* TODO */ } - - -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 32, 16, - libgamma_x_randr_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 32, 16, - libgamma_x_randr_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 64, 16, - libgamma_x_randr_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 64, 16, - libgamma_x_randr_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -1, 16, - libgamma_x_randr_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -1, 16, - libgamma_x_randr_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -2, 16, - libgamma_x_randr_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -2, 16, - libgamma_x_randr_crtc_set_gamma_ramps); -} - diff --git a/src/gamma-x-randr.h b/src/gamma-x-randr.h index 009e107..3091bf5 100644 --- a/src/gamma-x-randr.h +++ b/src/gamma-x-randr.h @@ -159,96 +159,5 @@ int libgamma_x_randr_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this, libgamma_gamma_ramps_t ramps); -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t ramps); - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_randr_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps); - - #endif diff --git a/src/gamma-x-vidmode.c b/src/gamma-x-vidmode.c index aa9a75d..2ece071 100644 --- a/src/gamma-x-vidmode.c +++ b/src/gamma-x-vidmode.c @@ -22,7 +22,6 @@ #include "gamma-x-vidmode.h" #include "libgamma-error.h" -#include "gamma-helper.h" #include @@ -218,135 +217,3 @@ int libgamma_x_vidmode_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this { } - - -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 32, 16, - libgamma_x_vidmode_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 32, 16, - libgamma_x_vidmode_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, 64, 16, - libgamma_x_vidmode_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, 64, 16, - libgamma_x_vidmode_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -1, 16, - libgamma_x_vidmode_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -1, 16, - libgamma_x_vidmode_crtc_set_gamma_ramps); -} - - - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps) -{ - return libgamma_translated_ramp_get(this, ramps, -2, 16, - libgamma_x_vidmode_crtc_get_gamma_ramps); -} - - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps) -{ - return libgamma_translated_ramp_set(this, ramps, -2, 16, - libgamma_x_vidmode_crtc_set_gamma_ramps); -} - diff --git a/src/gamma-x-vidmode.h b/src/gamma-x-vidmode.h index 2f3e2cd..266d137 100644 --- a/src/gamma-x-vidmode.h +++ b/src/gamma-x-vidmode.h @@ -159,96 +159,5 @@ int libgamma_x_vidmode_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this libgamma_gamma_ramps_t ramps); -/** - * Get current the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 32-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps32_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, 64-bit gamma-depth version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, - libgamma_gamma_ramps64_t ramps); - - -/** - * Get current the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `float` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsf_t ramps); - -/** - * Get current the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to fill with the current values - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t* restrict ramps); - -/** - * Set the gamma ramps for a CRTC, `double` version - * - * @param this The CRTC state - * @param ramps The gamma ramps to apply - * @return Zero on success, otherwise (negative) the value of an - * error identifier provided by this library - */ -int libgamma_x_vidmode_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, - libgamma_gamma_rampsd_t ramps); - - #endif diff --git a/src/libgamma-facade.c b/src/libgamma-facade.c index 7736118..3ef4e71 100644 --- a/src/libgamma-facade.c +++ b/src/libgamma-facade.c @@ -19,6 +19,7 @@ #include "libgamma-error.h" #include "libgamma-method.h" +#include "gamma-helper.h" #ifdef HAVE_GAMMA_METHOD_DUMMY # include "gamma-dummy.h" # ifndef HAVE_GAMMA_METHODS @@ -989,7 +990,12 @@ int libgamma_crtc_get_gamma_ramps(libgamma_crtc_state_t* restrict this, #endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - return libgamma_quartz_cg_crtc_get_gamma_ramps(this, ramps); + { + libgamma_gamma_ramps_any_t ramps_; + ramps_.bits16 = *ramps; + return libgamma_translated_ramp_get(this, &ramps_, 16, -1, + libgamma_crtc_get_gamma_ramps); + } #endif default: @@ -1037,7 +1043,12 @@ int libgamma_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this, #endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - return libgamma_quartz_cg_crtc_set_gamma_ramps(this, ramps); + { + libgamma_gamma_ramps_any_t ramps_; + ramps_.bits16 = ramps; + return libgamma_translated_ramp_set(this, ramps_, 16, -1, + libgamma_crtc_set_gamma_ramps); + } #endif default: @@ -1058,39 +1069,24 @@ int libgamma_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this, int libgamma_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, libgamma_gamma_ramps32_t* restrict ramps) { -#ifdef HAVE_NO_GAMMA_METHODS - (void) ramps; -#endif - + libgamma_gamma_ramps_any_t ramps_; switch (this->partition->site->method) { #ifdef HAVE_GAMMA_METHOD_DUMMY case GAMMA_METHOD_DUMMY: return libgamma_dummy_crtc_get_gamma_ramps32(this, ramps); #endif -#ifdef HAVE_GAMMA_METHOD_X_RANDR - case GAMMA_METHOD_X_RANDR: - return libgamma_x_randr_crtc_get_gamma_ramps32(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_X_VIDMODE - case GAMMA_METHOD_X_VIDMODE: - return libgamma_x_vidmode_crtc_get_gamma_ramps32(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_LINUX_DRM - case GAMMA_METHOD_LINUX_DRM: - return libgamma_linux_drm_crtc_get_gamma_ramps32(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_W32_GDI - case GAMMA_METHOD_W32_GDI: - return libgamma_w32_gdi_crtc_get_gamma_ramps32(this, ramps); -#endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - return libgamma_quartz_cg_crtc_get_gamma_ramps32(this, ramps); + ramps_.bits32 = *ramps; + return libgamma_translated_ramp_get(this, &ramps_, 32, -1, + libgamma_crtc_get_gamma_ramps); #endif default: - return LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD; + ramps_.bits32 = *ramps; + return libgamma_translated_ramp_get(this, &ramps_, 32, 16, + libgamma_crtc_get_gamma_ramps); } } @@ -1106,39 +1102,24 @@ int libgamma_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this, int libgamma_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, libgamma_gamma_ramps32_t ramps) { -#ifdef HAVE_NO_GAMMA_METHODS - (void) ramps; -#endif - + libgamma_gamma_ramps_any_t ramps_; switch (this->partition->site->method) { #ifdef HAVE_GAMMA_METHOD_DUMMY case GAMMA_METHOD_DUMMY: return libgamma_dummy_crtc_set_gamma_ramps32(this, ramps); #endif -#ifdef HAVE_GAMMA_METHOD_X_RANDR - case GAMMA_METHOD_X_RANDR: - return libgamma_x_randr_crtc_set_gamma_ramps32(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_X_VIDMODE - case GAMMA_METHOD_X_VIDMODE: - return libgamma_x_vidmode_crtc_set_gamma_ramps32(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_LINUX_DRM - case GAMMA_METHOD_LINUX_DRM: - return libgamma_linux_drm_crtc_set_gamma_ramps32(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_W32_GDI - case GAMMA_METHOD_W32_GDI: - return libgamma_w32_gdi_crtc_set_gamma_ramps32(this, ramps); -#endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - return libgamma_quartz_cg_crtc_set_gamma_ramps32(this, ramps); + ramps_.bits32 = ramps; + return libgamma_translated_ramp_set(this, ramps_, 32, -1, + libgamma_crtc_set_gamma_ramps); #endif default: - return LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD; + ramps_.bits32 = ramps; + return libgamma_translated_ramp_set(this, ramps_, 32, 16, + libgamma_crtc_set_gamma_ramps); } } @@ -1155,39 +1136,24 @@ int libgamma_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this, int libgamma_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, libgamma_gamma_ramps64_t* restrict ramps) { -#ifdef HAVE_NO_GAMMA_METHODS - (void) ramps; -#endif - + libgamma_gamma_ramps_any_t ramps_; switch (this->partition->site->method) { #ifdef HAVE_GAMMA_METHOD_DUMMY case GAMMA_METHOD_DUMMY: return libgamma_dummy_crtc_get_gamma_ramps64(this, ramps); #endif -#ifdef HAVE_GAMMA_METHOD_X_RANDR - case GAMMA_METHOD_X_RANDR: - return libgamma_x_randr_crtc_get_gamma_ramps64(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_X_VIDMODE - case GAMMA_METHOD_X_VIDMODE: - return libgamma_x_vidmode_crtc_get_gamma_ramps64(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_LINUX_DRM - case GAMMA_METHOD_LINUX_DRM: - return libgamma_linux_drm_crtc_get_gamma_ramps64(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_W32_GDI - case GAMMA_METHOD_W32_GDI: - return libgamma_w32_gdi_crtc_get_gamma_ramps64(this, ramps); -#endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - return libgamma_quartz_cg_crtc_get_gamma_ramps64(this, ramps); + ramps_.bits64 = *ramps; + return libgamma_translated_ramp_get(this, &ramps_, 64, -1, + libgamma_crtc_get_gamma_ramps); #endif default: - return LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD; + ramps_.bits64 = *ramps; + return libgamma_translated_ramp_get(this, &ramps_, 64, 16, + libgamma_crtc_get_gamma_ramps); } } @@ -1203,39 +1169,24 @@ int libgamma_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this, int libgamma_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, libgamma_gamma_ramps64_t ramps) { -#ifdef HAVE_NO_GAMMA_METHODS - (void) ramps; -#endif - + libgamma_gamma_ramps_any_t ramps_; switch (this->partition->site->method) { #ifdef HAVE_GAMMA_METHOD_DUMMY case GAMMA_METHOD_DUMMY: return libgamma_dummy_crtc_set_gamma_ramps64(this, ramps); #endif -#ifdef HAVE_GAMMA_METHOD_X_RANDR - case GAMMA_METHOD_X_RANDR: - return libgamma_x_randr_crtc_set_gamma_ramps64(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_X_VIDMODE - case GAMMA_METHOD_X_VIDMODE: - return libgamma_x_vidmode_crtc_set_gamma_ramps64(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_LINUX_DRM - case GAMMA_METHOD_LINUX_DRM: - return libgamma_linux_drm_crtc_set_gamma_ramps64(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_W32_GDI - case GAMMA_METHOD_W32_GDI: - return libgamma_w32_gdi_crtc_set_gamma_ramps64(this, ramps); -#endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - return libgamma_quartz_cg_crtc_set_gamma_ramps64(this, ramps); + ramps_.bits64 = ramps; + return libgamma_translated_ramp_set(this, ramps_, 64, -1, + libgamma_crtc_set_gamma_ramps); #endif default: - return LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD; + ramps_.bits64 = ramps; + return libgamma_translated_ramp_set(this, ramps_, 64, 16, + libgamma_crtc_set_gamma_ramps); } } @@ -1252,39 +1203,22 @@ int libgamma_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this, int libgamma_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, libgamma_gamma_rampsf_t* restrict ramps) { -#ifdef HAVE_NO_GAMMA_METHODS - (void) ramps; -#endif - + libgamma_gamma_ramps_any_t ramps_; switch (this->partition->site->method) { #ifdef HAVE_GAMMA_METHOD_DUMMY case GAMMA_METHOD_DUMMY: return libgamma_dummy_crtc_get_gamma_rampsf(this, ramps); #endif -#ifdef HAVE_GAMMA_METHOD_X_RANDR - case GAMMA_METHOD_X_RANDR: - return libgamma_x_randr_crtc_get_gamma_rampsf(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_X_VIDMODE - case GAMMA_METHOD_X_VIDMODE: - return libgamma_x_vidmode_crtc_get_gamma_rampsf(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_LINUX_DRM - case GAMMA_METHOD_LINUX_DRM: - return libgamma_linux_drm_crtc_get_gamma_rampsf(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_W32_GDI - case GAMMA_METHOD_W32_GDI: - return libgamma_w32_gdi_crtc_get_gamma_rampsf(this, ramps); -#endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: return libgamma_quartz_cg_crtc_get_gamma_rampsf(this, ramps); #endif default: - return LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD; + ramps_.float_single = *ramps; + return libgamma_translated_ramp_get(this, &ramps_, -1, 16, + libgamma_crtc_get_gamma_ramps); } } @@ -1300,39 +1234,24 @@ int libgamma_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, int libgamma_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, libgamma_gamma_rampsf_t ramps) { -#ifdef HAVE_NO_GAMMA_METHODS - (void) ramps; -#endif - switch (this->partition->site->method) { #ifdef HAVE_GAMMA_METHOD_DUMMY case GAMMA_METHOD_DUMMY: return libgamma_dummy_crtc_set_gamma_rampsf(this, ramps); #endif -#ifdef HAVE_GAMMA_METHOD_X_RANDR - case GAMMA_METHOD_X_RANDR: - return libgamma_x_randr_crtc_set_gamma_rampsf(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_X_VIDMODE - case GAMMA_METHOD_X_VIDMODE: - return libgamma_x_vidmode_crtc_set_gamma_rampsf(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_LINUX_DRM - case GAMMA_METHOD_LINUX_DRM: - return libgamma_linux_drm_crtc_set_gamma_rampsf(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_W32_GDI - case GAMMA_METHOD_W32_GDI: - return libgamma_w32_gdi_crtc_set_gamma_rampsf(this, ramps); -#endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: return libgamma_quartz_cg_crtc_set_gamma_rampsf(this, ramps); #endif default: - return LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD; + { + libgamma_gamma_ramps_any_t ramps_; + ramps_.float_single = ramps; + return libgamma_translated_ramp_set(this, ramps_, -1, 16, + libgamma_crtc_set_gamma_ramps); + } } } @@ -1349,39 +1268,24 @@ int libgamma_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, int libgamma_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, libgamma_gamma_rampsd_t* restrict ramps) { -#ifdef HAVE_NO_GAMMA_METHODS - (void) ramps; -#endif - + libgamma_gamma_ramps_any_t ramps_; switch (this->partition->site->method) { #ifdef HAVE_GAMMA_METHOD_DUMMY case GAMMA_METHOD_DUMMY: return libgamma_dummy_crtc_get_gamma_rampsd(this, ramps); #endif -#ifdef HAVE_GAMMA_METHOD_X_RANDR - case GAMMA_METHOD_X_RANDR: - return libgamma_x_randr_crtc_get_gamma_rampsd(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_X_VIDMODE - case GAMMA_METHOD_X_VIDMODE: - return libgamma_x_vidmode_crtc_get_gamma_rampsd(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_LINUX_DRM - case GAMMA_METHOD_LINUX_DRM: - return libgamma_linux_drm_crtc_get_gamma_rampsd(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_W32_GDI - case GAMMA_METHOD_W32_GDI: - return libgamma_w32_gdi_crtc_get_gamma_rampsd(this, ramps); -#endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - return libgamma_quartz_cg_crtc_get_gamma_rampsd(this, ramps); + ramps_.float_double = *ramps; + return libgamma_translated_ramp_get(this, &ramps_, -2, -1, + libgamma_crtc_get_gamma_ramps); #endif default: - return LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD; + ramps_.float_double = *ramps; + return libgamma_translated_ramp_get(this, &ramps_, -2, 16, + libgamma_crtc_get_gamma_ramps); } } @@ -1397,39 +1301,24 @@ int libgamma_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this, int libgamma_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this, libgamma_gamma_rampsd_t ramps) { -#ifdef HAVE_NO_GAMMA_METHODS - (void) ramps; -#endif - + libgamma_gamma_ramps_any_t ramps_; switch (this->partition->site->method) { #ifdef HAVE_GAMMA_METHOD_DUMMY case GAMMA_METHOD_DUMMY: return libgamma_dummy_crtc_set_gamma_rampsd(this, ramps); #endif -#ifdef HAVE_GAMMA_METHOD_X_RANDR - case GAMMA_METHOD_X_RANDR: - return libgamma_x_randr_crtc_set_gamma_rampsd(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_X_VIDMODE - case GAMMA_METHOD_X_VIDMODE: - return libgamma_x_vidmode_crtc_set_gamma_rampsd(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_LINUX_DRM - case GAMMA_METHOD_LINUX_DRM: - return libgamma_linux_drm_crtc_set_gamma_rampsd(this, ramps); -#endif -#ifdef HAVE_GAMMA_METHOD_W32_GDI - case GAMMA_METHOD_W32_GDI: - return libgamma_w32_gdi_crtc_set_gamma_rampsd(this, ramps); -#endif #ifdef HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - return libgamma_quartz_cg_crtc_set_gamma_rampsd(this, ramps); + ramps_.float_double = ramps; + return libgamma_translated_ramp_set(this, ramps_, -2, -1, + libgamma_crtc_set_gamma_ramps); #endif default: - return LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD; + ramps_.float_double = ramps; + return libgamma_translated_ramp_set(this, ramps_, -2, 16, + libgamma_crtc_set_gamma_ramps); } } -- cgit v1.2.3-70-g09d2