Mercurial > hg > forks > geeqie
changeset 2100:b2d8adb561e3
Add support for LCMS2
Both LCMS1 and LCMS2 are supported.
author | Michal Čihař <mcihar@suse.cz> |
---|---|
date | Tue, 21 Aug 2012 11:40:19 +0200 |
parents | cd445a64205f |
children | 40bcef39af3d |
files | configure.in src/color-man.c src/exif-common.c |
diffstat | 3 files changed, 36 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Mon Aug 20 22:42:33 2012 +0200 +++ b/configure.in Tue Aug 21 11:40:19 2012 +0200 @@ -290,14 +290,22 @@ [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
--- a/src/color-man.c Mon Aug 20 22:42:33 2012 +0200 +++ b/src/color-man.c Tue Aug 21 11:40:19 2012 +0200 @@ -21,7 +21,11 @@ #ifdef HAVE_LCMS /*** color support enabled ***/ +#ifdef HAVE_LCMS2 +#include <lcms2.h> +#else #include <lcms.h> +#endif typedef struct _ColorManCache ColorManCache; @@ -52,7 +56,9 @@ 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 @@ 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;
--- a/src/exif-common.c Mon Aug 20 22:42:33 2012 +0200 +++ b/src/exif-common.c Tue Aug 21 11:40:19 2012 +0200 @@ -23,10 +23,10 @@ #ifdef HAVE_LCMS /*** color support enabled ***/ -#ifdef HAVE_LCMS_LCMS_H - #include <lcms/lcms.h> +#ifdef HAVE_LCMS2 +#include <lcms2.h> #else - #include <lcms.h> +#include <lcms.h> #endif #endif @@ -413,6 +413,9 @@ 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 @@ 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);