[libpng15] Allow row_stride==0 to indicate default stride in simplified API

This commit is contained in:
John Bowler 2011-11-21 10:28:06 -06:00 committed by Glenn Randers-Pehrson
parent 925a60278e
commit 3706d730d1
5 changed files with 24 additions and 8 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.7beta05 - November 19, 2011
Libpng 1.5.7beta05 - November 21, 2011
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.
@ -99,10 +99,12 @@ Version 1.5.7beta04 [November 17, 2011]
Also removed a duplicate setting of this flag.
Added files that were omitted from the libpng-1.5.7beta03 zip distribution.
Version 1.5.7beta05 [November 19, 2011]
Version 1.5.7beta05 [November 21, 2011]
Removed "zTXt" from warning in generic chunk decompression function.
Validate time settings passed to pngset() and png_convert_to_rfc1123()
(Frank Busse).
Allow row_stride==0 to indicate default stride in simplified API
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@ -3744,10 +3744,11 @@ Version 1.5.7beta04 [November 17, 2011]
Also removed a duplicate setting of this flag.
Added files that were omitted from the libpng-1.5.7beta03 zip distribution.
Version 1.5.7beta05 [November 19, 2011]
Version 1.5.7beta05 [November 21, 2011]
Removed "zTXt" from warning in generic chunk decompression function.
Validate time settings passed to pngset() and png_convert_to_rfc1123()
(Frank Busse).
Allow row_stride==0 to indicate default stride in simplified API
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

16
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.5.7beta05 - November 18, 2011
* libpng version 1.5.7beta05 - November 21, 2011
* Copyright (c) 1998-2011 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.)
@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.7beta05 - November 18, 2011: Glenn
* libpng versions 0.97, January 1998, through 1.5.7beta05 - November 21, 2011: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -195,7 +195,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 18, 2011, are
* libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 21, 2011, are
* Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -307,7 +307,7 @@
* Y2K compliance in libpng:
* =========================
*
* November 18, 2011
* November 21, 2011
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@ -373,7 +373,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.7beta05"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.7beta05 - November 18, 2011\n"
" libpng version 1.5.7beta05 - November 21, 2011\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@ -2805,6 +2805,12 @@ typedef struct
* stride - the number of components to leave space for in each row.
*/
#define PNG_IMAGE_SIZE(image)\
PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image))
/* Return the size, in bytes, of the image in memory given just a png_image;
* the row stride is the minimum stride required for the image.
*/
/* PNG_IMAGE_FLAG_*
*
* Flags containing additional information about the image are held in the

View File

@ -2423,6 +2423,9 @@ png_image_finish_read(png_imagep image, png_colorp background, void *buffer,
{
png_uint_32 check;
if (row_stride == 0)
row_stride = PNG_IMAGE_ROW_STRIDE(*image);
if (row_stride < 0)
check = -row_stride;

View File

@ -1970,6 +1970,10 @@ png_image_write_main(png_voidp argument)
int alpha = (format & PNG_FORMAT_FLAG_ALPHA) != 0;
int write_16bit = linear && !display->convert_to_8bit;
/* Default the 'row_stride' parameter if required. */
if (display->row_stride == 0)
display->row_stride = PNG_IMAGE_ROW_STRIDE(*image);
/* Set the required transforms then write the rows in the correct order. */
png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
write_16bit ? 16 : 8,