From 6113046ce6da8cdffd75816dd0a786b569d4ec02 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Oct 04 2019 16:27:27 +0000 Subject: minor fixes of png loading --- diff --git a/synfig-core/src/modules/mod_png/mptr_png.cpp b/synfig-core/src/modules/mod_png/mptr_png.cpp index e87e738..201c80a 100644 --- a/synfig-core/src/modules/mod_png/mptr_png.cpp +++ b/synfig-core/src/modules/mod_png/mptr_png.cpp @@ -70,12 +70,12 @@ SYNFIG_IMPORTER_SET_SUPPORTS_FILE_SYSTEM_WRAPPER(png_mptr, true); /* === M E T H O D S ======================================================= */ namespace { - inline unsigned short get_channel(png_bytep *rows, int bit_depth, int row, int col) { - unsigned int x = bit_depth > 8 - ? ((unsigned short*)(rows[row]))[col] - : rows[row] [col]; - unsigned int max = (1 << bit_depth) - 1; - return (x*65536u - 1u)/max; + inline ColorReal get_channel(png_bytep *rows, int bit_depth, int row, int col) { + int x = bit_depth > 8 + ? ((unsigned short*)(rows[row]))[col] + : rows[row] [col]; + int max = (1 << bit_depth) - 1; + return x/ColorReal(max); } } @@ -240,9 +240,9 @@ png_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &/*renddesc for(y=0;y