summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-16 01:29:36 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-16 01:29:36 +0200
commit660b3e108259354b15d3c187b65550707855b5e7 (patch)
treeeb4495aeccb740dc991e03f0cec16e5436155486
parentadd missed break (diff)
downloadblueshift-660b3e108259354b15d3c187b65550707855b5e7.tar.gz
blueshift-660b3e108259354b15d3c187b65550707855b5e7.tar.bz2
blueshift-660b3e108259354b15d3c187b65550707855b5e7.tar.xz
missed to read gamma ramp size
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/blueshift_quartz_c.c13
-rw-r--r--src/fake_quartz.c2
2 files changed, 14 insertions, 1 deletions
diff --git a/src/blueshift_quartz_c.c b/src/blueshift_quartz_c.c
index 54f8826..19ffbe9 100644
--- a/src/blueshift_quartz_c.c
+++ b/src/blueshift_quartz_c.c
@@ -42,6 +42,7 @@ static uint32_t* gamma_sizes = NULL;
int blueshift_quartz_open(void)
{
uint32_t cap = 4;
+ uint32_t i;
CGError r;
crtcs = malloc((size_t)cap * sizeof(CGDirectDisplayID));
@@ -92,6 +93,18 @@ int blueshift_quartz_open(void)
close_fake_quartz();
return -1;
}
+ for (i = 0; i < crtc_count; i++)
+ {
+ gamma_sizes[i] = CGDisplayGammaTableCapacity(crtcs[i]);
+ if (gamma_sizes[i] < 2)
+ {
+ fprintf(stderr, "Quartz reported impossibly small gamma ramps.\n");
+ free(gamma_sizes);
+ free(crtcs);
+ close_fake_quartz();
+ return -1;
+ }
+ }
}
return 0;
diff --git a/src/fake_quartz.c b/src/fake_quartz.c
index 3fe821c..840f5b1 100644
--- a/src/fake_quartz.c
+++ b/src/fake_quartz.c
@@ -153,7 +153,7 @@ CGError CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_si
if (gamma_size != 256)
{
- fprintf(stderr, "Gamma size should be 256\n");
+ fprintf(stderr, "Gamma size should be 256, got %u\n", gamma_size);
abort();
}