Clarified usage of sig_bit as struct vs sig_bit_p as pointer in example.c
sig_bit was not declared in write_png() and was used differently from sig_bit in read_png(), as reported by Vincent Torri. This update changes sig_bit to sig_bit_p in read_png() and declares sig_bit in write_png().
This commit is contained in:
parent
549a5101e7
commit
e38b432846
7
ANNOUNCE
7
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.2.37beta01 - May 12, 2009
|
||||
Libpng 1.2.37beta01 - May 13, 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.
|
||||
@ -43,10 +43,13 @@ Other information:
|
||||
|
||||
Changes since the last public release (1.2.36):
|
||||
|
||||
version 1.2.37beta01 [May 12, 2009]
|
||||
version 1.2.37beta01 [May 13, 2009]
|
||||
Fixed inconsistency in pngrutil.c, introduced in libpng-1.2.36. The
|
||||
memset() was using "png_ptr->rowbytes" instead of "row_bytes", which
|
||||
the corresponding png_malloc() uses (Joe Drew).
|
||||
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
|
||||
Updated some of the makefiles in the scripts directory (merged with
|
||||
those in libpng-1.4.0beta57).
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
|
||||
|
5
CHANGES
5
CHANGES
@ -2368,10 +2368,13 @@ version 1.2.36rc01 [April 30, 2009]
|
||||
version 1.0.44 and 1.2.36 [May 7, 2009]
|
||||
No changes.
|
||||
|
||||
version 1.2.37beta01 [May 12, 2009]
|
||||
version 1.2.37beta01 [May 13, 2009]
|
||||
Fixed inconsistency in pngrutil.c, introduced in libpng-1.2.36. The
|
||||
memset() was using "png_ptr->rowbytes" instead of "row_bytes", which
|
||||
the corresponding png_malloc() uses (Joe Drew).
|
||||
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
|
||||
Updated some of the makefiles in the scripts directory (merged with
|
||||
those in libpng-1.4.0beta57).
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
11
example.c
11
example.c
@ -2,7 +2,7 @@
|
||||
#if 0 /* in case someone actually tries to compile this */
|
||||
|
||||
/* example.c - an example of using libpng
|
||||
* Last changed in libpng 1.2.36 [May 7, 2009]
|
||||
* Last changed in libpng 1.2.37 [May 13, 2009]
|
||||
* This file has been placed in the public domain by the authors.
|
||||
* Maintained 1998-2009 Glenn Randers-Pehrson
|
||||
* Maintained 1996, 1997 Andreas Dilger)
|
||||
@ -306,10 +306,10 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||
*/
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
||||
{
|
||||
png_color_8p sig_bit;
|
||||
png_color_8p sig_bit_p;
|
||||
|
||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
png_set_shift(png_ptr, sig_bit);
|
||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
|
||||
png_set_shift(png_ptr, sig_bit_p);
|
||||
}
|
||||
|
||||
/* flip the RGB pixels to BGR (or RGBA to BGRA) */
|
||||
@ -647,6 +647,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
the png structure. */
|
||||
|
||||
/* optional significant bit chunk */
|
||||
png_color_8 sig_bit;
|
||||
/* if we are dealing with a grayscale image then */
|
||||
sig_bit.gray = true_bit_depth;
|
||||
/* otherwise, if we are dealing with a color image then */
|
||||
@ -655,7 +656,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
sig_bit.blue = true_blue_bit_depth;
|
||||
/* if the image has an alpha channel then */
|
||||
sig_bit.alpha = true_alpha_bit_depth;
|
||||
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
||||
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
|
||||
|
||||
/* Optional gamma chunk is strongly suggested if you have any guess
|
||||
|
Reference in New Issue
Block a user