[gimp/goat-invasion: 314/401] app: remove GimpPickable::get_bytes()



commit ee607ac5fe4b4b04b5fb6397a1aa8636ce1d7a0c
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 29 20:51:51 2012 +0200

    app: remove GimpPickable::get_bytes()

 app/core/gimpdrawable.c       |    1 -
 app/core/gimpimagemap.c       |   10 ----------
 app/core/gimppickable.c       |   15 ---------------
 app/core/gimppickable.h       |    2 --
 app/core/gimpprojection.c     |   21 +++++++--------------
 app/paint/gimppaintcore.c     |    5 ++++-
 app/tools/gimpiscissorstool.c |    7 +++++--
 7 files changed, 16 insertions(+), 45 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 6ed68f2..7c56574 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -261,7 +261,6 @@ gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
   iface->get_image             = (GimpImage     * (*) (GimpPickable *pickable)) gimp_item_get_image;
   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_bytes             = (gint            (*) (GimpPickable *pickable)) gimp_drawable_bytes;
   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 6efd3ee..1d85d06 100644
--- a/app/core/gimpimagemap.c
+++ b/app/core/gimpimagemap.c
@@ -91,7 +91,6 @@ static GimpImage     * gimp_image_map_get_image       (GimpPickable        *pick
 static const Babl    * gimp_image_map_get_format      (GimpPickable        *pickable);
 static const Babl    * gimp_image_map_get_format_with_alpha
                                                       (GimpPickable        *pickable);
-static gint            gimp_image_map_get_bytes       (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,
@@ -142,7 +141,6 @@ gimp_image_map_pickable_iface_init (GimpPickableInterface *iface)
   iface->get_image             = gimp_image_map_get_image;
   iface->get_format            = gimp_image_map_get_format;
   iface->get_format_with_alpha = gimp_image_map_get_format_with_alpha;
-  iface->get_bytes             = gimp_image_map_get_bytes;
   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;
@@ -256,14 +254,6 @@ gimp_image_map_get_format_with_alpha (GimpPickable *pickable)
   return gimp_pickable_get_format_with_alpha (GIMP_PICKABLE (image_map->drawable));
 }
 
-static gint
-gimp_image_map_get_bytes (GimpPickable *pickable)
-{
-  GimpImageMap *image_map = GIMP_IMAGE_MAP (pickable);
-
-  return gimp_pickable_get_bytes (GIMP_PICKABLE (image_map->drawable));
-}
-
 static GeglBuffer *
 gimp_image_map_get_buffer (GimpPickable *pickable)
 {
diff --git a/app/core/gimppickable.c b/app/core/gimppickable.c
index fec11ce..78c2209 100644
--- a/app/core/gimppickable.c
+++ b/app/core/gimppickable.c
@@ -121,21 +121,6 @@ gimp_pickable_get_format_with_alpha (GimpPickable *pickable)
   return NULL;
 }
 
-gint
-gimp_pickable_get_bytes (GimpPickable *pickable)
-{
-  GimpPickableInterface *pickable_iface;
-
-  g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), 0);
-
-  pickable_iface = GIMP_PICKABLE_GET_INTERFACE (pickable);
-
-  if (pickable_iface->get_bytes)
-    return pickable_iface->get_bytes (pickable);
-
-  return 0;
-}
-
 GeglBuffer *
 gimp_pickable_get_buffer (GimpPickable *pickable)
 {
diff --git a/app/core/gimppickable.h b/app/core/gimppickable.h
index 5050786..2477bd5 100644
--- a/app/core/gimppickable.h
+++ b/app/core/gimppickable.h
@@ -39,7 +39,6 @@ struct _GimpPickableInterface
   GimpImage     * (* get_image)             (GimpPickable *pickable);
   const Babl    * (* get_format)            (GimpPickable *pickable);
   const Babl    * (* get_format_with_alpha) (GimpPickable *pickable);
-  gint            (* get_bytes)             (GimpPickable *pickable);
   GeglBuffer    * (* get_buffer)            (GimpPickable *pickable);
   TileManager   * (* get_tiles)             (GimpPickable *pickable);
   gboolean        (* get_pixel_at)          (GimpPickable *pickable,
@@ -58,7 +57,6 @@ void            gimp_pickable_flush                 (GimpPickable *pickable);
 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);
-gint            gimp_pickable_get_bytes             (GimpPickable *pickable);
 GeglBuffer    * gimp_pickable_get_buffer            (GimpPickable *pickable);
 TileManager   * gimp_pickable_get_tiles             (GimpPickable *pickable);
 gboolean        gimp_pickable_get_pixel_at          (GimpPickable *pickable,
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 57c0de4..1da3223 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -62,7 +62,6 @@ static gint64      gimp_projection_get_memsize           (GimpObject      *objec
 static void        gimp_projection_pickable_flush        (GimpPickable    *pickable);
 static GimpImage * gimp_projection_get_image             (GimpPickable    *pickable);
 static const Babl * gimp_projection_get_format           (GimpPickable    *pickable);
-static gint        gimp_projection_get_bytes             (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,
@@ -165,7 +164,6 @@ gimp_projection_pickable_iface_init (GimpPickableInterface *iface)
   iface->get_image             = gimp_projection_get_image;
   iface->get_format            = gimp_projection_get_format;
   iface->get_format_with_alpha = gimp_projection_get_format; /* sic */
-  iface->get_bytes             = gimp_projection_get_bytes;
   iface->get_buffer            = gimp_projection_get_buffer;
   iface->get_tiles             = gimp_projection_get_tiles;
   iface->get_pixel_at          = gimp_projection_get_pixel_at;
@@ -316,14 +314,6 @@ gimp_projection_get_format (GimpPickable *pickable)
   return NULL;
 }
 
-static gint
-gimp_projection_get_bytes (GimpPickable *pickable)
-{
-  const Babl *format = gimp_projection_get_format (pickable);
-
-  return babl_format_get_bytes_per_pixel (format);
-}
-
 static GeglBuffer *
 gimp_projection_get_buffer (GimpPickable *pickable)
 {
@@ -454,11 +444,14 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
 
   if (! proj->pyramid)
     {
-      gint bytes;
-      gint width;
-      gint height;
+      const Babl *format;
+      gint        bytes;
+      gint        width;
+      gint        height;
+
+      format = gimp_projection_get_format (GIMP_PICKABLE (proj));
 
-      bytes = gimp_projection_get_bytes (GIMP_PICKABLE (proj));
+      bytes = babl_format_get_bytes_per_pixel (format);
       gimp_projectable_get_size (proj->projectable, &width, &height);
 
       proj->pyramid = tile_pyramid_new (bytes, width, height);
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index 948ea68..74ddb98 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -769,6 +769,7 @@ gimp_paint_core_get_orig_proj (GimpPaintCore *core,
   gboolean      release_tile;
   gint          h;
   gint          pixelwidth;
+  const Babl   *pickable_format;
   gint          pickable_width;
   gint          pickable_height;
   const guchar *s;
@@ -779,8 +780,10 @@ gimp_paint_core_get_orig_proj (GimpPaintCore *core,
   g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
   g_return_val_if_fail (core->saved_proj_tiles != NULL, NULL);
 
+  pickable_format = gimp_pickable_get_format (pickable);
+
   core->orig_proj_buf = temp_buf_resize (core->orig_proj_buf,
-                                         gimp_pickable_get_bytes (pickable),
+                                         babl_format_get_bytes_per_pixel (pickable_format),
                                          x, y, width, height);
 
   src_tiles = gimp_pickable_get_tiles (pickable);
diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c
index e33a633..bc0684f 100644
--- a/app/tools/gimpiscissorstool.c
+++ b/app/tools/gimpiscissorstool.c
@@ -1647,6 +1647,7 @@ gradmap_tile_validate (TileManager *tm,
   static gboolean first_gradient = TRUE;
 
   GimpPickable *pickable;
+  const Babl   *pickable_format;
   Tile         *srctile;
   PixelRegion   srcPR;
   PixelRegion   destPR;
@@ -1690,10 +1691,12 @@ gradmap_tile_validate (TileManager *tm,
   sw = tile_ewidth (srctile);
   sh = tile_eheight (srctile);
 
+  pickable_format = gimp_pickable_get_format (pickable);
+
   pixel_region_init_data (&srcPR,
                           tile_data_pointer (srctile, 0, 0),
-                          gimp_pickable_get_bytes (pickable),
-                          gimp_pickable_get_bytes (pickable) *
+                          babl_format_get_bytes_per_pixel (pickable_format),
+                          babl_format_get_bytes_per_pixel (pickable_format) *
                           MIN (dw, sw),
                           0, 0, MIN (dw, sw), MIN (dh, sh));
 



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