From d8c632cb93169abba39269ef78cf74cf5160436d Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 26 Jun 2007 21:39:51 +0000 Subject: [PATCH] Invalidate the image preview after the projection is completely 2007-06-26 Michael Natterer Invalidate the image preview after the projection is completely constructed. Fixes bug #449141. * app/core/gimpmarshal.list: add VOID:BOOLEAN * app/core/gimpimage.[ch]: add boolean parameter invalidate_preview to the "flush" signal. * app/core/gimpprojection.[ch]: add boolean member invalidate_preview to the GimpProjection struct. Set it to TRUE if it was TRUE in the image's "flush" signal. When the projection is completely constructed after a flush, invalidate the image's preview. * app/display/gimpdisplay-handlers.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpimagedock.c * app/widgets/gimpimageeditor.c: changed callback signatures accordingly. svn path=/trunk/; revision=22840 --- ChangeLog | 22 ++++++++++++++++++++++ app/core/gimpimage.c | 18 ++++++++++++------ app/core/gimpimage.h | 3 ++- app/core/gimpmarshal.list | 1 + app/core/gimpprojection.c | 24 ++++++++++++++++++++++++ app/core/gimpprojection.h | 1 + app/display/gimpdisplay-handlers.c | 2 ++ app/widgets/gimpimagedock.c | 2 ++ app/widgets/gimpimageeditor.c | 2 ++ app/widgets/gimpitemtreeview.c | 2 ++ 10 files changed, 70 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf192554cf..e8204786e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2007-06-26 Michael Natterer + + Invalidate the image preview after the projection is + completely constructed. Fixes bug #449141. + + * app/core/gimpmarshal.list: add VOID:BOOLEAN + + * app/core/gimpimage.[ch]: add boolean parameter + invalidate_preview to the "flush" signal. + + * app/core/gimpprojection.[ch]: add boolean member + invalidate_preview to the GimpProjection struct. Set it to TRUE if + it was TRUE in the image's "flush" signal. When the projection is + completely constructed after a flush, invalidate the image's + preview. + + * app/display/gimpdisplay-handlers.c + * app/widgets/gimpitemtreeview.c + * app/widgets/gimpimagedock.c + * app/widgets/gimpimageeditor.c: changed callback signatures + accordingly. + 2007-06-26 Sven Neumann * app/widgets/gimpimageprofileview.c (gimp_image_profile_view_query): diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index d76885289c..270a2a2696 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -150,7 +150,8 @@ static gchar * gimp_image_get_description (GimpViewable *viewable, gchar **tooltip); static void gimp_image_real_colormap_changed (GimpImage *image, gint color_index); -static void gimp_image_real_flush (GimpImage *image); +static void gimp_image_real_flush (GimpImage *image, + gboolean invalidate_preview); static void gimp_image_mask_update (GimpDrawable *drawable, gint x, @@ -472,8 +473,9 @@ gimp_image_class_init (GimpImageClass *klass) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GimpImageClass, flush), NULL, NULL, - gimp_marshal_VOID__VOID, - G_TYPE_NONE, 0); + gimp_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, + G_TYPE_BOOLEAN); object_class->constructor = gimp_image_constructor; object_class->set_property = gimp_image_set_property; @@ -1123,7 +1125,8 @@ gimp_image_real_colormap_changed (GimpImage *image, } static void -gimp_image_real_flush (GimpImage *image) +gimp_image_real_flush (GimpImage *image, + gboolean invalidate_preview) { if (image->flush_accum.alpha_changed) { @@ -1139,7 +1142,9 @@ gimp_image_real_flush (GimpImage *image) if (image->flush_accum.preview_invalidated) { - gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image)); + /* don't invalidate the preview here, the projection does this when + * it is completely constructed. + */ image->flush_accum.preview_invalidated = FALSE; } } @@ -1977,7 +1982,8 @@ gimp_image_flush (GimpImage *image) { g_return_if_fail (GIMP_IS_IMAGE (image)); - g_signal_emit (image, gimp_image_signals[FLUSH], 0); + g_signal_emit (image, gimp_image_signals[FLUSH], 0, + image->flush_accum.preview_invalidated); } diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h index 1843a3c526..b23fd8ab59 100644 --- a/app/core/gimpimage.h +++ b/app/core/gimpimage.h @@ -227,7 +227,8 @@ struct _GimpImageClass GimpUndoEvent event, GimpUndo *undo); - void (* flush) (GimpImage *image); + void (* flush) (GimpImage *image, + gboolean invalidate_preview); }; diff --git a/app/core/gimpmarshal.list b/app/core/gimpmarshal.list index d1d073b53f..921be4eb2d 100644 --- a/app/core/gimpmarshal.list +++ b/app/core/gimpmarshal.list @@ -27,6 +27,7 @@ BOOLEAN: ENUM, INT BOOLEAN: OBJECT, POINTER BOOLEAN: OBJECT, POINTER, STRING +VOID: BOOLEAN VOID: BOOLEAN, INT, INT, INT, INT VOID: BOXED VOID: BOXED, ENUM diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index f39f891248..37495b6507 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -95,6 +95,7 @@ static void gimp_projection_image_size_changed (GimpImage *image, static void gimp_projection_image_mode_changed (GimpImage *image, GimpProjection *proj); static void gimp_projection_image_flush (GimpImage *image, + gboolean invalidate_preview, GimpProjection *proj); @@ -474,6 +475,15 @@ gimp_projection_flush_whenever (GimpProjection *proj, gimp_area_list_free (proj->update_areas); proj->update_areas = NULL; } + else if (! now && proj->invalidate_preview) + { + /* invalidate the preview here since it is constructed from + * the projection + */ + proj->invalidate_preview = FALSE; + + gimp_viewable_invalidate_preview (GIMP_VIEWABLE (proj->image)); + } } static void @@ -582,6 +592,16 @@ gimp_projection_idle_render_callback (gpointer data) /* FINISHED */ proj->idle_render.idle_id = 0; + if (proj->invalidate_preview) + { + /* invalidate the preview here since it is constructed from + * the projection + */ + proj->invalidate_preview = FALSE; + + gimp_viewable_invalidate_preview (GIMP_VIEWABLE (proj->image)); + } + return FALSE; } } @@ -701,7 +721,11 @@ gimp_projection_image_mode_changed (GimpImage *image, static void gimp_projection_image_flush (GimpImage *image, + gboolean invalidate_preview, GimpProjection *proj) { + if (invalidate_preview) + proj->invalidate_preview = TRUE; + gimp_projection_flush (proj); } diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h index 93624edd67..2c6d244246 100644 --- a/app/core/gimpprojection.h +++ b/app/core/gimpprojection.h @@ -61,6 +61,7 @@ struct _GimpProjection GimpProjectionIdleRender idle_render; gboolean construct_flag; + gboolean invalidate_preview; }; struct _GimpProjectionClass diff --git a/app/display/gimpdisplay-handlers.c b/app/display/gimpdisplay-handlers.c index 6f93d1d4cf..f6f023e145 100644 --- a/app/display/gimpdisplay-handlers.c +++ b/app/display/gimpdisplay-handlers.c @@ -45,6 +45,7 @@ static void gimp_display_update_handler (GimpProjection *projection, gint h, GimpDisplay *display); static void gimp_display_flush_handler (GimpImage *image, + gboolean invalidate_preview, GimpDisplay *display); static void gimp_display_saved_handler (GimpImage *image, const gchar *uri, @@ -137,6 +138,7 @@ gimp_display_update_handler (GimpProjection *projection, static void gimp_display_flush_handler (GimpImage *image, + gboolean invalidate_preview, GimpDisplay *display) { gimp_display_flush (display); diff --git a/app/widgets/gimpimagedock.c b/app/widgets/gimpimagedock.c index 6012e01d73..11250fe257 100644 --- a/app/widgets/gimpimagedock.c +++ b/app/widgets/gimpimagedock.c @@ -47,6 +47,7 @@ static void gimp_image_dock_display_changed (GimpContext *context, GimpObject *display, GimpImageDock *dock); static void gimp_image_dock_image_flush (GimpImage *image, + gboolean invalidate_preview, GimpImageDock *dock); static void gimp_image_dock_notify_transient (GimpConfig *config, @@ -167,6 +168,7 @@ gimp_image_dock_display_changed (GimpContext *context, static void gimp_image_dock_image_flush (GimpImage *image, + gboolean invalidate_preview, GimpImageDock *dock) { if (image == gimp_context_get_image (GIMP_DOCK (dock)->context)) diff --git a/app/widgets/gimpimageeditor.c b/app/widgets/gimpimageeditor.c index 5034acce93..c93d527f77 100644 --- a/app/widgets/gimpimageeditor.c +++ b/app/widgets/gimpimageeditor.c @@ -38,6 +38,7 @@ static void gimp_image_editor_destroy (GtkObject *object); static void gimp_image_editor_real_set_image (GimpImageEditor *editor, GimpImage *image); static void gimp_image_editor_image_flush (GimpImage *image, + gboolean invalidate_preview, GimpImageEditor *editor); @@ -161,6 +162,7 @@ gimp_image_editor_get_image (GimpImageEditor *editor) static void gimp_image_editor_image_flush (GimpImage *image, + gboolean invalidate_preview, GimpImageEditor *editor) { if (GIMP_EDITOR (editor)->ui_manager) diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c index 52854265b7..aeea54d639 100644 --- a/app/widgets/gimpitemtreeview.c +++ b/app/widgets/gimpitemtreeview.c @@ -75,6 +75,7 @@ static void gimp_item_tree_view_real_set_image (GimpItemTreeView *view, GimpImage *image); static void gimp_item_tree_view_image_flush (GimpImage *image, + gboolean invalidate_preview, GimpItemTreeView *view); static void gimp_item_tree_view_set_container (GimpContainerView *view, @@ -505,6 +506,7 @@ gimp_item_tree_view_real_set_image (GimpItemTreeView *view, static void gimp_item_tree_view_image_flush (GimpImage *image, + gboolean invalidate_preview, GimpItemTreeView *view) { gimp_ui_manager_update (GIMP_EDITOR (view)->ui_manager, view);