[gimp] app: remove GimpPickable::get_tiles()



commit 69893e4f72726775bffed6c1d877d639b74f6060
Author: Michael Natterer <mitch gimp org>
Date:   Sun May 6 01:01:54 2012 +0200

    app: remove GimpPickable::get_tiles()
    
    and change some legacy places to get their tiles from the buffer
    returned by GimpPickable::get_buffer().

 app/actions/debug-commands.c        |    4 +++-
 app/core/gimpdrawable.c             |    1 -
 app/core/gimpimagemap.c             |   19 ++-----------------
 app/core/gimppickable.c             |   15 ---------------
 app/core/gimppickable.h             |    2 --
 app/core/gimpprojection-construct.c |    8 ++++++--
 app/core/gimpprojection.c           |   12 +-----------
 app/tools/gimpiscissorstool.c       |    6 +++++-
 8 files changed, 17 insertions(+), 50 deletions(-)
---
diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c
index 78b0379..c34bc57 100644
--- a/app/actions/debug-commands.c
+++ b/app/actions/debug-commands.c
@@ -291,6 +291,7 @@ static gboolean
 debug_benchmark_projection (GimpImage *image)
 {
   GimpProjection *projection = gimp_image_get_projection (image);
+  GeglBuffer     *buffer;
   TileManager    *tiles;
   gint            x, y;
 
@@ -300,7 +301,8 @@ debug_benchmark_projection (GimpImage *image)
                          gimp_image_get_height (image));
   gimp_projection_flush_now (projection);
 
-  tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (projection));
+  buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (projection));
+  tiles = gimp_gegl_buffer_get_tiles (buffer);
 
   GIMP_TIMER_START ();
 
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 6dbdf0c..7c48f70 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -264,7 +264,6 @@ gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
   iface->get_format            = (const Babl    * (*) (GimpPickable *pickable)) gimp_drawable_get_format;
   iface->get_format_with_alpha = (const Babl    * (*) (GimpPickable *pickable)) gimp_drawable_get_format_with_alpha;
   iface->get_buffer            = (GeglBuffer    * (*) (GimpPickable *pickable)) gimp_drawable_get_buffer;
-  iface->get_tiles             = (TileManager   * (*) (GimpPickable *pickable)) gimp_drawable_get_tiles;
   iface->get_pixel_at          = gimp_drawable_get_pixel_at;
 }
 
diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c
index a2d9ddd..ef528e5 100644
--- a/app/core/gimpimagemap.c
+++ b/app/core/gimpimagemap.c
@@ -92,7 +92,6 @@ static const Babl    * gimp_image_map_get_format      (GimpPickable        *pick
 static const Babl    * gimp_image_map_get_format_with_alpha
                                                       (GimpPickable        *pickable);
 static GeglBuffer    * gimp_image_map_get_buffer      (GimpPickable        *pickable);
-static TileManager   * gimp_image_map_get_tiles       (GimpPickable        *pickable);
 static gboolean        gimp_image_map_get_pixel_at    (GimpPickable        *pickable,
                                                        gint                 x,
                                                        gint                 y,
@@ -143,7 +142,6 @@ gimp_image_map_pickable_iface_init (GimpPickableInterface *iface)
   iface->get_format            = gimp_image_map_get_format;
   iface->get_format_with_alpha = gimp_image_map_get_format_with_alpha;
   iface->get_buffer            = gimp_image_map_get_buffer;
-  iface->get_tiles             = gimp_image_map_get_tiles;
   iface->get_pixel_at          = gimp_image_map_get_pixel_at;
 }
 
@@ -266,17 +264,6 @@ gimp_image_map_get_buffer (GimpPickable *pickable)
   return gimp_pickable_get_buffer (GIMP_PICKABLE (image_map->drawable));
 }
 
-static TileManager *
-gimp_image_map_get_tiles (GimpPickable *pickable)
-{
-  GimpImageMap *image_map = GIMP_IMAGE_MAP (pickable);
-
-  if (image_map->undo_buffer)
-    return gimp_gegl_buffer_get_tiles (image_map->undo_buffer);
-
-  return gimp_pickable_get_tiles (GIMP_PICKABLE (image_map->drawable));
-}
-
 static gboolean
 gimp_image_map_get_pixel_at (GimpPickable *pickable,
                              gint          x,
@@ -365,7 +352,7 @@ gimp_image_map_apply (GimpImageMap        *image_map,
                                   &rect.width, &rect.height))
     return;
 
