diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-22 21:12:44 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-22 21:12:44 +0200 |
commit | ab7f957f377cc1d28d35785fefb185533da9f6e4 (patch) | |
tree | ca7370b75b0d033b0105987fc4d1ebf23ea7b72d /src | |
parent | m misc + gamma-quartz-cg (diff) | |
download | libgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.gz libgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.bz2 libgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.xz |
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/gamma-linux-drm.c | 2 | ||||
-rw-r--r-- | src/gamma-quartz-cg.h | 4 | ||||
-rw-r--r-- | src/gamma-w32-gdi.c | 9 | ||||
-rw-r--r-- | src/gamma-w32-gdi.h | 4 | ||||
-rw-r--r-- | src/libgamma-method.c | 9 |
5 files changed, 20 insertions, 8 deletions
diff --git a/src/gamma-linux-drm.c b/src/gamma-linux-drm.c index ff41aa3..dbe01b5 100644 --- a/src/gamma-linux-drm.c +++ b/src/gamma-linux-drm.c @@ -44,7 +44,7 @@ void libgamma_linux_drm_method_capabilities(libgamma_method_capabilities_t* rest | CRTC_INFO_CONNECTOR_NAME | CRTC_INFO_CONNECTOR_TYPE | CRTC_INFO_GAMMA; - this->default_site_known = NULL; + this->default_site_known = 1; this->multiple_sites = 0; this->multiple_partitions = 1; this->multiple_crtcs = 1; diff --git a/src/gamma-quartz-cg.h b/src/gamma-quartz-cg.h index f4331b4..e70ecc5 100644 --- a/src/gamma-quartz-cg.h +++ b/src/gamma-quartz-cg.h @@ -105,14 +105,14 @@ int libgamma_quartz_cg_partition_restore(libgamma_partition_state_t* restrict th * error identifier provided by this library */ int libgamma_quartz_cg_crtc_initialise(libgamma_crtc_state_t* restrict this, - libgamma_partition_state_t* restrict partition, size_t crtc); + libgamma_partition_state_t* restrict partition, size_t crtc) __attribute__((pure)); /** * Release all resources held by a CRTC state * * @param this The CRTC state */ -void libgamma_quartz_cg_crtc_destroy(libgamma_crtc_state_t* restrict this); +void libgamma_quartz_cg_crtc_destroy(libgamma_crtc_state_t* restrict this) __attribute__((const)); /** * Restore the gamma ramps for a CRTC to the system settings for that CRTC diff --git a/src/gamma-w32-gdi.c b/src/gamma-w32-gdi.c index 5065641..50683a9 100644 --- a/src/gamma-w32-gdi.c +++ b/src/gamma-w32-gdi.c @@ -143,6 +143,8 @@ int libgamma_w32_gdi_partition_initialise(libgamma_partition_state_t* restrict t if (partition != 0) return LIBGAMMA_NO_SUCH_PARTITION; + /* Count CRTC:s by iteration over all possible identifiers + until we reach on that does not exist. */ display.cb = sizeof(DISPLAY_DEVICE); while (EnumDisplayDevices(NULL, n, &display, 0)) if (n++, n == 0) @@ -196,11 +198,16 @@ int libgamma_w32_gdi_crtc_initialise(libgamma_crtc_state_t* restrict this, (void) partition; this->data = NULL; - display.cb = sizeof(DISPLAY_DEVICE); + + display.cb = sizeof(DISPLAY_DEVICE); /* Windows's API mandates this... */ + /* Get identifier for selected CRTC. */ if (!EnumDisplayDevices(NULL, (DWORD)crtc, &display, 0)) return LIBGAMMA_NO_SUCH_CRTC; + /* Check that the connector is enabled, + * newer versions of Windows will always pass. */ if (!(display.StateFlags & DISPLAY_DEVICE_ACTIVE)) return LIBGAMMA_CONNECTOR_DISABLED; + /* Acquire CRTC connection. */ context = CreateDC(TEXT("DISPLAY"), display.DeviceName, NULL, NULL); if (context == NULL) return LIBGAMMA_OPEN_CRTC_FAILED; diff --git a/src/gamma-w32-gdi.h b/src/gamma-w32-gdi.h index 02c220e..74c19fb 100644 --- a/src/gamma-w32-gdi.h +++ b/src/gamma-w32-gdi.h @@ -54,7 +54,7 @@ int libgamma_w32_gdi_site_initialise(libgamma_site_state_t* restrict this, * * @param this The site state */ -void libgamma_w32_gdi_site_destroy(libgamma_site_state_t* restrict this); +void libgamma_w32_gdi_site_destroy(libgamma_site_state_t* restrict this) __attribute__((const)); /** * Restore the gamma ramps all CRTCS with a site to the system settings @@ -83,7 +83,7 @@ int libgamma_w32_gdi_partition_initialise(libgamma_partition_state_t* restrict t * * @param this The partition state */ -void libgamma_w32_gdi_partition_destroy(libgamma_partition_state_t* restrict this); +void libgamma_w32_gdi_partition_destroy(libgamma_partition_state_t* restrict this) __attribute__((const)); /** * Restore the gamma ramps all CRTCS with a partition to the system settings diff --git a/src/libgamma-method.c b/src/libgamma-method.c index 164d0b4..47afd54 100644 --- a/src/libgamma-method.c +++ b/src/libgamma-method.c @@ -233,10 +233,15 @@ void libgamma_gamma_rampsf_free(libgamma_gamma_rampsf_t* restrict this) int libgamma_gamma_rampsd_initialise(libgamma_gamma_rampsd_t* restrict this) { size_t n = this->red_size + this->green_size + this->blue_size; - this->red = malloc(n * sizeof(double)); +#ifdef HAVE_GAMMA_METHOD_LINUX_DRM + /* Valgrind complains about us reading uninitialize memory if we just use malloc. */ + this->red = calloc(n, sizeof(double)); +#else + this->red = malloc(n * sizeof(double)); +#endif this->green = this-> red + this-> red_size; this->blue = this->green + this->green_size; - return this->red ? 0 : -1; + return this->red == NULL ? -1 : 0; } |