From d7696768c7c89442e4a65ba089401bf2d3b619c6 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 18 Mar 2007 13:26:50 +0100 Subject: limit color values --- src/Stitch.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Stitch.cxx b/src/Stitch.cxx index c0a770b..23558ef 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -17,6 +17,7 @@ #include "Stitch.H" #define MIN(A,B) ((A)<(B)?(A):(B)) +#define MAX(A,B) ((A)>(B)?(A):(B)) #define MAX_VALUE 65025 static double pi_d = asin(1.0) * 2.0; @@ -235,7 +236,7 @@ Stitch::color_correct(int c, double a, int pic, int color) { V1 * a * a + V2 * a * a * a * a); - return (int) MIN(rint(cd), 65025.0); + return MAX(MIN((int) rint(cd), 65025), 0); } int -- cgit v1.2.3