Skip to content

Commit

Permalink
Add support for LCMS2
Browse files Browse the repository at this point in the history
Both LCMS1 and LCMS2 are supported.
  • Loading branch information
nijel committed Aug 21, 2012
1 parent 2b091f5 commit 1548a68
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
14 changes: 11 additions & 3 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/color-man.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 12 additions & 3 deletions src/exif-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1548a68

Please sign in to comment.