[vtk-developers] VTK with system libpng >= 1.4
Chuck Atkins
chuck.atkins at kitware.com
Wed Apr 21 17:30:54 EDT 2010
It looks like when building VTK against the system libpng >= 1.4, it's still
trying to use the old 1.3 API for png_set_gray_1_2_4_to_8.
I propose the following patch deal with this accordingly. Comments,
criticisms?
- Chuck
>From 110f26909454b8b51672fb246b992e93cd723276 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins at kitware.com>
Date: Wed, 21 Apr 2010 13:59:49 -0400
Subject: [PATCH] ENH: Accommodate libpng API change from 1.3 -> 1.4
A macro was added to replace calls to png_set_gray_1_2_4_to_8 with calls to
png_set_expand_gray_1_2_4_to_8 as per the API change in libpng 1.3 -> libpng
1.4. The macro preserves backwards compatibility with 1.3 and should only
take effect when using the system libpng instead of the included libpng.
---
IO/vtkPNGReader.cxx | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/IO/vtkPNGReader.cxx b/IO/vtkPNGReader.cxx
index 9ef592c..465b007 100644
--- a/IO/vtkPNGReader.cxx
+++ b/IO/vtkPNGReader.cxx
@@ -20,6 +20,15 @@
#include "vtkPointData.h"
#include "vtk_png.h"
+// If the system libpng is newer than 1.3 then adjust the set_gray call
+// to conform to the new API
+#if !defined(png_set_gray_1_2_4_to_8) && \
+ defined(PNG_LIBPNG_VER_MAJOR) && defined(PNG_LIBPNG_VER_MINOR) && \
+ (PNG_LIBPNG_VER_MAJOR > 1 || \
+ (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4))
+#define png_set_gray_1_2_4_to_8 png_set_expand_gray_1_2_4_to_8
+#endif
+
vtkCxxRevisionMacro(vtkPNGReader, "1.27");
vtkStandardNewMacro(vtkPNGReader);
--
1.7.0.5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100421/42fbd743/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ENH-Accommodate-libpng-API-change-from-1.3-1.4.patch
Type: text/x-patch
Size: 1318 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100421/42fbd743/attachment-0001.bin>
More information about the vtk-developers
mailing list