From 104c2825ea66d7d5f405cc8d690d90b45e752c46 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 21 Mar 2008 09:11:48 +0000 Subject: [PATCH] [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. --- src/cairo-png.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cairo-png.c b/src/cairo-png.c index 6b2ab8589..f87ba2ce2 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));