Mercurial > geeqie
changeset 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 | 1bd40943dc2a |
files | ChangeLog TODO src/color-man.c src/color-man.h src/image.c src/typedefs.h src/utilops.c |
diffstat | 7 files changed, 78 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Nov 27 06:37:48 2006 +0000 +++ b/ChangeLog Tue Nov 28 17:06:47 2006 +0000 @@ -1,3 +1,16 @@ +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. + Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net> * bar_exif.c, cache-loader.c, pan-view.c: Pass new arg for exif_read().
--- a/TODO Mon Nov 27 06:37:48 2006 +0000 +++ b/TODO Tue Nov 28 17:06:47 2006 +0000 @@ -23,7 +23,7 @@ > color profiles: d> support profiles embedded in images - > check if clamp arg is handled correct in post_process_*() + d> check if clamp arg is handled correct in post_process_*() > add support in img-view.c --- @@ -117,15 +117,11 @@ Minor (non blockers): ---------------------------------------------- -d> update icon used for window to the (not so) new icon - > fix gtk_table_attach use to not use FALSE for fill vertical arg. > xv and xpaint are hardly used or even installed by any distro anymore - time to remove these (and find alternates?) seems silly to only have gimp. -d> update .desktop MimeType list to match Fedora's patch for missing formats - > allow editor commands to be interrupted (via SIGTERM?) > fix hanging editor commands that await user input (how to handle, or even detect this?) @@ -135,8 +131,6 @@ > fix printing of transparent images to not use black for transparency (white or user settable). -d> add [shift]+G to display as greyscale - > fix comment field in keywords bar to a height of 2 or 3 text lines. > add toolbar to: (UPDATE: these toolbars may not make it into 1.6) @@ -153,8 +147,6 @@ > Initiating full screen from the command line should not show main window until full screen is exited. -d> add --geometry suipport - > Add shortcut to jump to next folder within parent folder. > add animated image support
--- 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 */
--- a/src/color-man.h Mon Nov 27 06:37:48 2006 +0000 +++ b/src/color-man.h Tue Nov 28 17:06:47 2006 +0000 @@ -33,6 +33,7 @@ struct _ColorMan { ImageWindow *imd; GdkPixbuf *pixbuf; + gint incremental_sync; gint row; gpointer profile; @@ -44,11 +45,11 @@ }; -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); -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);
--- a/src/image.c Mon Nov 27 06:37:48 2006 +0000 +++ b/src/image.c Tue Nov 28 17:06:47 2006 +0000 @@ -1,6 +1,6 @@ /* * GQview - * (C) 2005 John Ellis + * (C) 2006 John Ellis * * Author: John Ellis * @@ -45,6 +45,7 @@ static void image_update_title(ImageWindow *imd); static void image_post_process(ImageWindow *imd, gint clamp); +static void image_read_ahead_start(ImageWindow *imd); /* *------------------------------------------------------------------- @@ -263,14 +264,19 @@ { ImageWindow *imd = data; - color_man_free((ColorMan *)imd->cm); + color_man_free(cm); + if (type == COLOR_RETURN_IMAGE_CHANGED) + { + if (cm == imd->cm) imd->cm = NULL; + return; + } + imd->cm = NULL; imd->state |= IMAGE_STATE_COLOR_ADJ; - if (type != COLOR_RETURN_IMAGE_CHANGED) - { - image_post_process_alter(imd, FALSE); - } + image_post_process_alter(imd, FALSE); + + image_read_ahead_start(imd); } static gint image_post_process_color(ImageWindow *imd, gint start_row, ExifData *exif) @@ -324,19 +330,33 @@ if (imd->color_profile_use_image && exif) { item = exif_get_item(exif, "ColorProfile"); + if (!item) + { + gint cs; + + /* ColorSpace == 1 specifies sRGB per EXIF 2.2 */ + if (exif_get_integer(exif, "ColorSpace", &cs) && + cs == 1) + { + input_type = COLOR_PROFILE_SRGB; + input_file = NULL; + + if (debug) printf("Found EXIF ColorSpace of sRGB\n"); + } + } } if (item && item->format == EXIF_FORMAT_UNDEFINED) { if (debug) printf("Found embedded color profile\n"); - cm = color_man_new_embedded(imd, + cm = color_man_new_embedded(imd, NULL, item->data, item->data_len, screen_type, screen_file, image_post_process_color_cb, imd); } else { - cm = color_man_new(imd, + cm = color_man_new(imd, NULL, input_type, input_file, screen_type, screen_file, image_post_process_color_cb, imd); @@ -493,7 +513,7 @@ if (!imd->read_ahead_path || imd->read_ahead_il || imd->read_ahead_pixbuf) return; /* still loading ?, do later */ - if (imd->il) return; + if (imd->il || imd->cm) return; if (debug) printf("read ahead started for :%s\n", imd->read_ahead_path);
--- a/src/typedefs.h Mon Nov 27 06:37:48 2006 +0000 +++ b/src/typedefs.h Tue Nov 28 17:06:47 2006 +0000 @@ -1,6 +1,6 @@ /* * GQview - * (C) 2004 John Ellis + * (C) 2006 John Ellis * * Author: John Ellis * @@ -289,7 +289,7 @@ gint color_profile_input; gint color_profile_screen; gint color_profile_use_image; - gpointer *cm; + gpointer cm; AlterType delay_alter_type;
--- a/src/utilops.c Mon Nov 27 06:37:48 2006 +0000 +++ b/src/utilops.c Tue Nov 28 17:06:47 2006 +0000 @@ -2341,7 +2341,7 @@ pref_table_label(table, 0, 1, _("New name:"), 1.0); rd->rename_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), rd->rename_entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, FALSE, 0, 0); + gtk_table_attach(GTK_TABLE(table), rd->rename_entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0); generic_dialog_attach_default(GENERIC_DIALOG(rd->fd), rd->rename_entry); gtk_widget_grab_focus(rd->rename_entry); @@ -2519,7 +2519,7 @@ pref_table_label(table, 0, 1, _("New name:"), 1.0); fd->entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), fd->entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, FALSE, 0, 0); + gtk_table_attach(GTK_TABLE(table), fd->entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0); generic_dialog_attach_default(GENERIC_DIALOG(fd), fd->entry); gtk_widget_grab_focus(fd->entry);