[cairo] Deprecated libpng function

Peter Weilbacher mozilla at Weilbacher.org
Tue Dec 5 22:47:08 PST 2006


When I tried to link cairo against libpng 1.2.12 on OS/2 I had problems 
because this libpng version no longer exports the
    png_set_gray_1_2_4_to_8()
function as it is deprecated. The attached patch should work around that 
by only using that function when compiling against an older libpng.

I would like confirmation that this is the correct way to do it, before 
pushing...

    Peter.
-------------- next part --------------
From ee55c4856a1dadde42604bb70e2950626dbcf3b2 Mon Sep 17 00:00:00 2001
From: Peter Weilbacher <mozilla at Weilbacher.org>
Date: Wed, 6 Dec 2006 07:33:26 +0100
Subject: [PATCH] Work around deprecated libpng call

---
 src/cairo-png.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/cairo-png.c b/src/cairo-png.c
index 3b33b54..a8a06ac 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -373,7 +373,11 @@ read_png (png_rw_ptr	read_func,
 
     /* expand gray bit depth if needed */
     if (color_type == PNG_COLOR_TYPE_GRAY && depth < 8)
+#if PNG_LIBPNG_VER >= 10209
+        png_set_expand_gray_1_2_4_to_8 (png);
+#else
         png_set_gray_1_2_4_to_8 (png);
+#endif
     /* transform transparency to alpha */
     if (png_get_valid(png, info, PNG_INFO_tRNS))
         png_set_tRNS_to_alpha (png);
-- 
1.4.3.5



More information about the cairo mailing list