diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-12-06 01:40:22 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-12-06 01:40:22 -0500 |
commit | 7db5342a36341b061a8785a3b349cf0fcad69ebf (patch) | |
tree | d308a40e26a11fe706a639a3f8f9afafe3976a4a /libdimension/png.c | |
parent | 0f6df6bc1eb9ded4a9a1a9e2c7ad50646cfb5aac (diff) | |
download | dimension-7db5342a36341b061a8785a3b349cf0fcad69ebf.tar.xz |
Fix reading of 8-bit PNG files.
Diffstat (limited to 'libdimension/png.c')
-rw-r--r-- | libdimension/png.c | 14 |
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; } } |