app: add "update" parameter to gimp_drawable_set_buffer_full()

... which specifies whether or not to update the drawable in
response to the buffer change.

Pass TRUE for "update" at all existing call sites, to keep the
current behavior.
This commit is contained in:
Ell 2018-08-03 12:58:03 -04:00
parent fbeae36118
commit 26a8d141f6
7 changed files with 31 additions and 18 deletions

View File

@ -613,7 +613,8 @@ gimp_channel_convert (GimpItem *item,
gimp_drawable_set_buffer_full (drawable, FALSE, NULL,
new_buffer,
gimp_item_get_offset_x (item),
gimp_item_get_offset_y (item));
gimp_item_get_offset_y (item),
TRUE);
g_object_unref (new_buffer);
}
@ -743,7 +744,8 @@ gimp_channel_scale (GimpItem *item,
gimp_drawable_set_buffer_full (drawable,
gimp_item_is_attached (item), NULL,
new_buffer,
new_offset_x, new_offset_y);
new_offset_x, new_offset_y,
TRUE);
g_object_unref (new_buffer);
gimp_channel_clear (GIMP_CHANNEL (item), NULL, FALSE);

View File

@ -1080,7 +1080,8 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
{
gimp_drawable_set_buffer_full (drawable, TRUE, NULL,
buffer,
offset_x, offset_y);
offset_x, offset_y,
TRUE);
}
gimp_image_undo_group_end (image);

View File

@ -495,7 +495,8 @@ gimp_drawable_scale (GimpItem *item,
gimp_drawable_set_buffer_full (drawable, gimp_item_is_attached (item), NULL,
new_buffer,
new_offset_x, new_offset_y);
new_offset_x, new_offset_y,
TRUE);
g_object_unref (new_buffer);
}
@ -573,7 +574,8 @@ gimp_drawable_resize (GimpItem *item,
gimp_drawable_set_buffer_full (drawable, gimp_item_is_attached (item), NULL,
new_buffer,
new_offset_x, new_offset_y);
new_offset_x, new_offset_y,
TRUE);
g_object_unref (new_buffer);
}
@ -1247,7 +1249,7 @@ gimp_drawable_set_buffer (GimpDrawable *drawable,
gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y);
gimp_drawable_set_buffer_full (drawable, push_undo, undo_desc, buffer,
offset_x, offset_y);
offset_x, offset_y, TRUE);
}
void
@ -1256,7 +1258,8 @@ gimp_drawable_set_buffer_full (GimpDrawable *drawable,
const gchar *undo_desc,
GeglBuffer *buffer,
gint offset_x,
gint offset_y)
gint offset_y,
gboolean update)
{
GimpItem *item;
@ -1268,10 +1271,11 @@ gimp_drawable_set_buffer_full (GimpDrawable *drawable,
if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
push_undo = FALSE;
if (gimp_item_get_width (item) != gegl_buffer_get_width (buffer) ||
gimp_item_get_height (item) != gegl_buffer_get_height (buffer) ||
gimp_item_get_offset_x (item) != offset_x ||
gimp_item_get_offset_y (item) != offset_y)
if (update &&
(gimp_item_get_width (item) != gegl_buffer_get_width (buffer) ||
gimp_item_get_height (item) != gegl_buffer_get_height (buffer) ||
gimp_item_get_offset_x (item) != offset_x ||
gimp_item_get_offset_y (item) != offset_y))
{
gimp_drawable_update (drawable, 0, 0, -1, -1);
}
@ -1285,7 +1289,8 @@ gimp_drawable_set_buffer_full (GimpDrawable *drawable,
g_object_thaw_notify (G_OBJECT (drawable));
gimp_drawable_update (drawable, 0, 0, -1, -1);
if (update)
gimp_drawable_update (drawable, 0, 0, -1, -1);
}
void

View File

@ -187,7 +187,8 @@ void gimp_drawable_set_buffer_full (GimpDrawable *drawable,
const gchar *undo_desc,
GeglBuffer *buffer,
gint offset_x,
gint offset_y);
gint offset_y,
gboolean update);
void gimp_drawable_steal_buffer (GimpDrawable *drawable,
GimpDrawable *src_drawable);

View File

@ -198,7 +198,7 @@ gimp_drawable_mod_undo_pop (GimpUndo *undo,
&drawable_mod_undo->offset_y);
gimp_drawable_set_buffer_full (drawable, FALSE, NULL,
buffer, offset_x, offset_y);
buffer, offset_x, offset_y, TRUE);
g_object_unref (buffer);
}

View File

@ -1002,7 +1002,8 @@ gimp_group_layer_convert_type (GimpLayer *layer,
FALSE, NULL,
buffer,
gimp_item_get_offset_x (GIMP_ITEM (group)),
gimp_item_get_offset_y (GIMP_ITEM (group)));
gimp_item_get_offset_y (GIMP_ITEM (group)),
TRUE);
/* reset, the actual format is right now */
private->convert_format = NULL;
@ -1909,7 +1910,8 @@ gimp_group_layer_update_size (GimpGroupLayer *group)
gimp_drawable_set_buffer_full (GIMP_DRAWABLE (group),
FALSE, NULL,
buffer,
x, y);
x, y,
TRUE);
/* reset, the actual size is correct now */
private->reallocate_width = 0;
@ -2022,7 +2024,8 @@ gimp_group_layer_update_mask_size (GimpGroupLayer *group)
gimp_drawable_set_buffer_full (GIMP_DRAWABLE (mask),
FALSE, NULL,
buffer, bounds.x, bounds.y);
buffer, bounds.x, bounds.y,
TRUE);
g_object_unref (buffer);
}

View File

@ -159,7 +159,8 @@ gimp_group_layer_undo_pop (GimpUndo *undo,
FALSE, NULL,
group_layer_undo->mask_buffer,
group_layer_undo->mask_bounds.x,
group_layer_undo->mask_bounds.y);
group_layer_undo->mask_bounds.y,
TRUE);
}
}
break;