[gimp] app: set group layer projection priority according to depth



commit be97b97a2bc7711a7c54aa48ee64bf2e3fd65e3b
Author: Ell <ell_se yahoo com>
Date:   Sat Dec 2 09:55:15 2017 -0500

    app: set group layer projection priority according to depth
    
    Set the priority of group-layer projections according to the group
    layer's depth, so that top-level groups have a priority of 1
    (compared to a priority of 0 for the image projection), and nested
    groups have a priority one greater than their parent (in other
    words, shallower groups have higher priority than deeper groups,
    all of which have lower priority than the image.)
    
    This makes pass-through groups much faster, in particular.

 app/core/gimpgrouplayer.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index a9259aa..7a97019 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -84,6 +84,7 @@ static void            gimp_group_layer_get_property (GObject         *object,
 static gint64          gimp_group_layer_get_memsize  (GimpObject      *object,
                                                       gint64          *gui_size);
 
+static void        gimp_group_layer_ancestry_changed (GimpViewable    *viewable);
 static gboolean        gimp_group_layer_get_size     (GimpViewable    *viewable,
                                                       gint            *width,
                                                       gint            *height);
@@ -230,6 +231,7 @@ gimp_group_layer_class_init (GimpGroupLayerClass *klass)
   gimp_object_class->get_memsize         = gimp_group_layer_get_memsize;
 
   viewable_class->default_icon_name      = "gimp-group-layer";
+  viewable_class->ancestry_changed       = gimp_group_layer_ancestry_changed;
   viewable_class->get_size               = gimp_group_layer_get_size;
   viewable_class->get_children           = gimp_group_layer_get_children;
   viewable_class->set_expanded           = gimp_group_layer_set_expanded;
@@ -320,6 +322,7 @@ gimp_group_layer_init (GimpGroupLayer *group)
                     group);
 
   private->projection = gimp_projection_new (GIMP_PROJECTABLE (group));
+  gimp_projection_set_priority (private->projection, 1);
 
   g_signal_connect (private->projection, "update",
                     G_CALLBACK (gimp_group_layer_proj_update),
@@ -395,6 +398,17 @@ gimp_group_layer_get_memsize (GimpObject *object,
                                                                   gui_size);
 }
 
+static void
+gimp_group_layer_ancestry_changed (GimpViewable *viewable)
+{
+  GimpGroupLayerPrivate *private = GET_PRIVATE (viewable);
+
+  gimp_projection_set_priority (private->projection,
+                                gimp_viewable_get_depth (viewable) + 1);
+
+  GIMP_VIEWABLE_CLASS (parent_class)->ancestry_changed (viewable);
+}
+
 static gboolean
 gimp_group_layer_get_size (GimpViewable *viewable,
                            gint         *width,


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