app: make using gimp_drawable_update() less verbose

Allow passing -1 for the drawable's width/height, instead of requiring
gimp_item_get_width,height() in many callers.
This commit is contained in:
Michael Natterer 2017-01-13 02:14:40 +01:00
parent 0bc45c8cd0
commit 68cc8bb86f
9 changed files with 38 additions and 109 deletions

View File

@ -1275,9 +1275,7 @@ gimp_channel_real_feather (GimpChannel *channel,
channel->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
@ -1299,9 +1297,7 @@ gimp_channel_real_sharpen (GimpChannel *channel,
channel->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
@ -1342,9 +1338,7 @@ gimp_channel_real_clear (GimpChannel *channel,
channel->x2 = gimp_item_get_width (GIMP_ITEM (channel));
channel->y2 = gimp_item_get_height (GIMP_ITEM (channel));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
@ -1373,9 +1367,7 @@ gimp_channel_real_all (GimpChannel *channel,
channel->x2 = gimp_item_get_width (GIMP_ITEM (channel));
channel->y2 = gimp_item_get_height (GIMP_ITEM (channel));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
@ -1402,9 +1394,7 @@ gimp_channel_real_invert (GimpChannel *channel,
channel->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
}
@ -1480,9 +1470,7 @@ gimp_channel_real_border (GimpChannel *channel,
channel->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
@ -1548,9 +1536,7 @@ gimp_channel_real_grow (GimpChannel *channel,
channel->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
@ -1606,9 +1592,7 @@ gimp_channel_real_shrink (GimpChannel *channel,
channel->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
@ -1797,10 +1781,7 @@ gimp_channel_set_color (GimpChannel *channel,
&channel->color);
}
gimp_drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
g_signal_emit (channel, channel_signals[COLOR_CHANGED], 0);
}
@ -1851,10 +1832,7 @@ gimp_channel_set_opacity (GimpChannel *channel,
&channel->color);
}
gimp_drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
g_signal_emit (channel, channel_signals[COLOR_CHANGED], 0);
}
@ -1900,10 +1878,7 @@ gimp_channel_set_show_masked (GimpChannel *channel,
}
}
gimp_drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
}

View File

@ -72,10 +72,7 @@ gimp_drawable_fill (GimpDrawable *drawable,
gimp_drawable_get_buffer (drawable),
&color, pattern, 0, 0);
gimp_drawable_update (drawable,
0, 0,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable)));
gimp_drawable_update (drawable, 0, 0, -1, -1);
}
void

View File

@ -336,10 +336,7 @@ gimp_drawable_fs_affect_changed (GimpImage *image,
gimp_drawable_sync_fs_filter (drawable);
gimp_drawable_update (GIMP_DRAWABLE (fs),
0, 0,
gimp_item_get_width (GIMP_ITEM (fs)),
gimp_item_get_height (GIMP_ITEM (fs)));
gimp_drawable_update (GIMP_DRAWABLE (fs), 0, 0, -1, -1);
}
static void
@ -350,10 +347,7 @@ gimp_drawable_fs_mask_changed (GimpImage *image,
gimp_drawable_sync_fs_filter (drawable);
gimp_drawable_update (GIMP_DRAWABLE (fs),
0, 0,
gimp_item_get_width (GIMP_ITEM (fs)),
gimp_item_get_height (GIMP_ITEM (fs)));
gimp_drawable_update (GIMP_DRAWABLE (fs), 0, 0, -1, -1);
}
static void

View File

@ -973,6 +973,12 @@ gimp_drawable_update (GimpDrawable *drawable,
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (width == -1)
width = gimp_item_get_width (GIMP_ITEM (drawable));
if (height == -1)
height = gimp_item_get_height (GIMP_ITEM (drawable));
g_signal_emit (drawable, gimp_drawable_signals[UPDATE], 0,
x, y, width, height);
}
@ -1192,10 +1198,7 @@ gimp_drawable_set_buffer_full (GimpDrawable *drawable,
gimp_item_get_offset_x (item) != offset_x ||
gimp_item_get_offset_y (item) != offset_y)
{
gimp_drawable_update (drawable,
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
gimp_drawable_update (drawable, 0, 0, -1, -1);
}
g_object_freeze_notify (G_OBJECT (drawable));
@ -1207,10 +1210,7 @@ gimp_drawable_set_buffer_full (GimpDrawable *drawable,
g_object_thaw_notify (G_OBJECT (drawable));
gimp_drawable_update (drawable,
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
gimp_drawable_update (drawable, 0, 0, -1, -1);
}
GeglNode *

View File

@ -743,9 +743,7 @@ gimp_image_convert_profile_layers (GimpImage *image,
intent, bpc,
sub_progress);
gimp_drawable_update (drawable, 0, 0,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable)));
gimp_drawable_update (drawable, 0, 0, -1, -1);
if (sub_progress)
g_object_unref (sub_progress);

View File

@ -687,10 +687,7 @@ gimp_image_merge_layers (GimpImage *image,
TRUE);
}
gimp_drawable_update (GIMP_DRAWABLE (merge_layer),
0, 0,
gimp_item_get_width (GIMP_ITEM (merge_layer)),
gimp_item_get_height (GIMP_ITEM (merge_layer)));
gimp_drawable_update (GIMP_DRAWABLE (merge_layer), 0, 0, -1, -1);
return merge_layer;
}

View File

@ -547,10 +547,7 @@ gimp_layer_notify (GObject *object,
{
gimp_layer_update_mode_node (GIMP_LAYER (object));
gimp_drawable_update (GIMP_DRAWABLE (object),
0, 0,
gimp_item_get_width (GIMP_ITEM (object)),
gimp_item_get_height (GIMP_ITEM (object)));
gimp_drawable_update (GIMP_DRAWABLE (object), 0, 0, -1, -1);
}
}
@ -879,10 +876,7 @@ gimp_layer_translate (GimpItem *item,
gimp_image_undo_push_item_displace (gimp_item_get_image (item), NULL, item);
/* update the old region */
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
/* invalidate the selection boundary because of a layer modification */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
@ -891,10 +885,7 @@ gimp_layer_translate (GimpItem *item,
push_undo);
/* update the new region */
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
if (layer->mask)
{
@ -1405,10 +1396,7 @@ gimp_layer_add_mask (GimpLayer *layer,
if (gimp_layer_get_apply_mask (layer) ||
gimp_layer_get_show_mask (layer))
{
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)));
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
}
g_signal_connect (mask, "update",
@ -1724,10 +1712,7 @@ gimp_layer_apply_mask (GimpLayer *layer,
/* If applying actually changed the view */
if (view_changed)
{
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
}
else
{
@ -1778,10 +1763,7 @@ gimp_layer_set_apply_mask (GimpLayer *layer,
}
}
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)));
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
g_signal_emit (layer, layer_signals[APPLY_MASK_CHANGED], 0);
}
@ -1867,10 +1849,7 @@ gimp_layer_set_show_mask (GimpLayer *layer,
gimp_layer_update_mode_node (layer);
}
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)));
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
g_signal_emit (layer, layer_signals[SHOW_MASK_CHANGED], 0);
}
@ -2048,10 +2027,7 @@ gimp_layer_set_opacity (GimpLayer *layer,
if (gimp_filter_peek_node (GIMP_FILTER (layer)))
gimp_layer_update_mode_node (layer);
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)));
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
}
}
@ -2087,10 +2063,7 @@ gimp_layer_set_mode (GimpLayer *layer,
if (gimp_filter_peek_node (GIMP_FILTER (layer)))
gimp_layer_update_mode_node (layer);
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)));
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
}
}

View File

@ -271,10 +271,7 @@ gimp_mask_undo_pop (GimpUndo *undo,
mask_undo->y = y;
mask_undo->format = format;
gimp_drawable_update (drawable,
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
gimp_drawable_update (drawable, 0, 0, -1, -1);
}
static void

View File

@ -392,10 +392,9 @@ gimp_selection_invalidate_boundary (GimpDrawable *drawable)
layer = gimp_image_get_active_layer (image);
if (layer && gimp_layer_is_floating_sel (layer))
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)));
{
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
}
#if 0
/* invalidate the preview */
@ -663,8 +662,7 @@ gimp_selection_load (GimpSelection *selection,
GIMP_CHANNEL (selection)->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (selection),
0, 0, width, height);
gimp_drawable_update (GIMP_DRAWABLE (selection), 0, 0, -1, -1);
}
GimpChannel *