Commit f764c56d authored by Manish Singh's avatar Manish Singh
Browse files

Be smarter about emitting the "invalidate_preview" signal.

comitted using Yosh's account...


--Sven
parent ffc162c0
Sat Jun 3 11:11:58 PDT 2000 Sven Neumann <sven@gimp.org>
* app/channel.c
* app/drawable.c
* app/floating_sel.c
* app/gimage_mask.c
* app/gimpdrawable.[ch]
* app/ink.c
* app/layer.c
* app/paint_core.c
* app/undo.c
* app/xinput_airbrush.c: be smarter about emitting the
"invalidate_preview" signal, so it doesn't slow down
painting and image_map color-corrections.
2000-06-03 Michael Natterer <mitch@gimp.org>
Sven Neumann <sven@gimp.org>
 
......
......@@ -580,7 +580,7 @@ channel_invalidate_previews (GimpImage* gimage)
while (tmp)
{
channel = (Channel *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE (channel));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (channel), TRUE);
tmp = g_slist_next (tmp);
}
}
......
......@@ -580,7 +580,7 @@ channel_invalidate_previews (GimpImage* gimage)
while (tmp)
{
channel = (Channel *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE (channel));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (channel), TRUE);
tmp = g_slist_next (tmp);
}
}
......
......@@ -580,7 +580,7 @@ channel_invalidate_previews (GimpImage* gimage)
while (tmp)
{
channel = (Channel *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE (channel));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (channel), TRUE);
tmp = g_slist_next (tmp);
}
}
......
......@@ -215,15 +215,19 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
}
void
gimp_drawable_invalidate_preview (GimpDrawable *drawable)
gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal)
{
GimpImage *gimage;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
drawable->preview_valid = FALSE;
gtk_signal_emit (GTK_OBJECT (drawable),
gimp_drawable_signals[INVALIDATE_PREVIEW]);
if (emit_signal)
gtk_signal_emit (GTK_OBJECT (drawable),
gimp_drawable_signals[INVALIDATE_PREVIEW]);
gimage = gimp_drawable_gimage (drawable);
if (gimage)
{
......
......@@ -45,7 +45,8 @@ gboolean gimp_drawable_mask_bounds (GimpDrawable *,
gint *, gint *,
gint *, gint *);
void gimp_drawable_invalidate_preview (GimpDrawable *);
void gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal);
gint gimp_drawable_dirty (GimpDrawable *);
gint gimp_drawable_clean (GimpDrawable *);
gboolean gimp_drawable_has_alpha (GimpDrawable *);
......
......@@ -285,7 +285,7 @@ gimage_mask_extract (GImage *gimage,
tiles->width, tiles->height);
/* Invalidate the preview */
drawable_invalidate_preview (drawable);
gimp_drawable_invalidate_preview (drawable, TRUE);
}
}
/* Otherwise, get the entire active layer */
......
......@@ -1995,7 +1995,7 @@ undo_pop_fs_to_layer (GImage *gimage,
{
case UNDO:
/* Update the preview for the floating sel */
drawable_invalidate_preview (GIMP_DRAWABLE (fsu->layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (fsu->layer), TRUE);
fsu->layer->fs.drawable = fsu->drawable;
gimage->active_layer = fsu->layer;
......@@ -2013,7 +2013,7 @@ undo_pop_fs_to_layer (GImage *gimage,
layer_invalidate_boundary (fsu->layer);
/* Update the preview for the gimage and underlying drawable */
drawable_invalidate_preview (GIMP_DRAWABLE (fsu->layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (fsu->layer), TRUE);
break;
case REDO:
......@@ -2025,7 +2025,7 @@ undo_pop_fs_to_layer (GImage *gimage,
GIMP_DRAWABLE (fsu->layer)->height);
/* Update the preview for the gimage and underlying drawable */
drawable_invalidate_preview (GIMP_DRAWABLE (fsu->layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (fsu->layer), TRUE);
/* clear the selection */
layer_invalidate_boundary (fsu->layer);
......@@ -2035,7 +2035,7 @@ undo_pop_fs_to_layer (GImage *gimage,
gimage->floating_sel = NULL;
/* Update the fs drawable */
drawable_invalidate_preview (GIMP_DRAWABLE (fsu->layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (fsu->layer), TRUE);
break;
}
......
......@@ -92,7 +92,7 @@ floating_sel_remove (Layer *layer)
* because it will not be done until the floating selection is removed,
* at which point the obscured drawable's preview will not be declared invalid
*/
drawable_invalidate_preview (GIMP_DRAWABLE (layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer), TRUE);
/* remove the layer from the gimage */
gimage_remove_layer (gimage, layer);
......@@ -116,7 +116,7 @@ floating_sel_anchor (Layer *layer)
/* Invalidate the previews of the layer that will be composited with the floating section. */
drawable_invalidate_preview (layer->fs.drawable);
gimp_drawable_invalidate_preview (layer->fs.drawable, TRUE);
/* Relax the floating selection */
floating_sel_relax (layer, TRUE);
......@@ -198,7 +198,7 @@ floating_sel_to_layer (Layer *layer)
/* update the fs drawable--this updates the gimage composite preview
* as well as the underlying drawable's
*/
drawable_invalidate_preview (GIMP_DRAWABLE (layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer), TRUE);
/* allocate the undo structure */
fsu = g_new (FStoLayerUndo, 1);
......@@ -516,7 +516,7 @@ void
floating_sel_invalidate (Layer *layer)
{
/* Invalidate the attached-to drawable's preview */
drawable_invalidate_preview (layer->fs.drawable);
gimp_drawable_invalidate_preview (layer->fs.drawable, TRUE);
/* Invalidate the boundary */
layer->fs.boundary_known = FALSE;
......
......@@ -694,7 +694,8 @@ layer_translate_lowlevel (Layer *layer,
if (!temporary)
{
/* invalidate the mask preview */
drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask),
FALSE);
}
}
}
......@@ -1505,7 +1506,7 @@ layer_invalidate_previews (GimpImage *gimage)
while (tmp)
{
layer = (Layer *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE(layer), TRUE);
tmp = g_slist_next (tmp);
}
}
......
......@@ -98,7 +98,7 @@ drawable_update (GimpDrawable *drawable,
gdisplays_update_area (gimage, x, y, w, h);
/* invalidate the preview */
gimp_drawable_invalidate_preview (drawable);
gimp_drawable_invalidate_preview (drawable, FALSE);
}
void
......
......@@ -92,7 +92,7 @@ floating_sel_remove (Layer *layer)
* because it will not be done until the floating selection is removed,
* at which point the obscured drawable's preview will not be declared invalid
*/
drawable_invalidate_preview (GIMP_DRAWABLE (layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer), TRUE);
/* remove the layer from the gimage */
gimage_remove_layer (gimage, layer);
......@@ -116,7 +116,7 @@ floating_sel_anchor (Layer *layer)
/* Invalidate the previews of the layer that will be composited with the floating section. */
drawable_invalidate_preview (layer->fs.drawable);
gimp_drawable_invalidate_preview (layer->fs.drawable, TRUE);
/* Relax the floating selection */
floating_sel_relax (layer, TRUE);
......@@ -198,7 +198,7 @@ floating_sel_to_layer (Layer *layer)
/* update the fs drawable--this updates the gimage composite preview
* as well as the underlying drawable's
*/
drawable_invalidate_preview (GIMP_DRAWABLE (layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer), TRUE);
/* allocate the undo structure */
fsu = g_new (FStoLayerUndo, 1);
......@@ -516,7 +516,7 @@ void
floating_sel_invalidate (Layer *layer)
{
/* Invalidate the attached-to drawable's preview */
drawable_invalidate_preview (layer->fs.drawable);
gimp_drawable_invalidate_preview (layer->fs.drawable, TRUE);
/* Invalidate the boundary */
layer->fs.boundary_known = FALSE;
......
......@@ -285,7 +285,7 @@ gimage_mask_extract (GImage *gimage,
tiles->width, tiles->height);
/* Invalidate the preview */
drawable_invalidate_preview (drawable);
gimp_drawable_invalidate_preview (drawable, TRUE);
}
}
/* Otherwise, get the entire active layer */
......
......@@ -580,7 +580,7 @@ channel_invalidate_previews (GimpImage* gimage)
while (tmp)
{
channel = (Channel *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE (channel));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (channel), TRUE);
tmp = g_slist_next (tmp);
}
}
......
......@@ -215,15 +215,19 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
}
void
gimp_drawable_invalidate_preview (GimpDrawable *drawable)
gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal)
{
GimpImage *gimage;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
drawable->preview_valid = FALSE;
gtk_signal_emit (GTK_OBJECT (drawable),
gimp_drawable_signals[INVALIDATE_PREVIEW]);
if (emit_signal)
gtk_signal_emit (GTK_OBJECT (drawable),
gimp_drawable_signals[INVALIDATE_PREVIEW]);
gimage = gimp_drawable_gimage (drawable);
if (gimage)
{
......
......@@ -45,7 +45,8 @@ gboolean gimp_drawable_mask_bounds (GimpDrawable *,
gint *, gint *,
gint *, gint *);
void gimp_drawable_invalidate_preview (GimpDrawable *);
void gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal);
gint gimp_drawable_dirty (GimpDrawable *);
gint gimp_drawable_clean (GimpDrawable *);
gboolean gimp_drawable_has_alpha (GimpDrawable *);
......
......@@ -694,7 +694,8 @@ layer_translate_lowlevel (Layer *layer,
if (!temporary)
{
/* invalidate the mask preview */
drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask),
FALSE);
}
}
}
......@@ -1505,7 +1506,7 @@ layer_invalidate_previews (GimpImage *gimage)
while (tmp)
{
layer = (Layer *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE(layer), TRUE);
tmp = g_slist_next (tmp);
}
}
......
......@@ -1115,7 +1115,7 @@ ink_finish (InkTool *ink_tool, GimpDrawable *drawable, int tool_id)
/* invalidate the drawable--have to do it here, because
* it is not done during the actual painting.
*/
drawable_invalidate_preview (drawable);
gimp_drawable_invalidate_preview (drawable, TRUE);
}
static void
......
......@@ -694,7 +694,8 @@ layer_translate_lowlevel (Layer *layer,
if (!temporary)
{
/* invalidate the mask preview */
drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask),
FALSE);
}
}
}
......@@ -1505,7 +1506,7 @@ layer_invalidate_previews (GimpImage *gimage)
while (tmp)
{
layer = (Layer *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(layer));
gimp_drawable_invalidate_preview (GIMP_DRAWABLE(layer), TRUE);
tmp = g_slist_next (tmp);
}
}
......
......@@ -1115,7 +1115,7 @@ ink_finish (InkTool *ink_tool, GimpDrawable *drawable, int tool_id)
/* invalidate the drawable--have to do it here, because
* it is not done during the actual painting.
*/
drawable_invalidate_preview (drawable);
gimp_drawable_invalidate_preview (drawable, TRUE);
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment