eog r4346 - in trunk: . src



Author: friemann
Date: Fri Feb  8 19:29:54 2008
New Revision: 4346
URL: http://svn.gnome.org/viewvc/eog?rev=4346&view=rev

Log:
2008-02-08  Felix Riemann  <friemann svn gnome org>

	* src/eog-image.c: (eog_image_apply_display_profile): Skip ICC
	correction for non-RGB input colorspaces. There appears to be
	currently no sane way for us to determine the parameters needed here.
	This fixes crashes when opening such images with an ICC profile
	loaded. Also make sure that the transformation was actually created
	before executing it. Fixes bug #512626.


Modified:
   trunk/ChangeLog
   trunk/src/eog-image.c

Modified: trunk/src/eog-image.c
==============================================================================
--- trunk/src/eog-image.c	(original)
+++ trunk/src/eog-image.c	Fri Feb  8 19:29:54 2008
@@ -616,6 +616,13 @@
 
 	if (screen == NULL || priv->profile == NULL) return;
 
+	/* TODO: support other colorspaces than RGB */
+	if (cmsGetColorSpace (priv->profile) != icSigRgbData ||
+	    cmsGetColorSpace (screen) != icSigRgbData) {
+		eog_debug_message (DEBUG_LCMS, "One or both ICC profiles not in RGB colorspace; not correcting");
+		return;
+	}
+
 	transform = cmsCreateTransform (priv->profile, 
 				        TYPE_RGB_8, 
 				        screen, 
@@ -623,17 +630,18 @@
 				        INTENT_PERCEPTUAL, 
 				        0);
 	
-	rows = gdk_pixbuf_get_height(priv->image);
-	width = gdk_pixbuf_get_width (priv->image);
-	stride = gdk_pixbuf_get_rowstride (priv->image);
-	p = gdk_pixbuf_get_pixels (priv->image);
-
-	for (row = 0; row < rows; ++row) {
-		cmsDoTransform(transform, p, p, width);
-		p += stride;
+	if (G_LIKELY (transform != NULL)) {
+		rows = gdk_pixbuf_get_height (priv->image);
+		width = gdk_pixbuf_get_width (priv->image);
+		stride = gdk_pixbuf_get_rowstride (priv->image);
+		p = gdk_pixbuf_get_pixels (priv->image);
+
+		for (row = 0; row < rows; ++row) {
+			cmsDoTransform (transform, p, p, width);
+			p += stride;
+		}
+		cmsDeleteTransform (transform);
 	}
-
-	cmsDeleteTransform (transform);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]