From 4554a54a6cc6099021242e8404f11c47c77de250 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Fri, 27 Aug 2010 10:48:45 -0500 Subject: [PATCH] [devel] Don't force 1, 2, and 4-bit depths to 8 when PNG_NO_16BIT is defined. --- pngrtran.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pngrtran.c b/pngrtran.c index 98b492d54..2dbdb50fa 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.5.0 [August 26, 2010] + * Last changed in libpng 1.5.0 [August 27, 2010] * Copyright (c) 1998-2010 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -1293,8 +1293,11 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr) info_ptr->bit_depth = 8; #else /* Force chopping 16-bit input down to 8 */ - png_ptr->transformations |=PNG_16_TO_8; - info_ptr->bit_depth = 8; + if (info_ptr->bit_depth == 16) + { + png_ptr->transformations |=PNG_16_TO_8; + info_ptr->bit_depth = 8; + } #endif #endif @@ -2109,7 +2112,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row, png_uint_32 i; png_uint_32 row_width = row_info->width; +#ifdef PNG_READ_16BIT_SUPPORTED png_byte hi_filler = (png_byte)((filler>>8) & 0xff); +#endif png_byte lo_filler = (png_byte)(filler & 0xff); png_debug(1, "in png_do_read_filler"); -- GitLab