From ae4af5600dd6c4620db88e4b1ef6445e4956645d Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 18 Jul 2009 11:28:33 -0500 Subject: [PATCH] [devel] Avoid some tests while selecting a filter. The AVG and PAETH filters will never be selected for the first row, so we need not test them. --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- pngwutil.c | 10 ++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index e69e2d276..5c982db77 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.4.0beta68 - July 7, 2009 +Libpng 1.4.0beta68 - July 18, 2009 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -499,7 +499,8 @@ version 1.4.0beta67 [July 6, 2009] Added high-level API transform PNG_TRANSFORM_GRAY_TO_RGB. Added an "xcode" project to the projects directory (Alam Arias). -version 1.4.0beta68 [July 7, 2009] +version 1.4.0beta68 [July 18, 2009] + Avoid some tests in filter selection in pngwutil.c version 1.4.0betaN [future] Build shared libraries with -lz and sometimes -lm. diff --git a/CHANGES b/CHANGES index d08ef2002..d202d433a 100644 --- a/CHANGES +++ b/CHANGES @@ -2176,7 +2176,8 @@ version 1.4.0beta67 [July 6, 2009] Added high-level API transform PNG_TRANSFORM_GRAY_TO_RGB. Added an "xcode" project to the projects directory (Alam Arias). -version 1.4.0beta68 [July 7, 2009] +version 1.4.0beta68 [July 18, 2009] + Avoid some tests in filter selection in pngwutil.c version 1.4.0betaN [future] Build shared libraries with -lz and sometimes -lm. diff --git a/pngwutil.c b/pngwutil.c index 599a3ee7e..b71f5b9a7 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.4.0 [July 7, 2009] + * Last changed in libpng 1.4.0 [July 18, 2009] * Copyright (c) 1998-2009 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.) @@ -2130,7 +2130,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) png_uint_32 row_bytes = row_info->rowbytes; #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) int num_p_filters = (int)png_ptr->num_prev_filters; -#endif +#else + if (png_ptr->row_number == 0) + { + /* These will never be selected so we need not test them. */ + filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH); + } +#endif png_debug(1, "in png_write_find_filter"); /* Find out how many bytes offset each pixel is */