diff options
author | Edward Zhu <edward_zhu@bupt.edu.cn> | 2015-08-21 05:58:52 +0300 |
---|---|---|
committer | Edward Zhu <edward_zhu@bupt.edu.cn> | 2015-08-21 05:58:52 +0300 |
commit | 3d268eae9ca243d5a63c3e15ce661a2871191ab3 (patch) | |
tree | 3e5442136bc9417bd64ec65854d3ef67a768351e | |
parent | de926c7de81cf317ef92b908cacf20c8978efbfc (diff) |
fixed open 1-bit png on Mac
-rwxr-xr-x | generic/png.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/generic/png.c b/generic/png.c index b98028a..4c22a23 100755 --- a/generic/png.c +++ b/generic/png.c @@ -96,7 +96,7 @@ static int libpng_(Main_load)(lua_State *L) height = png_get_image_height(png_ptr, info_ptr); color_type = png_get_color_type(png_ptr, info_ptr); bit_depth = png_get_bit_depth(png_ptr, info_ptr); - png_read_update_info(png_ptr, info_ptr); + /* get depth */ int depth = 0; @@ -109,7 +109,6 @@ static int libpng_(Main_load)(lua_State *L) if(bit_depth < 8) { png_set_expand_gray_1_2_4_to_8(png_ptr); - png_read_update_info(png_ptr, info_ptr); } depth = 1; } @@ -119,7 +118,6 @@ static int libpng_(Main_load)(lua_State *L) { depth = 3; png_set_expand(png_ptr); - png_read_update_info(png_ptr, info_ptr); } else luaL_error(L, "[read_png_file] Unknown color space"); @@ -127,8 +125,9 @@ static int libpng_(Main_load)(lua_State *L) if(bit_depth < 8) { png_set_strip_16(png_ptr); - png_read_update_info(png_ptr, info_ptr); } + + png_read_update_info(png_ptr, info_ptr); /* read file */ if (setjmp(png_jmpbuf(png_ptr))) |