From ce22f23553bd8c77cfe649fe07ddc49905e79041 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Sun, 6 May 2012 16:32:18 -0500 Subject: Fix building with libpng 1.5. Thanks to David C. Rankin and /dev/ammo42. --- kipi-plugins/rawconverter/rawdecodingiface.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/kipi-plugins/rawconverter/rawdecodingiface.cpp b/kipi-plugins/rawconverter/rawdecodingiface.cpp index c2653ee..3c67d38 100644 --- a/kipi-plugins/rawconverter/rawdecodingiface.cpp +++ b/kipi-plugins/rawconverter/rawdecodingiface.cpp @@ -68,6 +68,12 @@ extern "C" namespace KIPIRawConverterPlugin { +#if PNG_LIBPNG_VER_MAJOR > 1 || ( PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 5 ) + typedef png_bytep iCCP_data; +#else + typedef png_charp iCCP_data; +#endif + RawDecodingIface::RawDecodingIface() : KDcrawIface::KDcraw() { @@ -249,7 +255,7 @@ bool RawDecodingIface::loadedFromDcraw(const TQString& filePath, jpeg_set_quality(&cinfo, 99, true); jpeg_start_compress(&cinfo, true); - // Write ICC color profil. + // Write ICC color profile. if (!ICCColorProfile.isEmpty()) write_icc_profile (&cinfo, (JOCTET *)ICCColorProfile.data(), ICCColorProfile.size()); @@ -295,11 +301,16 @@ bool RawDecodingIface::loadedFromDcraw(const TQString& filePath, png_set_sBIT(png_ptr, info_ptr, &sig_bit); png_set_compression_level(png_ptr, 9); - // Write ICC profil. + // Write ICC profile. if (!ICCColorProfile.isEmpty()) { +#if PNG_LIBPNG_VER_MAJOR > 1 || ( PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 5 ) + png_set_iCCP(png_ptr, info_ptr, ("icc"), PNG_COMPRESSION_TYPE_BASE, + reinterpret_cast(ICCColorProfile.data()), ICCColorProfile.size()); +#else png_set_iCCP(png_ptr, info_ptr, "icc", PNG_COMPRESSION_TYPE_BASE, ICCColorProfile.data(), ICCColorProfile.size()); +#endif } TQString libpngver(PNG_HEADER_VERSION_STRING); -- cgit v1.2.1