[gimp/goat-invasion: 6/608] app: move new get_buffer() functions around; some general cleanup



commit 7d93abd1829ff7dc4a7033501fe97c9d4b25ef36
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 13 19:37:06 2012 +0100

    app: move new get_buffer() functions around; some general cleanup

 app/core/gimpdrawable-operation.c     |    6 +++---
 app/core/gimpdrawable.c               |   10 ++++++++++
 app/core/gimpdrawable.h               |    2 ++
 app/core/gimpimagemap.c               |   13 +++++++------
 app/gegl/gimp-gegl-utils.c            |   15 +++++++++++++++
 app/gegl/gimp-gegl-utils.h            |    3 +++
 app/gegl/gimptilebackendtilemanager.c |   22 ----------------------
 app/gegl/gimptilebackendtilemanager.h |   11 +++++------
 8 files changed, 45 insertions(+), 37 deletions(-)
---
diff --git a/app/core/gimpdrawable-operation.c b/app/core/gimpdrawable-operation.c
index b904efe..72d071b 100644
--- a/app/core/gimpdrawable-operation.c
+++ b/app/core/gimpdrawable-operation.c
@@ -28,8 +28,7 @@
 
 #include "base/tile-manager.h"
 
-#include "gegl/gimptilebackendtilemanager.h"
-
+#include "gegl/gimp-gegl-utils.h"
 
 #include "gimpdrawable.h"
 #include "gimpdrawable-operation.h"
@@ -148,8 +147,9 @@ gimp_drawable_apply_operation_private (GimpDrawable       *drawable,
                 "dont-cache", TRUE,
                 NULL);
 
-  inbuf = gimp_drawable_get_gegl_buffer (drawable, FALSE);
+  inbuf  = gimp_drawable_get_buffer (drawable, FALSE);
   outbuf = gimp_tile_manager_get_gegl_buffer (dest_tiles, TRUE);
