changeset 2107:dea49df746fc

Merge commit 'refs/merge-requests/2' of git://gitorious.org/geeqie/geeqie into merge-requests/2
author Vladimir Nadvornik <nadvornik@suse.cz>
date Tue, 21 Aug 2012 19:25:58 +0200
parents 5d1448be37ec (current diff) b141d52944ab (diff)
children 2fcf3c151ca8
files
diffstat 4 files changed, 46 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Tue Aug 21 12:47:06 2012 +0200
+++ b/configure.in	Tue Aug 21 19:25:58 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	Tue Aug 21 12:47:06 2012 +0200
+++ b/src/color-man.c	Tue Aug 21 19:25:58 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;
@@ -441,7 +454,7 @@
 	if (!cm) return FALSE;
 
 	cc = cm->profile;
-	
+
 	if (image_profile) *image_profile = color_man_get_profile_name(cc->profile_in_type, cc->profile_in);
 	if (screen_profile) *screen_profile = color_man_get_profile_name(cc->profile_out_type, cc->profile_out);
 	return TRUE;
--- a/src/exif-common.c	Tue Aug 21 12:47:06 2012 +0200
+++ b/src/exif-common.c	Tue Aug 21 19:25:58 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
 
@@ -125,13 +125,13 @@
 static gboolean remove_suffix(gchar *str, const gchar *suffix, gint suffix_len)
 {
 	gint str_len = strlen(str);
-	
+
 	if (suffix_len < 0) suffix_len = strlen(suffix);
 	if (str_len < suffix_len) return FALSE;
-	
+
 	if (strcmp(str + str_len - suffix_len, suffix) != 0) return FALSE;
 	str[str_len - suffix_len] = '\0';
-	
+
 	return TRUE;
 }
 
@@ -161,7 +161,7 @@
 		gint i, j;
 
 		g_strstrip(software);
-		
+
 		/* remove superfluous spaces (pentax K100D) */
 		for (i = 0, j = 0; software[i]; i++, j++)
 			{
@@ -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);
@@ -646,14 +655,14 @@
 ExifData *exif_read_fd(FileData *fd)
 {
 	gchar *sidecar_path;
-	
+
 	if (!exif_cache) exif_init_cache();
 
 	if (!fd) return NULL;
-	
+
 	if (file_cache_get(exif_cache, fd)) return fd->exif;
 	g_assert(fd->exif == NULL);
-	
+
 	/* CACHE_TYPE_XMP_METADATA file should exist only if the metadata are
 	 * not writable directly, thus it should contain the most up-to-date version */
 	sidecar_path = NULL;
--- a/src/image_load_tiff.c	Tue Aug 21 12:47:06 2012 +0200
+++ b/src/image_load_tiff.c	Tue Aug 21 19:25:58 2012 +0200
@@ -326,7 +326,7 @@
 		/* Turns out that the packing used by TIFFRGBAImage depends on 
         	 * the host byte order... 
 	         */ 
-		while (pixels < pixbuf->pixels + bytes) 
+		while (pixels < lt->pixbuf->pixels + bytes) 
 			{
 			uint32 pixel = *(uint32 *)pixels;
 			int r = TIFFGetR(pixel);
@@ -419,4 +419,4 @@
 
 
 
-#endif
\ No newline at end of file
+#endif