aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/render.c b/src/render.c
index ca36ae58..e2412e96 100644
--- a/src/render.c
+++ b/src/render.c
@@ -34,7 +34,10 @@
\
r = 0; g = 0; b = 0; \
\
- if ( p < 0.0 ) p = 0.0; \
+ if ( (val < 0.0) || (val > max) ) { \
+ s = 0; \
+ p = 0.0; \
+ } \
switch ( s ) { \
case 0 : { /* Black to blue */ \
r = 0; g = 0; b = p*255; \
@@ -73,7 +76,8 @@
#define RENDER_MONO \
float p; \
p = (float)val / (float)max; \
- if ( p < 0.0 ) p = 0.0; \
+ if ( val < 0.0 ) p = 0.0; \
+ if ( val > max ) p = 0.0; \
r = 255.0*p; g = 255.0*p; b = 255.0*p;
/* NB This function is shared between render_get_image() and