Be smarter about emitting the "invalidate_preview" signal.

comitted using Yosh's account...


--Sven
This commit is contained in:
Manish Singh 2000-06-03 18:19:22 +00:00
parent ffc162c03a
commit f764c56d03
27 changed files with 73 additions and 45 deletions

View File

@ -1,3 +1,18 @@
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>

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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)
{

View File

@ -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 *);

View File

@ -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 */

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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

View File

@ -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;

View File

@ -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 */

View File

@ -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);
}
}

View File

@ -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)
{

View File

@ -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 *);

View File

@ -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);
}
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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

View File

@ -912,7 +912,7 @@ paint_core_finish (PaintCore *paint_core,
/* 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);
}
void

View File

@ -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

View File

@ -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

View File

@ -912,7 +912,7 @@ paint_core_finish (PaintCore *paint_core,
/* 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);
}
void

View File

@ -1062,7 +1062,7 @@ static void
/* 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

View File

@ -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;
}

View File

@ -1062,7 +1062,7 @@ static void
/* 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