aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-06-28 14:02:50 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:51 +0100
commit123da4404c1766c58ed9c34122e8e8b3d75e8614 (patch)
tree0d777869e64c52d8928666222ebb73c1b2530052 /src
parent05a5aa64bac39b045c841fc199e73451312f2a09 (diff)
Work round TIFF reader lameness
Diffstat (limited to 'src')
-rw-r--r--src/render.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/render.c b/src/render.c
index faad77dc..9546f5cd 100644
--- a/src/render.c
+++ b/src/render.c
@@ -564,9 +564,12 @@ int render_tiff_int16(DisplayWindow *dw, const char *filename)
val = image->data[x+(image->height-1-y)*image->width];
val *= ((float)dw->boostint/max);
- /* Clamp to 16-bit range */
+ /* Clamp to 16-bit range,
+ * and work round inability of most readers to deal
+ * with signed integers. */
+ val += 1000.0;
if ( val > 32767.0 ) val = 32767.0;
- if ( val < -32768.0 ) val = -32768.0;
+ if ( val < 0.0 ) val = 0.0;
line[x] = val;
}