aboutsummaryrefslogtreecommitdiffstats
path: root/src/libclut.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-13 17:41:30 +0200
committerMattias Andrée <maandree@kth.se>2016-07-13 17:41:30 +0200
commit14b0daf9bc56060850caed137d77b4f04d18ba1e (patch)
tree85862239bf01f9aa697f546d00c1f88698999d58 /src/libclut.h
parentAdd missing ++-operations (diff)
downloadlibclut-14b0daf9bc56060850caed137d77b4f04d18ba1e.tar.gz
libclut-14b0daf9bc56060850caed137d77b4f04d18ba1e.tar.bz2
libclut-14b0daf9bc56060850caed137d77b4f04d18ba1e.tar.xz
Fix a bug + Test some functions
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/libclut.h')
-rw-r--r--src/libclut.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/libclut.h b/src/libclut.h
index 3c15a6a..0d63d4a 100644
--- a/src/libclut.h
+++ b/src/libclut.h
@@ -379,26 +379,26 @@
* @param bmin The blue component value of the blackpoint.
* @param bmax The blue component value of the whitepoint.
*/
-#define libclut_rgb_limits(clut, max, type, rmin, rmax, gmin, gmax, bmin, bmax) \
- do \
- { \
- double diff__; \
- if ((rmin != 0.0) || (rmax != 1.0)) \
- { \
- diff__ = (double)(rmax__) - (double)(rmin__); \
- libclut__(clut, red, type, LIBCLUT_VALUE * diff__ + (rmin__)); \
- } \
- if ((gmin != 0.0) || (gmax != 1.0)) \
- { \
- diff__ = (double)(gmax__) - (double)(gmin__); \
- libclut__(clut, green, type, LIBCLUT_VALUE * diff__ + (gmin__)); \
- } \
- if ((bmin != 0.0) || (bmax != 1.0)) \
- { \
- diff__ = (double)(bmax__) - (double)(bmin__); \
- libclut__(clut, blue, type, LIBCLUT_VALUE * diff__ + (bmin__)); \
- } \
- } \
+#define libclut_rgb_limits(clut, max, type, rmin, rmax, gmin, gmax, bmin, bmax) \
+ do \
+ { \
+ double diff__; \
+ if ((rmin != 0.0) || (rmax != 1.0)) \
+ { \
+ diff__ = (double)(rmax) - (double)(rmin); \
+ libclut__(clut, red, type, LIBCLUT_VALUE / (double)(max) * diff__ + (rmin)); \
+ } \
+ if ((gmin != 0.0) || (gmax != 1.0)) \
+ { \
+ diff__ = (double)(gmax) - (double)(gmin); \
+ libclut__(clut, green, type, LIBCLUT_VALUE / (double)(max) * diff__ + (gmin)); \
+ } \
+ if ((bmin != 0.0) || (bmax != 1.0)) \
+ { \
+ diff__ = (double)(bmax) - (double)(bmin); \
+ libclut__(clut, blue, type, LIBCLUT_VALUE / (double)(max) * diff__ + (bmin)); \
+ } \
+ } \
while (0)