+
   input  = gegl_node_new_child (gegl,
                                 "operation",    "buffer-source",
                                 "buffer", inbuf,
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index ab341b3..3b95c8e 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1456,6 +1456,16 @@ gimp_drawable_init_src_region (GimpDrawable  *drawable,
   *temp_tiles = NULL;
 }
 
+GeglBuffer *
+gimp_drawable_get_buffer (GimpDrawable *drawable,
+                          gboolean      write)
+{
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+
+  return gimp_tile_manager_get_gegl_buffer (gimp_drawable_get_tiles (drawable),
+                                            write);
+}
+
 TileManager *
 gimp_drawable_get_tiles (GimpDrawable *drawable)
 {
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index 3bb5d14..2163121 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -178,6 +178,8 @@ void            gimp_drawable_init_src_region    (GimpDrawable       *drawable,
                                                   gint                height,
                                                   TileManager       **temp_tiles);
 
+GeglBuffer    * gimp_drawable_get_buffer         (GimpDrawable       *drawable,
+                                                  gboolean            write);
 TileManager   * gimp_drawable_get_tiles          (GimpDrawable       *drawable);
 void            gimp_drawable_set_tiles          (GimpDrawable       *drawable,
                                                   gboolean            push_undo,
diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c
index d890b8c..a86acbe 100644
--- a/app/core/gimpimagemap.c
+++ b/app/core/gimpimagemap.c
@@ -44,7 +44,7 @@
 
 #include "paint-funcs/paint-funcs.h"
 
-#include "gegl/gimptilebackendtilemanager.h"
+#include "gegl/gimp-gegl-utils.h"
 
 #include "gimpdrawable.h"
 #include "gimpdrawable-shadow.h"
@@ -803,12 +803,13 @@ gimp_image_map_data_written (GObject             *operation,
                              const GeglRectangle *extent,
                              GimpImageMap        *image_map)
 {
-  PixelRegion srcPR;
-  PixelRegion destPR;
+  GimpImage   *image;
+  PixelRegion  srcPR;
+  PixelRegion  destPR;
 
-  if (!gimp_channel_is_empty (
-         gimp_image_get_mask (
-           gimp_item_get_image (GIMP_ITEM (image_map->drawable)))))
+  image = gimp_item_get_image (GIMP_ITEM (image_map->drawable));
+
+  if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
     {
       /* Reset to initial drawable conditions. */
       pixel_region_init (&srcPR, image_map->undo_tiles,
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index 55c5d66..314a2e9 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -27,6 +27,7 @@
 #include "base/tile-manager.h"
 
 #include "gimp-gegl-utils.h"
+#include "gimptilebackendtilemanager.h"
 
 
 /**
@@ -168,3 +169,17 @@ gimp_interpolation_to_gegl_filter (GimpInterpolationType interpolation)
 
   return "nearest";
 }
+
+GeglBuffer *
+gimp_tile_manager_get_gegl_buffer (TileManager *tm,
+                                   gboolean     write)
+{
+  GeglTileBackend *backend;
+  GeglBuffer      *buffer;
+
+  backend = gimp_tile_backend_tile_manager_new (tm, write);
+  buffer = gegl_buffer_new_for_backend (NULL, backend);
+  g_object_unref (backend);
+
+  return buffer;
+}
diff --git a/app/gegl/gimp-gegl-utils.h b/app/gegl/gimp-gegl-utils.h
index 6c2fd09..cff7710 100644
--- a/app/gegl/gimp-gegl-utils.h
+++ b/app/gegl/gimp-gegl-utils.h
@@ -30,5 +30,8 @@ TileManager * gimp_buffer_to_tiles              (GeglBuffer            *buffer);
 const gchar * gimp_layer_mode_to_gegl_operation (GimpLayerModeEffects   mode) G_GNUC_CONST;
 const gchar * gimp_interpolation_to_gegl_filter (GimpInterpolationType  interpolation) G_GNUC_CONST;
 
+GeglBuffer  * gimp_tile_manager_get_gegl_buffer (TileManager           *tm,
+                                                 gboolean               write);
+
 
 #endif /* __GIMP_GEGL_UTILS_H__ */
diff --git a/app/gegl/gimptilebackendtilemanager.c b/app/gegl/gimptilebackendtilemanager.c
index 3cb938f..b83968d 100644
--- a/app/gegl/gimptilebackendtilemanager.c
+++ b/app/gegl/gimptilebackendtilemanager.c
@@ -258,25 +258,3 @@ gimp_tile_backend_tile_manager_new (TileManager *tm,
 
   return ret;
 }
-
-GeglBuffer *
-gimp_tile_manager_get_gegl_buffer (TileManager *tm,
-                                   gboolean     write)
-{
-  GeglTileBackend *backend;
-  GeglBuffer      *buffer;
-
-  backend = gimp_tile_backend_tile_manager_new (tm, write);
-  buffer = gegl_buffer_new_for_backend (NULL, backend);
-  g_object_unref (backend);
-
-  return buffer;
-}
-
-GeglBuffer *
-gimp_drawable_get_gegl_buffer (GimpDrawable *drawable,
-                               gboolean      write)
-{
-  return gimp_tile_manager_get_gegl_buffer (gimp_drawable_get_tiles (drawable), write);
-}
-
diff --git a/app/gegl/gimptilebackendtilemanager.h b/app/gegl/gimptilebackendtilemanager.h
index a3302ec..12e97d5 100644
--- a/app/gegl/gimptilebackendtilemanager.h
+++ b/app/gegl/gimptilebackendtilemanager.h
@@ -25,6 +25,7 @@
 
 G_BEGIN_DECLS
 
+
 #define GIMP_TYPE_TILE_BACKEND_TILE_MANAGER            (gimp_tile_backend_tile_manager_get_type ())
 #define GIMP_TILE_BACKEND_TILE_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TILE_BACKEND_TILE_MANAGER, GimpTileBackendTileManager))
 #define GIMP_TILE_BACKEND_TILE_MANAGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_TILE_BACKEND_TILE_MANAGER, GimpTileBackendTileManagerClass))
@@ -32,6 +33,7 @@ G_BEGIN_DECLS
 #define GIMP_IS_TILE_BACKEND_TILE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GIMP_TYPE_TILE_BACKEND_TILE_MANAGER))
 #define GIMP_TILE_BACKEND_TILE_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GIMP_TYPE_TILE_BACKEND_TILE_MANAGER, GimpTileBackendTileManagerClass))
 
+
 typedef struct _GimpTileBackendTileManagerClass   GimpTileBackendTileManagerClass;
 typedef struct _GimpTileBackendTileManagerPrivate GimpTileBackendTileManagerPrivate;
 
@@ -47,15 +49,12 @@ struct _GimpTileBackendTileManagerClass
   GeglTileBackendClass parent_class;
 };
 
+
 GType             gimp_tile_backend_tile_manager_get_type (void) G_GNUC_CONST;
 
-GeglTileBackend * gimp_tile_backend_tile_manager_new (TileManager *tm,
-                                                      gboolean     write);
+GeglTileBackend * gimp_tile_backend_tile_manager_new      (TileManager *tm,
+                                                           gboolean     write);
 
-GeglBuffer      * gimp_tile_manager_get_gegl_buffer  (TileManager  *tm,
-                                                      gboolean      write);
-GeglBuffer      * gimp_drawable_get_gegl_buffer      (GimpDrawable *drawable,
-                                                      gboolean      write);
 
 G_END_DECLS
 



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