aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-26 17:56:21 +0100
committerThomas White <taw@physics.org>2010-02-26 17:56:21 +0100
commit22dbe5bd6c4027725cc2e45f3996dbcf8157d5e8 (patch)
treeb406048bc22895c869e58dcde924bda33b583a64 /src/render.c
parenta34f668051317f475c64c7aad6143dda76325fd1 (diff)
Fix rendering above saturation value (happens now, due to floating point roundoff)
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c11
1 files 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;