aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-12-16 10:38:31 -0800
committerThomas White <taw@bitwiz.org.uk>2009-12-16 10:41:25 -0800
commitbd8032bb42df52c7c2c33b76bf8904db714cf395 (patch)
treefbe5f3e6d481e4da47d354511c81a9e4e0908849
parentd84fd5ff386a1393bbec3b67c8f165c95613a53e (diff)
Clamp negative values to zero when displaying
-rw-r--r--src/render.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/render.c b/src/render.c
index bf6c0256..ba76b9e6 100644
--- a/src/render.c
+++ b/src/render.c
@@ -34,6 +34,7 @@
\
r = 0; g = 0; b = 0; \
\
+ if ( p < 0.0 ) p = 0.0; \
switch ( s ) { \
case 0 : { /* Black to blue */ \
r = 0; g = 0; b = p*255; \
@@ -72,6 +73,7 @@
#define RENDER_MONO \
float p; \
p = (float)val / (float)max; \
+ if ( p < 0.0 ) 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