[cairo-commit] src/cairo-png.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Mar 21 02:20:51 PDT 2008


 src/cairo-png.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 104c2825ea66d7d5f405cc8d690d90b45e752c46
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Mar 21 09:11:48 2008 +0000

    [cairo-png] Set bKGD gray value.
    
    For PNG_COLOR_TYPE_GRAY images the bKGD value is read from white.gray
    which was uninitialized, triggering the "PNG warning = Ignoring attempt
    to write bKGD chunk out-of-range for bit_depth" reported by Emmanuel
    Pacaud. This patch sets the background gray value to white, the same as
    for RGB images.

diff --git a/src/cairo-png.c b/src/cairo-png.c
index 6b2ab85..f87ba2c 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -211,9 +211,8 @@ write_png (cairo_surface_t	*surface,
 		  PNG_COMPRESSION_TYPE_DEFAULT,
 		  PNG_FILTER_TYPE_DEFAULT);
 
-    white.red = 0xff;
-    white.blue = 0xff;
-    white.green = 0xff;
+    white.gray = (1 << depth) - 1;
+    white.red = white.blue = white.green = white.gray;
     png_set_bKGD (png, info, &white);
 
     png_convert_from_time_t (&pt, time (NULL));


More information about the cairo-commit mailing list