[gimp/gimp-2-10] app: some changes to GimpBrushPipe in preparation for .git image loading



commit 45d3a054a4d8941d5b620e07244fbf05c7d76283
Author: Michael Natterer <mitch gimp org>
Date:   Tue Feb 19 23:24:41 2019 +0100

    app: some changes to GimpBrushPipe in preparation for .git image loading
    
    - don't clear the names of the individual brushes, we need them for
      a load -> save roundtrip
    - for the same reason, and for convenience, store the parameter string
      in the object
    - clean up gimp_brush_pipe_finalize()
    
    (cherry picked from commit 4b456e60792619663010f892a294aa7a8080fc79)

 app/core/gimpbrushpipe-load.c |  9 +++------
 app/core/gimpbrushpipe.c      | 26 +++++---------------------
 app/core/gimpbrushpipe.h      |  2 ++
 3 files changed, 10 insertions(+), 27 deletions(-)
---
diff --git a/app/core/gimpbrushpipe-load.c b/app/core/gimpbrushpipe-load.c
index 95c6a19d7b..1c6612d8be 100644
--- a/app/core/gimpbrushpipe-load.c
+++ b/app/core/gimpbrushpipe-load.c
@@ -158,6 +158,8 @@ gimp_brush_pipe_load (GimpContext   *context,
         }
 
       gimp_pixpipe_params_free (&params);
+
+      pipe->params = g_strdup (paramstring);
     }
   else
     {
@@ -193,12 +195,7 @@ gimp_brush_pipe_load (GimpContext   *context,
                                                               file, input,
                                                               error);
 
-      if (pipe->brushes[pipe->n_brushes])
-        {
-          gimp_object_set_name (GIMP_OBJECT (pipe->brushes[pipe->n_brushes]),
-                                NULL);
-        }
-      else
+      if (! pipe->brushes[pipe->n_brushes])
         {
           g_object_unref (pipe);
           return NULL;
diff --git a/app/core/gimpbrushpipe.c b/app/core/gimpbrushpipe.c
index 805ca4b687..75e54cf0c9 100644
--- a/app/core/gimpbrushpipe.c
+++ b/app/core/gimpbrushpipe.c
@@ -99,16 +99,11 @@ gimp_brush_pipe_finalize (GObject *object)
 {
   GimpBrushPipe *pipe = GIMP_BRUSH_PIPE (object);
 
-  if (pipe->rank)
-    {
-      g_free (pipe->rank);
-      pipe->rank = NULL;
-    }
-  if (pipe->stride)
-    {
-      g_free (pipe->stride);
-      pipe->stride = NULL;
-    }
+  g_clear_pointer (&pipe->rank,   g_free);
+  g_clear_pointer (&pipe->stride, g_free);
+  g_clear_pointer (&pipe->select, g_free);
+  g_clear_pointer (&pipe->index,  g_free);
+  g_clear_pointer (&pipe->params, g_free);
 
   if (pipe->brushes)
     {
@@ -122,17 +117,6 @@ gimp_brush_pipe_finalize (GObject *object)
       pipe->brushes = NULL;
     }
 
-  if (pipe->select)
-    {
-      g_free (pipe->select);
-      pipe->select = NULL;
-    }
-  if (pipe->index)
-    {
-      g_free (pipe->index);
-      pipe->index = NULL;
-    }
-
   GIMP_BRUSH (pipe)->priv->mask   = NULL;
   GIMP_BRUSH (pipe)->priv->pixmap = NULL;
 
diff --git a/app/core/gimpbrushpipe.h b/app/core/gimpbrushpipe.h
index 4f18518af9..0f27fa70f5 100644
--- a/app/core/gimpbrushpipe.h
+++ b/app/core/gimpbrushpipe.h
@@ -61,6 +61,8 @@ struct _GimpBrushPipe
                                  * ranks in some odd special case */
   GimpBrush       **brushes;
   GimpBrush        *current;    /* Currently selected brush */
+
+  gchar            *params;     /* For pipe <-> image conversion */
 };
 
 struct _GimpBrushPipeClass


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