From: Michal Čihař Date: Tue, 21 Aug 2012 09:40:19 +0000 (+0200) Subject: Add support for LCMS2 X-Git-Tag: v1.2~99^2~2 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=1548a68d26046b6aa467e56ca2c8f5444b95a23b Add support for LCMS2 Both LCMS1 and LCMS2 are supported. --- diff --git a/configure.in b/configure.in index e4512f27..59f88a12 100644 --- a/configure.in +++ b/configure.in @@ -290,14 +290,22 @@ AC_ARG_ENABLE([lcms], [liblcms=$enableval], [liblcms=auto]) if test "x${liblcms}" != "xno"; then - PKG_CHECK_MODULES(LCMS, [lcms >= 1.14], + PKG_CHECK_MODULES(LCMS, [lcms2 >= 2.0], [ HAVE_LCMS=yes AC_DEFINE(HAVE_LCMS, 1, [define to enable use of color profiles with lcms]) + AC_DEFINE(HAVE_LCMS2, 1, [lcms2 is used]) ], [ - HAVE_LCMS=no - AC_MSG_WARN([$LCMS_PKG_ERRORS]) + PKG_CHECK_MODULES(LCMS, [lcms >= 1.14], + [ + HAVE_LCMS=yes + AC_DEFINE(HAVE_LCMS, 1, [define to enable use of color profiles with lcms]) + ], + [ + HAVE_LCMS=no + AC_MSG_WARN([$LCMS_PKG_ERRORS]) + ]) ]) else HAVE_LCMS=disabled diff --git a/src/color-man.c b/src/color-man.c index be37a2aa..1a7118c1 100644 --- a/src/color-man.c +++ b/src/color-man.c @@ -21,7 +21,11 @@ #ifdef HAVE_LCMS /*** color support enabled ***/ +#ifdef HAVE_LCMS2 +#include +#else #include +#endif typedef struct _ColorManCache ColorManCache; @@ -52,7 +56,9 @@ static void color_man_lib_init(void) if (init_done) return; init_done = TRUE; +#ifndef HAVE_LCMS2 cmsErrorAction(LCMS_ERROR_IGNORE); +#endif } static cmsHPROFILE color_man_create_adobe_comp(void) @@ -425,7 +431,14 @@ static gchar *color_man_get_profile_name(ColorManProfileType type, cmsHPROFILE p case COLOR_PROFILE_FILE: if (profile) { +#ifdef HAVE_LCMS2 + cmsUInt8Number profileID[17]; + profileID[16] = '\0'; + cmsGetHeaderProfileID(profile, profileID); + return g_strdup(profileID); +#else return g_strdup(cmsTakeProductName(profile)); +#endif } return g_strdup(_("Custom profile")); break; diff --git a/src/exif-common.c b/src/exif-common.c index 3b453a74..99d38be0 100644 --- a/src/exif-common.c +++ b/src/exif-common.c @@ -23,10 +23,10 @@ #ifdef HAVE_LCMS /*** color support enabled ***/ -#ifdef HAVE_LCMS_LCMS_H - #include +#ifdef HAVE_LCMS2 +#include #else - #include +#include #endif #endif @@ -413,6 +413,9 @@ static gchar *exif_build_formatted_Resolution(ExifData *exif) static gchar *exif_build_formatted_ColorProfile(ExifData *exif) { +#ifdef HAVE_LCMS2 + cmsUInt8Number profileID[17]; +#endif const gchar *name = ""; const gchar *source = ""; guchar *profile_data; @@ -452,7 +455,13 @@ static gchar *exif_build_formatted_ColorProfile(ExifData *exif) profile = cmsOpenProfileFromMem(profile_data, profile_len); if (profile) { +#ifdef HAVE_LCMS2 + profileID[16] = '\0'; + cmsGetHeaderProfileID(profile, profileID); + name = profileID; +#else name = cmsTakeProductName(profile); +#endif cmsCloseProfile(profile); } g_free(profile_data);