Fixed decoder, encoder seems to have issues, though

Originally committed to SVN as r282.
This commit is contained in:
Rodrigo Braz Monteiro 2006-04-01 14:40:17 +00:00
parent 7022fe39ac
commit 53dd8372cb

View file

@ -102,8 +102,11 @@ void PNGWrapper::Read(PRSVideoFrame *frame) {
color_type = png_get_color_type(png_ptr, info_ptr);
if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
else if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
if (bit_depth > 8) png_set_strip_16(png_ptr);
if (bit_depth < 8) png_set_packing(png_ptr);
if (color_type == PNG_COLOR_TYPE_RGB) png_set_filler(png_ptr, 0xFFFF, PNG_FILLER_AFTER);
png_read_update_info(png_ptr, info_ptr);
int rowLen = png_get_rowbytes(png_ptr,info_ptr);