[eog] Switch to lcms2 for color management
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Switch to lcms2 for color management
- Date: Wed, 27 Apr 2011 19:53:25 +0000 (UTC)
commit 3c3a83506256ade465bd817453202296b1cda618
Author: Felix Riemann <friemann gnome org>
Date: Sun Sep 12 21:18:03 2010 +0200
Switch to lcms2 for color management
Version 2 is listed as "official" external dependency for GNOME and is
said to be faster in some cases.
configure.ac | 4 ++--
src/eog-image.c | 6 +++---
src/eog-image.h | 2 +-
src/eog-metadata-reader-jpg.c | 8 +++-----
src/eog-metadata-reader-png.c | 8 +++-----
src/eog-metadata-reader.h | 2 +-
src/eog-window.c | 12 +-----------
7 files changed, 14 insertions(+), 28 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d5a096c..1038ee6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,11 +162,11 @@ AM_CONDITIONAL([HAVE_EXIF], [test "x$have_exif" = "xyes"])
AC_ARG_WITH([cms], AC_HELP_STRING([--without-cms], [disable colour management support]))
have_lcms=no
if test x$with_cms != xno; then
- PKG_CHECK_MODULES(LCMS, lcms, have_lcms=yes, have_lcms=no)
+ PKG_CHECK_MODULES(LCMS, lcms2, have_lcms=yes, have_lcms=no)
fi
if test "x$have_lcms" = "xyes"; then
AC_DEFINE(HAVE_LCMS, 1, [Little CMS Support.])
- EOG_MODULES="$EOG_MODULES lcms"
+ EOG_MODULES="$EOG_MODULES lcms2"
fi
AM_CONDITIONAL([HAVE_LCMS], [test "x$have_lcms" = "xyes"])
diff --git a/src/eog-image.c b/src/eog-image.c
index a4e1bb9..de5b105 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -59,7 +59,7 @@
#endif
#ifdef HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
#ifndef EXIF_TAG_GAMMA
#define EXIF_TAG_GAMMA 0xa500
#endif
@@ -683,8 +683,8 @@ eog_image_apply_display_profile (EogImage *img, cmsHPROFILE screen)
if (screen == NULL || priv->profile == NULL) return;
/* TODO: support other colorspaces than RGB */
- if (cmsGetColorSpace (priv->profile) != icSigRgbData ||
- cmsGetColorSpace (screen) != icSigRgbData) {
+ if (cmsGetColorSpace (priv->profile) != cmsSigRgbData ||
+ cmsGetColorSpace (screen) != cmsSigRgbData) {
eog_debug_message (DEBUG_LCMS, "One or both ICC profiles not in RGB colorspace; not correcting");
return;
}
diff --git a/src/eog-image.h b/src/eog-image.h
index 4cfef95..092f2dd 100644
--- a/src/eog-image.h
+++ b/src/eog-image.h
@@ -38,7 +38,7 @@
#endif
#ifdef HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
#endif
#ifdef HAVE_EXEMPI
diff --git a/src/eog-metadata-reader-jpg.c b/src/eog-metadata-reader-jpg.c
index 7df3a56..9598f67 100644
--- a/src/eog-metadata-reader-jpg.c
+++ b/src/eog-metadata-reader-jpg.c
@@ -513,8 +513,6 @@ eog_metadata_reader_jpg_get_icc_profile (EogMetadataReaderJpg *emr)
priv = emr->priv;
if (priv->icc_chunk) {
- cmsErrorAction (LCMS_ERROR_SHOW);
-
profile = cmsOpenProfileFromMem(priv->icc_chunk + 14, priv->icc_len - 14);
if (profile) {
@@ -562,7 +560,7 @@ eog_metadata_reader_jpg_get_icc_profile (EogMetadataReaderJpg *emr)
{
cmsCIExyY whitepoint;
cmsCIExyYTRIPLE primaries;
- LPGAMMATABLE gamma[3];
+ cmsToneCurve *gamma[3];
double gammaValue;
ExifRational r;
@@ -619,11 +617,11 @@ eog_metadata_reader_jpg_get_icc_profile (EogMetadataReaderJpg *emr)
gammaValue = 2.2;
}
- gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma (256, gammaValue);
+ gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma (NULL, gammaValue);
profile = cmsCreateRGBProfile (&whitepoint, &primaries, gamma);
- cmsFreeGamma(gamma[0]);
+ cmsFreeToneCurve(gamma[0]);
eog_debug_message (DEBUG_LCMS, "JPEG is calibrated");
diff --git a/src/eog-metadata-reader-png.c b/src/eog-metadata-reader-png.c
index 257462f..ec5994d 100644
--- a/src/eog-metadata-reader-png.c
+++ b/src/eog-metadata-reader-png.c
@@ -563,8 +563,6 @@ eog_metadata_reader_png_get_icc_profile (EogMetadataReaderPng *emr)
return NULL;
}
- cmsErrorAction (LCMS_ERROR_SHOW);
-
profile = cmsOpenProfileFromMem(outbuf, zstr.total_out);
inflateEnd (&zstr);
g_free (outbuf);
@@ -583,7 +581,7 @@ eog_metadata_reader_png_get_icc_profile (EogMetadataReaderPng *emr)
if (!profile && priv->cHRM_chunk) {
cmsCIExyY whitepoint;
cmsCIExyYTRIPLE primaries;
- LPGAMMATABLE gamma[3];
+ cmsToneCurve *gamma[3];
double gammaValue = 2.2; // 2.2 should be a sane default gamma
/* This uglyness extracts the chromacity and whitepoint values
@@ -611,11 +609,11 @@ eog_metadata_reader_png_get_icc_profile (EogMetadataReaderPng *emr)
if (priv->gAMA_chunk)
gammaValue = (double) 1.0/EXTRACT_DOUBLE_UINT_BLOCK_OFFSET (priv->gAMA_chunk, 0, 100000);
- gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma (256, gammaValue);
+ gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma (NULL, gammaValue);
profile = cmsCreateRGBProfile (&whitepoint, &primaries, gamma);
- cmsFreeGamma(gamma[0]);
+ cmsFreeToneCurve(gamma[0]);
}
return profile;
diff --git a/src/eog-metadata-reader.h b/src/eog-metadata-reader.h
index 86652be..81e976b 100644
--- a/src/eog-metadata-reader.h
+++ b/src/eog-metadata-reader.h
@@ -30,7 +30,7 @@
#include <exempi/xmp.h>
#endif
#if HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
#endif
G_BEGIN_DECLS
diff --git a/src/eog-window.c b/src/eog-window.c
index 8815fba..d407cd8 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -78,7 +78,7 @@
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
-#include <lcms.h>
+#include <lcms2.h>
#endif
#define EOG_WINDOW_GET_PRIVATE(object) \
@@ -399,7 +399,6 @@ eog_window_get_display_profile (GdkScreen *screen)
int result;
cmsHPROFILE *profile;
char *atom_name;
- int lcms_error_action;
dpy = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
@@ -446,17 +445,8 @@ eog_window_get_display_profile (GdkScreen *screen)
return NULL;
}
- /* Make lcms errors non-fatal here, as it is possible
- * to load invalid profiles with XICC.
- * We don't want lcms to abort EOG in that case.
- */
- lcms_error_action = cmsErrorAction (LCMS_ERROR_IGNORE);
-
profile = cmsOpenProfileFromMem (str, length);
- // Restore the previous error setting
- cmsErrorAction (lcms_error_action);
-
if (G_UNLIKELY (profile == NULL)) {
eog_debug_message (DEBUG_LCMS,
"Invalid display profile, "
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]