-  /*  If undo tiles don't exist, or change size, (re)allocate  */
+  /*  If undo buffer don't exist, or change size, (re)allocate  */
   gimp_image_map_update_undo_buffer (image_map, &rect);
 
   input_buffer  = image_map->undo_buffer;
@@ -589,18 +576,16 @@ gimp_image_map_update_undo_buffer (GimpImageMap        *image_map,
       undo_width    != rect->width ||
       undo_height   != rect->height)
     {
-      /* If either the extents changed or the tiles don't exist,
+      /* If either the extents changed or the buffer don't exist,
        * allocate new
        */
       if (! image_map->undo_buffer   ||
           undo_width  != rect->width ||
           undo_height != rect->height)
         {
-          /*  Destroy old tiles  */
           if (image_map->undo_buffer)
             g_object_unref (image_map->undo_buffer);
 
-          /*  Allocate new tiles  */
           image_map->undo_buffer =
             gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0,
                                                   rect->width, rect->height),
diff --git a/app/core/gimppickable.c b/app/core/gimppickable.c
index 2fe1ae9..f7e581b 100644
--- a/app/core/gimppickable.c
+++ b/app/core/gimppickable.c
@@ -137,21 +137,6 @@ gimp_pickable_get_buffer (GimpPickable *pickable)
   return NULL;
 }
 
