[gimp] Change GimpProjectable::update to GimpProjectable:invalidate
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Change GimpProjectable::update to GimpProjectable:invalidate
- Date: Wed, 26 Aug 2009 11:09:31 +0000 (UTC)
commit d442379d5e6db6ce2fe23b72717b1357f3d1e5b4
Author: Michael Natterer <mitch gimp org>
Date: Wed Aug 26 13:06:55 2009 +0200
Change GimpProjectable::update to GimpProjectable:invalidate
The only purpose of this change is to avoid having the "update"
signal twice on GimpGroupLayer (from GimpDrawable and from
GimpProjectable). Switch back to normal g_signal_connect()
in the projection.
app/actions/debug-commands.c | 8 ++++----
app/actions/view-commands.c | 2 +-
app/core/gimpgrouplayer.c | 16 ++++++++++++++--
app/core/gimpimage-crop.c | 8 ++++----
app/core/gimpimage.c | 38 +++++++++++++++++++-------------------
app/core/gimpimage.h | 2 +-
app/core/gimpprojectable.c | 20 ++++++++++----------
app/core/gimpprojectable.h | 4 ++--
app/core/gimpprojection.c | 30 ++++++++++--------------------
app/file/file-open.c | 8 ++++----
10 files changed, 69 insertions(+), 67 deletions(-)
---
diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c
index c511032..d4765ae 100644
--- a/app/actions/debug-commands.c
+++ b/app/actions/debug-commands.c
@@ -290,10 +290,10 @@ debug_benchmark_projection (GimpImage *image)
GTimer *timer;
gint x, y;
- gimp_image_update (image,
- 0, 0,
- gimp_image_get_width (image),
- gimp_image_get_height (image));
+ gimp_image_invalidate (image,
+ 0, 0,
+ gimp_image_get_width (image),
+ gimp_image_get_height (image));
gimp_projection_flush_now (projection);
tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (projection));
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index 16a648d..5a2496b 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -715,7 +715,7 @@ view_use_gegl_cmd_callback (GtkAction *action,
g_list_free (layers);
- gimp_image_update (image, 0, 0, image->width, image->height);
+ gimp_image_invalidate (image, 0, 0, image->width, image->height);
gimp_image_flush (image);
}
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 30bc1fb..ca68ab2 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -832,11 +832,17 @@ gimp_group_layer_stack_update (GimpDrawableStack *stack,
gint height,
GimpGroupLayer *group)
{
+#if 0
+ g_printerr ("%s (%s) %d, %d (%d, %d)\n",
+ G_STRFUNC, gimp_object_get_name (GIMP_OBJECT (group)),
+ x, y, width, height);
+#endif
+
/* the layer stack's update signal speaks in image coordinates,
* pass to the projection as-is.
*/
- gimp_projectable_update (GIMP_PROJECTABLE (group),
- x, y, width, height);
+ gimp_projectable_invalidate (GIMP_PROJECTABLE (group),
+ x, y, width, height);
/* flush the pickable not the projectable because flushing the
* pickable will finish all invalidation on the projection so it
@@ -856,6 +862,12 @@ gimp_group_layer_proj_update (GimpProjection *proj,
gint height,
GimpGroupLayer *group)
{
+#if 0
+ g_printerr ("%s (%s) %d, %d (%d, %d)\n",
+ G_STRFUNC, gimp_object_get_name (GIMP_OBJECT (group)),
+ x, y, width, height);
+#endif
+
/* the projection speaks in image coordinates, transform to layer
* coordinates when emitting our own update signal.
*/
diff --git a/app/core/gimpimage-crop.c b/app/core/gimpimage-crop.c
index b96b972..ebbcd83 100644
--- a/app/core/gimpimage-crop.c
+++ b/app/core/gimpimage-crop.c
@@ -274,10 +274,10 @@ gimp_image_crop (GimpImage *image,
gimp_image_undo_group_end (image);
- gimp_image_update (image,
- 0, 0,
- gimp_image_get_width (image),
- gimp_image_get_height (image));
+ gimp_image_invalidate (image,
+ 0, 0,
+ gimp_image_get_width (image),
+ gimp_image_get_height (image));
gimp_image_size_changed_detailed (image,
-x1,
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 8ec9c5a..bdf5040 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -618,7 +618,7 @@ gimp_image_init (GimpImage *image)
image->layer_stack = NULL;
g_signal_connect_swapped (image->layers, "update",
- G_CALLBACK (gimp_image_update),
+ G_CALLBACK (gimp_image_invalidate),
image);
image->layer_alpha_handler =
@@ -627,7 +627,7 @@ gimp_image_init (GimpImage *image)
image);
g_signal_connect_swapped (image->channels, "update",
- G_CALLBACK (gimp_image_update),
+ G_CALLBACK (gimp_image_invalidate),
image);
image->channel_name_changed_handler =
@@ -824,14 +824,14 @@ gimp_image_dispose (GObject *object)
gimp_image_undo_free (image);
g_signal_handlers_disconnect_by_func (image->layers,
- gimp_image_update,
+ gimp_image_invalidate,
image);
gimp_container_remove_handler (image->layers,
image->layer_alpha_handler);
g_signal_handlers_disconnect_by_func (image->channels,
- gimp_image_update,
+ gimp_image_invalidate,
image);
gimp_container_remove_handler (image->channels,
@@ -1142,10 +1142,10 @@ gimp_image_real_colormap_changed (GimpImage *image,
gimp_image_color_hash_invalidate (image, color_index);
/* A colormap alteration affects the whole image */
- gimp_image_update (image,
- 0, 0,
- gimp_image_get_width (image),
- gimp_image_get_height (image));
+ gimp_image_invalidate (image,
+ 0, 0,
+ gimp_image_get_width (image),
+ gimp_image_get_height (image));
gimp_item_stack_invalidate_previews (GIMP_ITEM_STACK (image->layers));
}
@@ -1769,10 +1769,10 @@ gimp_image_set_component_visible (GimpImage *image,
gimp_image_signals[COMPONENT_VISIBILITY_CHANGED], 0,
channel);
- gimp_image_update (image,
- 0, 0,
- gimp_image_get_width (image),
- gimp_image_get_height (image));
+ gimp_image_invalidate (image,
+ 0, 0,
+ gimp_image_get_width (image),
+ gimp_image_get_height (image));
}
}
@@ -1809,16 +1809,16 @@ gimp_image_alpha_changed (GimpImage *image)
}
void
-gimp_image_update (GimpImage *image,
- gint x,
- gint y,
- gint width,
- gint height)
+gimp_image_invalidate (GimpImage *image,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
g_return_if_fail (GIMP_IS_IMAGE (image));
- gimp_projectable_update (GIMP_PROJECTABLE (image),
- x, y, width, height);
+ gimp_projectable_invalidate (GIMP_PROJECTABLE (image),
+ x, y, width, height);
image->flush_accum.preview_invalidated = TRUE;
}
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index d54249c..2112d4b 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -314,7 +314,7 @@ gboolean gimp_image_get_component_visible (const GimpImage *image,
void gimp_image_mode_changed (GimpImage *image);
void gimp_image_alpha_changed (GimpImage *image);
-void gimp_image_update (GimpImage *image,
+void gimp_image_invalidate (GimpImage *image,
gint x,
gint y,
gint width,
diff --git a/app/core/gimpprojectable.c b/app/core/gimpprojectable.c
index c64937f..e732391 100644
--- a/app/core/gimpprojectable.c
+++ b/app/core/gimpprojectable.c
@@ -31,7 +31,7 @@
enum
{
- UPDATE,
+ INVALIDATE,
FLUSH,
STRUCTURE_CHANGED,
LAST_SIGNAL
@@ -79,11 +79,11 @@ gimp_projectable_iface_base_init (GimpProjectableInterface *iface)
if (! initialized)
{
- projectable_signals[UPDATE] =
- g_signal_new ("update",
+ projectable_signals[INVALIDATE] =
+ g_signal_new ("invalidate",
G_TYPE_FROM_CLASS (iface),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GimpProjectableInterface, update),
+ G_STRUCT_OFFSET (GimpProjectableInterface, invalidate),
NULL, NULL,
gimp_marshal_VOID__INT_INT_INT_INT,
G_TYPE_NONE, 4,
@@ -119,15 +119,15 @@ gimp_projectable_iface_base_init (GimpProjectableInterface *iface)
/* public functions */
void
-gimp_projectable_update (GimpProjectable *projectable,
- gint x,
- gint y,
- gint width,
- gint height)
+gimp_projectable_invalidate (GimpProjectable *projectable,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
g_return_if_fail (GIMP_IS_PROJECTABLE (projectable));
- g_signal_emit (projectable, projectable_signals[UPDATE], 0,
+ g_signal_emit (projectable, projectable_signals[INVALIDATE], 0,
x, y, width, height);
}
diff --git a/app/core/gimpprojectable.h b/app/core/gimpprojectable.h
index e48e3d0..2ccf34d 100644
--- a/app/core/gimpprojectable.h
+++ b/app/core/gimpprojectable.h
@@ -35,7 +35,7 @@ struct _GimpProjectableInterface
GTypeInterface base_iface;
/* signals */
- void (* update) (GimpProjectable *projectable,
+ void (* invalidate) (GimpProjectable *projectable,
gint x,
gint y,
gint width,
@@ -63,7 +63,7 @@ struct _GimpProjectableInterface
GType gimp_projectable_interface_get_type (void) G_GNUC_CONST;
-void gimp_projectable_update (GimpProjectable *projectable,
+void gimp_projectable_invalidate (GimpProjectable *projectable,
gint x,
gint y,
gint width,
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 9a928ab..3806406 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -95,7 +95,7 @@ static void gimp_projection_validate_tile (TileManager *tm,
Tile *tile,
GimpProjection *proj);
-static void gimp_projection_projectable_update (GimpProjectable *projectable,
+static void gimp_projection_projectable_invalidate(GimpProjectable *projectable,
gint x,
gint y,
gint w,
@@ -345,7 +345,6 @@ GimpProjection *
gimp_projection_new (GimpProjectable *projectable)
{
GimpProjection *proj;
- GClosure *closure;
g_return_val_if_fail (GIMP_IS_PROJECTABLE (projectable), NULL);
@@ -353,18 +352,9 @@ gimp_projection_new (GimpProjectable *projectable)
proj->projectable = projectable;
- closure = g_cclosure_new_object (G_CALLBACK (gimp_projection_projectable_update),
- G_OBJECT (proj));
-
- /* connect the "update" signal by ID so we definitely get the signal
- * of GimpPickable and not the one of GimpDrawable in case of group
- * layers
- */
- g_signal_connect_closure_by_id (projectable,
- g_signal_lookup ("update",
- GIMP_TYPE_PROJECTABLE), 0,
- closure, FALSE);
-
+ g_signal_connect_object (projectable, "invalidate",
+ G_CALLBACK (gimp_projection_projectable_invalidate),
+ proj, 0);
g_signal_connect_object (projectable, "flush",
G_CALLBACK (gimp_projection_projectable_flush),
proj, 0);
@@ -836,12 +826,12 @@ gimp_projection_validate_tile (TileManager *tm,
/* image callbacks */
static void
-gimp_projection_projectable_update (GimpProjectable *projectable,
- gint x,
- gint y,
- gint w,
- gint h,
- GimpProjection *proj)
+gimp_projection_projectable_invalidate (GimpProjectable *projectable,
+ gint x,
+ gint y,
+ gint w,
+ gint h,
+ GimpProjection *proj)
{
gimp_projection_add_update_area (proj, x, y, w, h);
}
diff --git a/app/file/file-open.c b/app/file/file-open.c
index aba117f..073093d 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -613,10 +613,10 @@ file_open_sanitize_image (GimpImage *image,
* load plug-ins are not required to call gimp_drawable_update() or
* anything.
*/
- gimp_image_update (image,
- 0, 0,
- gimp_image_get_width (image),
- gimp_image_get_height (image));
+ gimp_image_invalidate (image,
+ 0, 0,
+ gimp_image_get_width (image),
+ gimp_image_get_height (image));
gimp_image_flush (image);
/* same for drawable previews */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]