summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@acm.org>2011-11-21 10:28:06 -0600
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2011-11-21 10:28:06 -0600
commit3706d730d1bc131d818332491500a46f6a96d4f3 (patch)
treed13485bea73b6304ba26d169e43ac515f3cb6b6a
parent925a60278e7d25a06ac0410c27d9e3244a5fd8f2 (diff)
downloadlibpng-3706d730d1bc131d818332491500a46f6a96d4f3.tar.gz
[libpng15] Allow row_stride==0 to indicate default stride in simplified API
-rw-r--r--ANNOUNCE6
-rw-r--r--CHANGES3
-rw-r--r--png.h16
-rw-r--r--pngread.c3
-rw-r--r--pngwrite.c4
5 files changed, 24 insertions, 8 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index 82c844d19..7e301b573 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -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
diff --git a/CHANGES b/CHANGES
index 9afea638d..763efcad6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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
diff --git a/png.h b/png.h
index 3086b9640..ccee42061 100644
--- a/png.h
+++ b/png.h
@@ -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
diff --git a/pngread.c b/pngread.c
index e55ec73fa..758383121 100644
--- a/pngread.c
+++ b/pngread.c
@@ -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;
diff --git a/pngwrite.c b/pngwrite.c
index 41cba812b..080217418 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -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,