Fix #603, 971: lcms2 support broken / images with embedded color profile
[geeqie.git] / src / color-man.c
index 7788c7a..dda2e2c 100644 (file)
@@ -1,16 +1,24 @@
 /*
- * Geeqie
- * (C) 2006 John Ellis
- * Copyright (C) 2008 - 2012 The Geeqie Team
+ * Copyright (C) 2006 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
  *
  * Author: John Ellis
  *
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-
 #include "main.h"
 #include "color-man.h"
 
@@ -180,7 +188,7 @@ static ColorManCache *color_man_cache_new(ColorManProfileType in_type, const gch
                                           (has_alpha) ? TYPE_RGBA_8 : TYPE_RGB_8,
                                           cc->profile_out,
                                           (has_alpha) ? TYPE_RGBA_8 : TYPE_RGB_8,
-                                          INTENT_PERCEPTUAL, 0);
+                                          options->color_profile.render_intent, 0);
 
        if (!cc->transform)
                {
@@ -308,6 +316,13 @@ void color_man_correct_region(ColorMan *cm, GdkPixbuf *pixbuf, gint x, gint y, g
        pix = gdk_pixbuf_get_pixels(pixbuf);
        rs = gdk_pixbuf_get_rowstride(pixbuf);
 
+       /** @FIXME: x,y expected to be = 0. Maybe this is not the right place for scaling */
+       if (!options->image.use_clutter_renderer)
+               {
+               w = w * scale_factor();
+               h = h * scale_factor();
+               }
+
        w = MIN(w, pixbuf_width - x);
        h = MIN(h, pixbuf_height - y);
 
@@ -432,10 +447,11 @@ static gchar *color_man_get_profile_name(ColorManProfileType type, cmsHPROFILE p
                        if (profile)
                                {
 #ifdef HAVE_LCMS2
-                               cmsUInt8Number profileID[17];
-                               profileID[16] = '\0';
-                               cmsGetHeaderProfileID(profile, profileID);
-                               return g_strdup((gchar *) profileID);
+                               char buffer[20];
+                               buffer[0] = '\0';
+                               cmsGetProfileInfoASCII(profile, cmsInfoDescription, "en", "US", buffer, 20);
+                               buffer[19] = '\0'; /* Just to be sure */
+                               return g_strdup(buffer);
 #else
                                return g_strdup(cmsTakeProductName(profile));
 #endif