diff options
author | Thomas White <taw@bitwiz.org.uk> | 2009-12-16 22:40:58 -0800 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2009-12-16 22:40:58 -0800 |
commit | a543ce3927194906b4d7b14c3dc36edfe717fdba (patch) | |
tree | 912f50d4979ca1a2ef72955a918f5806f9f1b2ab /src/render.c | |
parent | 5dc417886b5bb36b43d9354672cfc9e2a2b29512 (diff) |
Fix saturation/negative pixels
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 8 |
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 |