summaryrefslogtreecommitdiffstats
path: root/filters
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2012-04-28 12:45:46 -0500
committerDarrell Anderson <humanreadable@yahoo.com>2012-04-28 12:45:46 -0500
commit1525b472083af4ef1f7638f6c0284f805e9dc8c7 (patch)
treeb4eaefb76987caebe8020b50db72a83de8e6d17b /filters
parent72a80f68f0985e0fc27b35dc86bbdf0c4b7daa72 (diff)
downloadkoffice-1525b472083af4ef1f7638f6c0284f805e9dc8c7.tar.gz
koffice-1525b472083af4ef1f7638f6c0284f805e9dc8c7.zip
Libpng 1.5 fixes.
Thanks to Francois Andriot.
Diffstat (limited to 'filters')
-rw-r--r--filters/chalk/png/kis_png_converter.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/filters/chalk/png/kis_png_converter.cc b/filters/chalk/png/kis_png_converter.cc
index 87b46029..75a5c697 100644
--- a/filters/chalk/png/kis_png_converter.cc
+++ b/filters/chalk/png/kis_png_converter.cc
@@ -43,6 +43,8 @@
#include <kis_paint_layer.h>
#include <kis_group_layer.h>
+#include <zlib.h>
+
namespace {
const TQ_UINT8 PIXEL_BLUE = 0;
@@ -222,6 +224,9 @@ KisImageBuilder_Result KisPNGConverter::decode(const KURL& uri)
// Read image profile
png_charp profile_name, profile_data;
+#if PNG_LIBPNG_VER_MAJOR > 1 || ( PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 5 )
+ unsigned char* uprofile_data = reinterpret_cast<unsigned char*>(profile_data);
+#endif
int compression_type;
png_uint_32 proflen;
int number_of_passes = 1;
@@ -230,7 +235,11 @@ KisImageBuilder_Result KisPNGConverter::decode(const KURL& uri)
number_of_passes = png_set_interlace_handling(png_ptr);
KisProfile* profile = 0;
+#if PNG_LIBPNG_VER_MAJOR > 1 || ( PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 5 )
+ if(png_get_iCCP(png_ptr, info_ptr, &profile_name, &compression_type, &uprofile_data, &proflen))
+#else
if(png_get_iCCP(png_ptr, info_ptr, &profile_name, &compression_type, &profile_data, &proflen))
+#endif
{
TQByteArray profile_rawdata;
// XXX: Hardcoded for icc type -- is that correct for us?
@@ -627,7 +636,11 @@ KisImageBuilder_Result KisPNGConverter::buildFile(const KURL& uri, KisPaintLayer
} else { // Profile
char* name = new char[(*it)->type().length()+1];
strcpy(name, (*it)->type().ascii());
+#if PNG_LIBPNG_VER_MAJOR > 1 || ( PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 5 )
+ png_set_iCCP(png_ptr, info_ptr, name, PNG_COMPRESSION_TYPE_BASE, (unsigned char*)(*it)->annotation().data(), (*it) -> annotation() . size());
+#else
png_set_iCCP(png_ptr, info_ptr, name, PNG_COMPRESSION_TYPE_BASE, (char*)(*it)->annotation().data(), (*it) -> annotation() . size());
+#endif
}
++it;
}