diff src/color-man.c @ 115:53b2bfdcff69

Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net> * color-man.[ch]: Allow color manager to work with GdkPixbufs not linked to an ImageWindow. Fix missing embedded dummy function when compiling without color profile support. * image.c: When embedded color profiles is enabled and EXIF ColorSpace is set to 1 use sRGB color profile for the image. Also fixed order of starting the image read-ahead when color profiles are in use. * typedefs.h (ImageWindow): Use gpointer definition correctly so that cm is a pointer and not a pointer to a pointer. * utilops.c: Pass 0 to vertical fill arg of gtk_table_attach() instead of FALSE.
author gqview
date Tue, 28 Nov 2006 17:06:47 +0000
parents 50fc73e08550
children f6e307c7bad6
line wrap: on
line diff
--- a/src/color-man.c	Mon Nov 27 06:37:48 2006 +0000
+++ b/src/color-man.c	Tue Nov 28 17:06:47 2006 +0000
@@ -302,7 +302,7 @@
 		cmsDoTransform(cc->transform, pbuf, pbuf, w);
 		}
 
-	image_area_changed(cm->imd, x, y, w, h);
+	if (cm->incremental_sync && cm->imd) image_area_changed(cm->imd, x, y, w, h);
 }
 
 static gint color_man_idle_cb(gpointer data)
@@ -311,7 +311,8 @@
 	gint width, height;
 	gint rh;
 
-	if (cm->pixbuf != image_get_pixbuf(cm->imd))
+	if (cm->imd &&
+	    cm->pixbuf != image_get_pixbuf(cm->imd))
 		{
 		cm->idle_id = -1;
 		color_man_done(cm, COLOR_RETURN_IMAGE_CHANGED);
@@ -323,6 +324,11 @@
 
 	if (cm->row > height)
 		{
+		if (!cm->incremental_sync && cm->imd)
+			{
+			image_area_changed(cm->imd, 0, 0, width, height);
+			}
+
 		cm->idle_id = -1;
 		color_man_done(cm, COLOR_RETURN_SUCCESS);
 		return FALSE;
@@ -335,24 +341,24 @@
 	return TRUE;
 }
 
-static ColorMan *color_man_new_real(ImageWindow *imd,
+static ColorMan *color_man_new_real(ImageWindow *imd, GdkPixbuf *pixbuf,
 				    ColorManProfileType input_type, const gchar *input_file,
 				    unsigned char *input_data, guint input_data_len,
 				    ColorManProfileType screen_type, const gchar *screen_file,
 				    ColorManDoneFunc done_func, gpointer done_data)
 {
 	ColorMan *cm;
-	GdkPixbuf *pixbuf;
 	gint has_alpha;
 
-	if (!imd) return NULL;
-
-	pixbuf = image_get_pixbuf(imd);
+	if (imd) pixbuf = image_get_pixbuf(imd);
 	if (!pixbuf) return NULL;
 
 	cm = g_new0(ColorMan, 1);
 	cm->imd = imd;
 	cm->pixbuf = pixbuf;
+	g_object_ref(cm->pixbuf);
+
+	cm->incremental_sync = FALSE;
 	cm->row = 0;
 	cm->idle_id = -1;
 
@@ -373,23 +379,23 @@
 	return cm;
 }
 
-ColorMan *color_man_new(ImageWindow *imd,
+ColorMan *color_man_new(ImageWindow *imd, GdkPixbuf *pixbuf,
 			ColorManProfileType input_type, const gchar *input_file,
 			ColorManProfileType screen_type, const gchar *screen_file,
 			ColorManDoneFunc done_func, gpointer done_data)
 {
-	return color_man_new_real(imd,
+	return color_man_new_real(imd, pixbuf,
 				  input_type, input_file, NULL, 0,
 				  screen_type, screen_file,
 				  done_func, done_data);
 }
 
-ColorMan *color_man_new_embedded(ImageWindow *imd,
+ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf,
 				 unsigned char *input_data, guint input_data_len,
 				 ColorManProfileType screen_type, const gchar *screen_file,
 				 ColorManDoneFunc done_func, gpointer done_data)
 {
-	return color_man_new_real(imd,
+	return color_man_new_real(imd, pixbuf,
 				  COLOR_PROFILE_MEM, NULL, input_data, input_data_len,
 				  screen_type, screen_file,
 				  done_func, done_data);
@@ -400,6 +406,7 @@
 	if (!cm) return;
 
 	if (cm->idle_id != -1) g_source_remove(cm->idle_id);
+	if (cm->pixbuf) g_object_unref(cm->pixbuf);
 
 	color_man_cache_unref(cm->profile);
 
@@ -415,7 +422,7 @@
 /*** color support not enabled ***/
 
 
-ColorMan *color_man_new(ImageWindow *imd,
+ColorMan *color_man_new(ImageWindow *imd, GdkPixbuf *pixbuf,
 			ColorManProfileType input_type, const gchar *input_file,
 			ColorManProfileType screen_type, const gchar *screen_file,
 			ColorManDoneFunc don_func, gpointer done_data)
@@ -424,6 +431,15 @@
 	return NULL;
 }
 
+ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf,
+				 unsigned char *input_data, guint input_data_len,
+				 ColorManProfileType screen_type, const gchar *screen_file,
+				 ColorManDoneFunc done_func, gpointer done_data)
+{
+	/* no op */
+	return NULL;
+}
+
 void color_man_free(ColorMan *cm)
 {
 	/* no op */