[gimp] app: disable transform clipping for layer groups



commit 203bc9d8939c74ad11a44cb77fb32f765732c602
Author: Ell <ell_se yahoo com>
Date:   Sat Jan 18 11:05:06 2020 +0200

    app: disable transform clipping for layer groups
    
    Using any clipping mode other than ADJUST is currently broken for
    layer groups, since each layer in the group is clipped
    individually, instead of clipping being applied to the group as a
    whole.  Ultimately, we should fix that, but for now, simply disable
    clipping for layer groups, by overriding GimpItem::get_clip() to
    always return ADJUST.

 app/core/gimpgrouplayer.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 570c685d81..8c2c368910 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -118,6 +118,9 @@ static void            gimp_group_layer_resize       (GimpItem        *item,
                                                       gint             new_height,
                                                       gint             offset_x,
                                                       gint             offset_y);
+static GimpTransformResize
+                       gimp_group_layer_get_clip     (GimpItem        *item,
+                                                      GimpTransformResize clip_result);
 
 static gint64      gimp_group_layer_estimate_memsize (GimpDrawable      *drawable,
                                                       GimpComponentType  component_type,
@@ -278,6 +281,7 @@ gimp_group_layer_class_init (GimpGroupLayerClass *klass)
   item_class->start_transform            = gimp_group_layer_start_transform;
   item_class->end_transform              = gimp_group_layer_end_transform;
   item_class->resize                     = gimp_group_layer_resize;
+  item_class->get_clip                   = gimp_group_layer_get_clip;
 
   item_class->default_name               = _("Layer Group");
   item_class->rename_desc                = C_("undo-type", "Rename Layer Group");
@@ -698,6 +702,16 @@ gimp_group_layer_resize (GimpItem     *item,
   gimp_group_layer_resume_resize (group, TRUE);
 }
 
+static GimpTransformResize
+gimp_group_layer_get_clip (GimpItem            *item,
+                           GimpTransformResize  clip_result)
+{
+  /* TODO: add clipping support, by clipping all sublayers as a unit, instead
+   * of individually.
+   */
+  return GIMP_TRANSFORM_RESIZE_ADJUST;
+}
+
 static gint64
 gimp_group_layer_estimate_memsize (GimpDrawable      *drawable,
                                    GimpComponentType  component_type,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]