[gimp] app: optimize gimp_layer_invalidate_boundary()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: optimize gimp_layer_invalidate_boundary()
- Date: Sun, 3 Mar 2019 19:29:24 +0000 (UTC)
commit 8d4e5e0ff714a30f2f0a00058d46e376828b80bf
Author: Michael Natterer <mitch gimp org>
Date: Sun Mar 3 20:25:40 2019 +0100
app: optimize gimp_layer_invalidate_boundary()
Don't mess with the image's mask if the layer is not attached or not
visible.
(cherry picked from commit 1c66573f4c96e59a986854310e74d29ec9eed7ea)
app/core/gimplayer.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index d7a51c0ebf..16839e9c05 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1454,24 +1454,23 @@ gimp_layer_convert_type (GimpDrawable *drawable,
static void
gimp_layer_invalidate_boundary (GimpDrawable *drawable)
{
- GimpLayer *layer = GIMP_LAYER (drawable);
- GimpImage *image;
- GimpChannel *mask;
+ GimpLayer *layer = GIMP_LAYER (drawable);
- if (! (image = gimp_item_get_image (GIMP_ITEM (layer))))
- return;
-
- /* Turn the current selection off */
- gimp_image_selection_invalidate (image);
+ if (gimp_item_is_attached (GIMP_ITEM (drawable)) &&
+ gimp_item_is_visible (GIMP_ITEM (drawable)))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
- /* get the selection mask channel */
- mask = gimp_image_get_mask (image);
+ /* Turn the current selection off */
+ gimp_image_selection_invalidate (image);
- /* Only bother with the bounds if there is a selection */
- if (! gimp_channel_is_empty (mask))
- {
- mask->bounds_known = FALSE;
- mask->boundary_known = FALSE;
+ /* Only bother with the bounds if there is a selection */
+ if (! gimp_channel_is_empty (mask))
+ {
+ mask->bounds_known = FALSE;
+ mask->boundary_known = FALSE;
+ }
}
if (gimp_layer_is_floating_sel (layer))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]