From 53dd8372cb5da8f59e24cbe9a15c4f7a272efb88 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 1 Apr 2006 14:40:17 +0000 Subject: [PATCH] Fixed decoder, encoder seems to have issues, though Originally committed to SVN as r282. --- prs/png_wrap.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prs/png_wrap.cpp b/prs/png_wrap.cpp index e2afcc1a8..5f5e80b79 100644 --- a/prs/png_wrap.cpp +++ b/prs/png_wrap.cpp @@ -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);