aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-10 19:55:11 +0200
committerMattias Andrée <maandree@kth.se>2016-07-10 19:58:19 +0200
commitf3516bae2c5b5a5f34cfb6227256e907e7d73807 (patch)
treed656df36b083d6ae562753dd165f0151bdc007d6
parentwhitespace (diff)
downloadcoopgammad-f3516bae2c5b5a5f34cfb6227256e907e7d73807.tar.gz
coopgammad-f3516bae2c5b5a5f34cfb6227256e907e7d73807.tar.bz2
coopgammad-f3516bae2c5b5a5f34cfb6227256e907e7d73807.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--src/gammad.c8
-rw-r--r--src/output.h47
-rw-r--r--src/ramps.h58
3 files changed, 75 insertions, 38 deletions
diff --git a/src/gammad.c b/src/gammad.c
index 49c6219..c04ba5d 100644
--- a/src/gammad.c
+++ b/src/gammad.c
@@ -129,6 +129,8 @@ int main(int argc, char** argv)
saved_errno = errno;
outputs[i].crtc = crtcs + i;
libgamma_crtc_information_destroy(&info);
+ outputs[i].ramps_size = outputs[i].red_size + outputs[i].green_size + outputs[i].blue_size;
+ /* outputs[i].ramps_size will be multipled by the stop-size later */
errno = saved_errno;
if (outputs[i].name == NULL)
goto fail;
@@ -154,24 +156,30 @@ int main(int argc, char** argv)
switch (outputs[i].depth)
{
case 8:
+ outputs[i].ramps_size *= sizeof(uint8_t);
LOAD_RAMPS(8, u8);
break;
case 16:
+ outputs[i].ramps_size *= sizeof(uint16_t);
LOAD_RAMPS(16, u16);
break;
case 32:
+ outputs[i].ramps_size *= sizeof(uint32_t);
LOAD_RAMPS(32, u32);
break;
default:
outputs[i].depth = 64;
/* fall through */
case 64:
+ outputs[i].ramps_size *= sizeof(uint64_t);
LOAD_RAMPS(64, u64);
break;
case -1:
+ outputs[i].ramps_size *= sizeof(float);
LOAD_RAMPS(f, f);
break;
case -2:
+ outputs[i].ramps_size *= sizeof(double);
LOAD_RAMPS(d, d);
break;
}
diff --git a/src/output.h b/src/output.h
index b84ea22..d3b39ec 100644
--- a/src/output.h
+++ b/src/output.h
@@ -19,43 +19,8 @@
#include <libgamma.h>
+#include "ramps.h"
-/**
- * Gamma ramps union for all
- * lbigamma gamma ramps types
- */
-union gamma_ramps
-{
- /**
- * Ramps with 8-bit value
- */
- libgamma_gamma_ramps8_t u8;
-
- /**
- * Ramps with 16-bit value
- */
- libgamma_gamma_ramps16_t u16;
-
- /**
- * Ramps with 32-bit value
- */
- libgamma_gamma_ramps32_t u32;
-
- /**
- * Ramps with 64-bit value
- */
- libgamma_gamma_ramps64_t u64;
-
- /**
- * Ramps with `float` value
- */
- libgamma_gamma_rampsf_t f;
-
- /**
- * Ramps with `double` value
- */
- libgamma_gamma_rampsd_t d;
-};
/**
@@ -79,16 +44,22 @@ struct output
size_t red_size;
/**
- * The number of stops in the red gamma ramp
+ * The number of stops in the green gamma ramp
*/
size_t green_size;
/**
- * The number of stops in the red gamma ramp
+ * The number of stops in the blue gamma ramp
*/
size_t blue_size;
/**
+ * `.red_size + .green_size + .blue_size`
+ * multiplied by the byte-size of each stop
+ */
+ size_t ramps_size;
+
+ /**
* Whether gamma ramps are supported
*/
enum libgamma_decision supported;
diff --git a/src/ramps.h b/src/ramps.h
new file mode 100644
index 0000000..0f1462c
--- /dev/null
+++ b/src/ramps.h
@@ -0,0 +1,58 @@
+/**
+ * gammad -- Cooperative gamma server
+ * Copyright (C) 2016 Mattias Andrée (maandree@kth.se)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <libgamma.h>
+
+
+
+/**
+ * Gamma ramps union for all
+ * lbigamma gamma ramps types
+ */
+union gamma_ramps
+{
+ /**
+ * Ramps with 8-bit value
+ */
+ libgamma_gamma_ramps8_t u8;
+
+ /**
+ * Ramps with 16-bit value
+ */
+ libgamma_gamma_ramps16_t u16;
+
+ /**
+ * Ramps with 32-bit value
+ */
+ libgamma_gamma_ramps32_t u32;
+
+ /**
+ * Ramps with 64-bit value
+ */
+ libgamma_gamma_ramps64_t u64;
+
+ /**
+ * Ramps with `float` value
+ */
+ libgamma_gamma_rampsf_t f;
+
+ /**
+ * Ramps with `double` value
+ */
+ libgamma_gamma_rampsd_t d;
+};
+