app: add gimp_drawable_update_all()
Add a new GimpDrawable::update_all() virtual function, and a corresponding gimp_drawable_update_all() function, which updates the full contents of the drawable. Unlike calling `gimp_drawable_update (drawable, 0, 0, -1, -1)`, which updates the entire drawable area, gimp_drawable_update_all() only updates the area that has actual content. While the default implentation does simply update the entire drawable area, GimpGroupLayer overrides this function to recursively update its child layers, rather than the its entire area.
This commit is contained in:
parent
19e74f0e28
commit
3e5cbb03d9
3 changed files with 44 additions and 0 deletions
|
|
@ -169,6 +169,8 @@ static gint64 gimp_drawable_real_estimate_memsize (GimpDrawable *drawable,
|
|||
gint width,
|
||||
gint height);
|
||||
|
||||
static void gimp_drawable_real_update_all (GimpDrawable *drawable);
|
||||
|
||||
static GimpComponentMask
|
||||
gimp_drawable_real_get_active_mask (GimpDrawable *drawable);
|
||||
|
||||
|
|
@ -286,6 +288,7 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
|
|||
klass->format_changed = NULL;
|
||||
klass->alpha_changed = NULL;
|
||||
klass->estimate_memsize = gimp_drawable_real_estimate_memsize;
|
||||
klass->update_all = gimp_drawable_real_update_all;
|
||||
klass->invalidate_boundary = NULL;
|
||||
klass->get_active_components = NULL;
|
||||
klass->get_active_mask = gimp_drawable_real_get_active_mask;
|
||||
|
|
@ -809,6 +812,12 @@ gimp_drawable_real_estimate_memsize (GimpDrawable *drawable,
|
|||
return (gint64) babl_format_get_bytes_per_pixel (format) * width * height;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_real_update_all (GimpDrawable *drawable)
|
||||
{
|
||||
gimp_drawable_update (drawable, 0, 0, -1, -1);
|
||||
}
|
||||
|
||||
static GimpComponentMask
|
||||
gimp_drawable_real_get_active_mask (GimpDrawable *drawable)
|
||||
{
|
||||
|
|
@ -1121,6 +1130,14 @@ gimp_drawable_update (GimpDrawable *drawable,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_update_all (GimpDrawable *drawable)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
|
||||
GIMP_DRAWABLE_GET_CLASS (drawable)->update_all (drawable);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_invalidate_boundary (GimpDrawable *drawable)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ struct _GimpDrawableClass
|
|||
GimpComponentType component_type,
|
||||
gint width,
|
||||
gint height);
|
||||
void (* update_all) (GimpDrawable *drawable);
|
||||
void (* invalidate_boundary) (GimpDrawable *drawable);
|
||||
void (* get_active_components) (GimpDrawable *drawable,
|
||||
gboolean *active);
|
||||
|
|
@ -127,6 +128,7 @@ void gimp_drawable_update (GimpDrawable *drawable,
|
|||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gimp_drawable_update_all (GimpDrawable *drawable);
|
||||
|
||||
void gimp_drawable_invalidate_boundary (GimpDrawable *drawable);
|
||||
void gimp_drawable_get_active_components (GimpDrawable *drawable,
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ static gint64 gimp_group_layer_estimate_memsize (GimpDrawable *drawabl
|
|||
GimpComponentType component_type,
|
||||
gint width,
|
||||
gint height);
|
||||
static void gimp_group_layer_update_all (GimpDrawable *drawable);
|
||||
|
||||
static void gimp_group_layer_translate (GimpLayer *layer,
|
||||
gint offset_x,
|
||||
|
|
@ -286,6 +287,7 @@ gimp_group_layer_class_init (GimpGroupLayerClass *klass)
|
|||
item_class->transform_desc = C_("undo-type", "Transform Layer Group");
|
||||
|
||||
drawable_class->estimate_memsize = gimp_group_layer_estimate_memsize;
|
||||
drawable_class->update_all = gimp_group_layer_update_all;
|
||||
drawable_class->get_source_node = gimp_group_layer_get_source_node;
|
||||
|
||||
layer_class->opacity_changed = gimp_group_layer_opacity_changed;
|
||||
|
|
@ -746,6 +748,29 @@ gimp_group_layer_estimate_memsize (GimpDrawable *drawable,
|
|||
width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_group_layer_update_all (GimpDrawable *drawable)
|
||||
{
|
||||
GimpGroupLayerPrivate *private = GET_PRIVATE (drawable);
|
||||
GList *list;
|
||||
|
||||
/* redirect stack updates to the drawable, rather than to the projection */
|
||||
private->direct_update++;
|
||||
|
||||
for (list = gimp_item_stack_get_item_iter (GIMP_ITEM_STACK (private->children));
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpFilter *child = list->data;
|
||||
|
||||
if (gimp_filter_get_active (child))
|
||||
gimp_drawable_update_all (GIMP_DRAWABLE (child));
|
||||
}
|
||||
|
||||
/* redirect stack updates back to the projection */
|
||||
private->direct_update--;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_group_layer_translate (GimpLayer *layer,
|
||||
gint offset_x,
|
||||
|
|
|
|||
Loading…
Reference in a new issue