From 14b0daf9bc56060850caed137d77b4f04d18ba1e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 13 Jul 2016 17:41:30 +0200 Subject: Fix a bug + Test some functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libclut.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/libclut.h') 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) -- cgit v1.2.3-70-g09d2