From 22dbe5bd6c4027725cc2e45f3996dbcf8157d5e8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 26 Feb 2010 17:56:21 +0100 Subject: Fix rendering above saturation value (happens now, due to floating point roundoff) --- src/render.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/render.c b/src/render.c index c91a2658..1ea36ea1 100644 --- a/src/render.c +++ b/src/render.c @@ -108,10 +108,13 @@ float *render_get_image_binned(DisplayWindow *dw, int binning, float *max) \ r = 0; g = 0; b = 0; \ \ - if ( (val < 0.0) || (val > max) ) { \ + if ( (val < 0.0) ) { \ s = 0; \ p = 1.0; \ } \ + if ( (val > max) ) { \ + s = 6; \ + } \ switch ( s ) { \ case 0 : { /* Black to blue */ \ r = 0; g = 0; b = p*255; \ @@ -141,17 +144,13 @@ float *render_get_image_binned(DisplayWindow *dw, int binning, float *max) r = 255; g = 255; b = 255; \ break; \ } \ - default : { /* Above saturation */ \ - r = 255; g = 255; b = 255; \ - break; \ - } \ } #define RENDER_MONO \ float p; \ p = (float)val / (float)max; \ if ( val < 0.0 ) p = 0.0; \ - if ( val > max ) p = 0.0; \ + if ( val > max ) p = 1.0; \ r = 255.0*p; g = 255.0*p; b = 255.0*p; -- cgit v1.2.3