[gimp] Factor out configuring the layer's mode node to a utility function



commit 12ac8ce899775ae9ec1a9bbc373ab6bc57d37467
Author: Michael Natterer <mitch gimp org>
Date:   Sun Nov 29 13:35:27 2009 +0100

    Factor out configuring the layer's mode node to a utility function

 app/core/gimplayer.c |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 64d263e..2fc38e7 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -173,6 +173,8 @@ static void       gimp_layer_layer_mask_update  (GimpDrawable       *layer_mask,
                                                  gint                height,
                                                  GimpLayer          *layer);
 
+static void       gimp_layer_sync_mode_node     (GimpLayer          *layer);
+
 
 G_DEFINE_TYPE_WITH_CODE (GimpLayer, gimp_layer, GIMP_TYPE_DRAWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_PICKABLE,
@@ -780,12 +782,9 @@ gimp_layer_get_node (GimpItem *item)
   gegl_node_connect_to (layer->opacity_node, "output",
                         offset_node,         "input");
 
-  mode_node = gimp_drawable_get_mode_node (drawable);
+  gimp_layer_sync_mode_node (layer);
 
-  gegl_node_set (mode_node,
-                 "operation",  "gimp:point-layer-mode",
-                 "blend-mode", layer->mode,
-                 NULL);
+  mode_node = gimp_drawable_get_mode_node (drawable);
 
   gegl_node_connect_to (offset_node, "output",
                         mode_node,   "aux");
@@ -1016,6 +1015,22 @@ gimp_layer_layer_mask_update (GimpDrawable *drawable,
     }
 }
 
+static void
+gimp_layer_sync_mode_node (GimpLayer *layer)
+{
+  if (layer->opacity_node)
+    {
+      GeglNode *mode_node;
+
+      mode_node = gimp_drawable_get_mode_node (GIMP_DRAWABLE (layer));
+
+      gegl_node_set (mode_node,
+                     "operation",  "gimp:point-layer-mode",
+                     "blend-mode", layer->mode,
+                     NULL);
+    }
+}
+
 
 /*  public functions  */
 
@@ -2001,17 +2016,7 @@ gimp_layer_set_mode (GimpLayer            *layer,
       g_signal_emit (layer, layer_signals[MODE_CHANGED], 0);
       g_object_notify (G_OBJECT (layer), "mode");
 
-      if (layer->opacity_node)
-        {
-          GeglNode *mode_node;
-
-          mode_node = gimp_drawable_get_mode_node (GIMP_DRAWABLE (layer));
-
-          gegl_node_set (mode_node,
-                         "operation",  "gimp:point-layer-mode",
-                         "blend-mode", layer->mode,
-                         NULL);
-        }
+      gimp_layer_sync_mode_node (layer);
 
       gimp_drawable_update (GIMP_DRAWABLE (layer),
                             0, 0,



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