summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-09-26 10:24:01 +0200
committerStefano Karapetsas <[email protected]>2013-09-26 10:24:01 +0200
commit94214db85381f246290cfebb61de02aea2a441b3 (patch)
tree8f6871f7bfc8fcc2f5bf0334c37e6982ba24c3aa
parent144066a7196fb19e1cb976d7ff7bdee353818fd5 (diff)
downloadeom-94214db85381f246290cfebb61de02aea2a441b3.tar.bz2
eom-94214db85381f246290cfebb61de02aea2a441b3.tar.xz
Migration to lcms2
Closes #25 https://github.com/mate-desktop/mate-image-viewer/issues/25 See https://git.gnome.org/browse/eog/commit/?id=3c3a835
-rw-r--r--configure.ac4
-rw-r--r--src/eom-image.c6
-rw-r--r--src/eom-image.h2
-rw-r--r--src/eom-metadata-reader-jpg.c8
-rw-r--r--src/eom-metadata-reader-png.c8
-rw-r--r--src/eom-metadata-reader.h2
-rw-r--r--src/eom-window.c11
7 files changed, 14 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac
index b88105a..7857154 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,11 +150,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.])
- EOM_MODULES="$EOM_MODULES lcms"
+ EOM_MODULES="$EOM_MODULES lcms2"
fi
AM_CONDITIONAL([HAVE_LCMS], [test "x$have_lcms" = "xyes"])
diff --git a/src/eom-image.c b/src/eom-image.c
index e3f1c23..989f365 100644
--- a/src/eom-image.c
+++ b/src/eom-image.c
@@ -58,7 +58,7 @@
#endif
#ifdef HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
#ifndef EXIF_TAG_GAMMA
#define EXIF_TAG_GAMMA 0xa500
#endif
@@ -681,8 +681,8 @@ eom_image_apply_display_profile (EomImage *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) {
eom_debug_message (DEBUG_LCMS, "One or both ICC profiles not in RGB colorspace; not correcting");
return;
}
diff --git a/src/eom-image.h b/src/eom-image.h
index 0640762..5e3fe84 100644
--- a/src/eom-image.h
+++ b/src/eom-image.h
@@ -37,7 +37,7 @@
#endif
#ifdef HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
#endif
#ifdef HAVE_EXEMPI
diff --git a/src/eom-metadata-reader-jpg.c b/src/eom-metadata-reader-jpg.c
index 5d6a79c..9fc79b7 100644
--- a/src/eom-metadata-reader-jpg.c
+++ b/src/eom-metadata-reader-jpg.c
@@ -513,8 +513,6 @@ eom_metadata_reader_jpg_get_icc_profile (EomMetadataReaderJpg *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 @@ eom_metadata_reader_jpg_get_icc_profile (EomMetadataReaderJpg *emr)
{
cmsCIExyY whitepoint;
cmsCIExyYTRIPLE primaries;
- LPGAMMATABLE gamma[3];
+ cmsToneCurve *gamma[3];
double gammaValue;
ExifRational r;
@@ -619,11 +617,11 @@ eom_metadata_reader_jpg_get_icc_profile (EomMetadataReaderJpg *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]);
eom_debug_message (DEBUG_LCMS, "JPEG is calibrated");
diff --git a/src/eom-metadata-reader-png.c b/src/eom-metadata-reader-png.c
index 242e52a..c475e06 100644
--- a/src/eom-metadata-reader-png.c
+++ b/src/eom-metadata-reader-png.c
@@ -563,8 +563,6 @@ eom_metadata_reader_png_get_icc_profile (EomMetadataReaderPng *emr)
return NULL;
}
- cmsErrorAction (LCMS_ERROR_SHOW);
-
profile = cmsOpenProfileFromMem(outbuf, zstr.total_out);
inflateEnd (&zstr);
g_free (outbuf);
@@ -583,7 +581,7 @@ eom_metadata_reader_png_get_icc_profile (EomMetadataReaderPng *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 @@ eom_metadata_reader_png_get_icc_profile (EomMetadataReaderPng *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/eom-metadata-reader.h b/src/eom-metadata-reader.h
index 5d719a1..ce5dc0c 100644
--- a/src/eom-metadata-reader.h
+++ b/src/eom-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/eom-window.c b/src/eom-window.c
index 1c67eff..3ba7259 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -72,7 +72,7 @@
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
-#include <lcms.h>
+#include <lcms2.h>
#endif
#define EOM_WINDOW_GET_PRIVATE(object) \
@@ -652,17 +652,8 @@ eom_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 EOM 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)) {
eom_debug_message (DEBUG_LCMS,
"Invalid display profile, "