-TileManager *
-gimp_pickable_get_tiles (GimpPickable *pickable)
-{
-  GimpPickableInterface *pickable_iface;
-
-  g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
-
-  pickable_iface = GIMP_PICKABLE_GET_INTERFACE (pickable);
-
-  if (pickable_iface->get_tiles)
-    return pickable_iface->get_tiles (pickable);
-
-  return NULL;
-}
-
 gboolean
 gimp_pickable_get_pixel_at (GimpPickable *pickable,
                             gint          x,
diff --git a/app/core/gimppickable.h b/app/core/gimppickable.h
index db174d4..9dff48c 100644
--- a/app/core/gimppickable.h
+++ b/app/core/gimppickable.h
@@ -40,7 +40,6 @@ struct _GimpPickableInterface
   const Babl    * (* get_format)            (GimpPickable *pickable);
   const Babl    * (* get_format_with_alpha) (GimpPickable *pickable);
   GeglBuffer    * (* get_buffer)            (GimpPickable *pickable);
-  TileManager   * (* get_tiles)             (GimpPickable *pickable);
   gboolean        (* get_pixel_at)          (GimpPickable *pickable,
                                              gint          x,
                                              gint          y,
@@ -59,7 +58,6 @@ GimpImage     * gimp_pickable_get_image             (GimpPickable *pickable);
 const Babl    * gimp_pickable_get_format            (GimpPickable *pickable);
 const Babl    * gimp_pickable_get_format_with_alpha (GimpPickable *pickable);
 GeglBuffer    * gimp_pickable_get_buffer            (GimpPickable *pickable);
-TileManager   * gimp_pickable_get_tiles             (GimpPickable *pickable);
 gboolean        gimp_pickable_get_pixel_at          (GimpPickable *pickable,
                                                      gint          x,
                                                      gint          y,
diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c
index e1f0167..332bc61 100644
--- a/app/core/gimpprojection-construct.c
+++ b/app/core/gimpprojection-construct.c
@@ -153,6 +153,7 @@ gimp_projection_construct_legacy (GimpProjection *proj,
   for (list = reverse_list; list; list = g_list_next (list))
     {
       GimpItem    *item = list->data;
+      GeglBuffer  *proj_buffer;
       PixelRegion  projPR;
       gint         x1, y1;
       gint         x2, y2;
@@ -173,8 +174,10 @@ gimp_projection_construct_legacy (GimpProjection *proj,
       x2 = CLAMP (off_x + gimp_item_get_width  (item), x, x + w);
       y2 = CLAMP (off_y + gimp_item_get_height (item), y, y + h);
 
+      proj_buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (proj));
+
       pixel_region_init (&projPR,
-                         gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
+                         gimp_gegl_buffer_get_tiles (proj_buffer),
                          x1, y1, x2 - x1, y2 - y1,
                          TRUE);
 
@@ -261,7 +264,8 @@ gimp_projection_initialize (GimpProjection *proj,
         }
       else
         {
-          TileManager *tiles  = gimp_pickable_get_tiles (GIMP_PICKABLE (proj));
+          GeglBuffer  *buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (proj));
+          TileManager *tiles  = gimp_gegl_buffer_get_tiles (buffer);
           const Babl  *format = gimp_pickable_get_format (GIMP_PICKABLE (proj));
 
           buffer = gimp_tile_manager_create_buffer (tiles, format);
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index ba8f8da..cfd6973 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -63,7 +63,6 @@ static void        gimp_projection_pickable_flush        (GimpPickable    *picka
 static GimpImage * gimp_projection_get_image             (GimpPickable    *pickable);
 static const Babl * gimp_projection_get_format           (GimpPickable    *pickable);
 static GeglBuffer  * gimp_projection_get_buffer          (GimpPickable    *pickable);
-static TileManager * gimp_projection_get_tiles           (GimpPickable    *pickable);
 static gboolean    gimp_projection_get_pixel_at          (GimpPickable    *pickable,
                                                           gint             x,
                                                           gint             y,
@@ -166,7 +165,6 @@ gimp_projection_pickable_iface_init (GimpPickableInterface *iface)
   iface->get_format            = gimp_projection_get_format;
   iface->get_format_with_alpha = gimp_projection_get_format; /* sic */
   iface->get_buffer            = gimp_projection_get_buffer;
-  iface->get_tiles             = gimp_projection_get_tiles;
   iface->get_pixel_at          = gimp_projection_get_pixel_at;
   iface->get_opacity_at        = gimp_projection_get_opacity_at;
 }
@@ -307,7 +305,7 @@ gimp_projection_get_buffer (GimpPickable *pickable)
 
   if (! proj->buffer)
     {
-      TileManager *tiles  = gimp_projection_get_tiles (pickable);
+      TileManager *tiles  = gimp_projection_get_tiles_at_level (proj, 0, NULL);
       const Babl  *format = gimp_projection_get_format (pickable);
 
       proj->buffer = gimp_tile_manager_create_buffer (tiles, format);
@@ -327,14 +325,6 @@ gimp_projection_get_buffer (GimpPickable *pickable)
   return proj->buffer;
 }
 
-static TileManager *
-gimp_projection_get_tiles (GimpPickable *pickable)
-{
-  return gimp_projection_get_tiles_at_level (GIMP_PROJECTION (pickable),
-                                             0, NULL);
-
-}
-
 static gboolean
 gimp_projection_get_pixel_at (GimpPickable *pickable,
                               gint          x,
diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c
index 68dffcd..12bf086 100644
--- a/app/tools/gimpiscissorstool.c
+++ b/app/tools/gimpiscissorstool.c
@@ -62,6 +62,8 @@
 
 #include "paint-funcs/paint-funcs.h"
 
+#include "gegl/gimp-gegl-utils.h"
+
 #include "core/gimpchannel.h"
 #include "core/gimpchannel-select.h"
 #include "core/gimpimage.h"
@@ -1651,6 +1653,7 @@ gradmap_tile_validate (TileManager *tm,
 
   GimpPickable *pickable;
   const Babl   *pickable_format;
+  GeglBuffer   *src_buffer;
   Tile         *srctile;
   PixelRegion   srcPR;
   PixelRegion   destPR;
@@ -1686,7 +1689,8 @@ gradmap_tile_validate (TileManager *tm,
   gimp_pickable_flush (pickable);
 
   /* get corresponding tile in the image */
-  srctile = tile_manager_get_tile (gimp_pickable_get_tiles (pickable),
+  src_buffer = gimp_pickable_get_buffer (pickable);
+  srctile = tile_manager_get_tile (gimp_gegl_buffer_get_tiles (src_buffer),
                                    x, y, TRUE, FALSE);
   if (! srctile)
     return;



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