[libpng16] Improved performance of new do_check_palette_indexes() function

(only update the value when it actually increases, move test for whether
the check is wanted out of the function.
This commit is contained in:
Glenn Randers-Pehrson
2012-06-06 13:30:30 -05:00
parent b1e7771d5e
commit 14ca47b453
5 changed files with 15 additions and 8 deletions

View File

@@ -813,7 +813,8 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
/* Added at libpng-1.5.10 */
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
/* Check for out-of-range palette index */
if(row_info.color_type == PNG_COLOR_TYPE_PALETTE)
if (row_info.color_type == PNG_COLOR_TYPE_PALETTE &&
png_ptr->num_palette_max >= 0)
png_do_check_palette_indexes(png_ptr, &row_info);
#endif