summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-12-06 01:40:22 -0500
committerTavian Barnes <tavianator@gmail.com>2011-12-06 01:40:22 -0500
commit7db5342a36341b061a8785a3b349cf0fcad69ebf (patch)
treed308a40e26a11fe706a639a3f8f9afafe3976a4a /libdimension
parent0f6df6bc1eb9ded4a9a1a9e2c7ad50646cfb5aac (diff)
downloaddimension-7db5342a36341b061a8785a3b349cf0fcad69ebf.tar.xz
Fix reading of 8-bit PNG files.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/png.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libdimension/png.c b/libdimension/png.c
index 82fa31a..7631804 100644
--- a/libdimension/png.c
+++ b/libdimension/png.c
@@ -362,10 +362,10 @@ dmnsn_png_read_canvas_thread(void *ptr)
color.trans = (double)((png_pixel[6] << 8) + png_pixel[7])/UINT16_MAX;
} else {
png_bytep png_pixel = image + 4*(y*width + x);
- color.R = (double)png_pixel[0]/UINT16_MAX;
- color.G = (double)png_pixel[1]/UINT16_MAX;
- color.B = (double)png_pixel[2]/UINT16_MAX;
- color.trans = (double)png_pixel[3]/UINT16_MAX;
+ color.R = (double)png_pixel[0]/UINT8_MAX;
+ color.G = (double)png_pixel[1]/UINT8_MAX;
+ color.B = (double)png_pixel[2]/UINT8_MAX;
+ color.trans = (double)png_pixel[3]/UINT8_MAX;
}
} else {
color.trans = 0.0;
@@ -377,9 +377,9 @@ dmnsn_png_read_canvas_thread(void *ptr)
color.B = (double)((png_pixel[4] << 8) + png_pixel[5])/UINT16_MAX;
} else {
png_bytep png_pixel = image + 3*(y*width + x);
- color.R = (double)png_pixel[0]/UINT16_MAX;
- color.G = (double)png_pixel[1]/UINT16_MAX;
- color.B = (double)png_pixel[2]/UINT16_MAX;
+ color.R = (double)png_pixel[0]/UINT8_MAX;
+ color.G = (double)png_pixel[1]/UINT8_MAX;
+ color.B = (double)png_pixel[2]/UINT8_MAX;
}
}