diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index 0fc36779c5..665e018b51 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -202,6 +202,8 @@ static void gimp_layer_set_buffer (GimpDrawable *drawable, const gchar *undo_desc, GeglBuffer *buffer, const GeglRectangle *bounds); +static GeglRectangle + gimp_layer_get_bounding_box (GimpDrawable *drawable); static GimpColorProfile * gimp_layer_get_color_profile (GimpColorManaged *managed); @@ -462,6 +464,7 @@ gimp_layer_class_init (GimpLayerClass *klass) drawable_class->get_active_components = gimp_layer_get_active_components; drawable_class->get_active_mask = gimp_layer_get_active_mask; drawable_class->set_buffer = gimp_layer_set_buffer; + drawable_class->get_bounding_box = gimp_layer_get_bounding_box; klass->opacity_changed = NULL; klass->mode_changed = NULL; @@ -1528,6 +1531,17 @@ gimp_layer_set_buffer (GimpDrawable *drawable, } } +static GeglRectangle +gimp_layer_get_bounding_box (GimpDrawable *drawable) +{ + GimpLayer *layer = GIMP_LAYER (drawable); + + if (gimp_layer_get_mask (layer)) + return GIMP_DRAWABLE_CLASS (parent_class)->get_bounding_box (drawable); + + return gegl_node_get_bounding_box (gimp_drawable_get_source_node (drawable)); +} + static GimpColorProfile * gimp_layer_get_color_profile (GimpColorManaged *managed) { @@ -1914,6 +1928,8 @@ gimp_layer_add_mask (GimpLayer *layer, gimp_layer_update_mode_node (layer); } + gimp_drawable_update_bounding_box (GIMP_DRAWABLE (layer)); + if (gimp_layer_get_apply_mask (layer) || gimp_layer_get_show_mask (layer)) { @@ -2232,6 +2248,8 @@ gimp_layer_apply_mask (GimpLayer *layer, gimp_layer_update_mode_node (layer); } + gimp_drawable_update_bounding_box (GIMP_DRAWABLE (layer)); + /* If applying actually changed the view */ if (view_changed) {