[gimp/goat-invasion: 313/401] app: remove GimpPickable::get_image_type()



commit 74728fec2de976121212d554ab6fc079cf76488e
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 29 20:40:40 2012 +0200

    app: remove GimpPickable::get_image_type()

 app/core/gimpdrawable.c   |    1 -
 app/core/gimpimagemap.c   |   10 ----------
 app/core/gimppickable.c   |   15 ---------------
 app/core/gimppickable.h   |    2 --
 app/core/gimpprojection.c |   29 +++--------------------------
 5 files changed, 3 insertions(+), 54 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 678cbae..6ed68f2 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_image_type        = (GimpImageType   (*) (GimpPickable *pickable)) gimp_drawable_type;
   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;
diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c
index fb3ea54..6efd3ee 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 GimpImageType   gimp_image_map_get_image_type  (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);
@@ -143,7 +142,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_image_type        = gimp_image_map_get_image_type;
   iface->get_bytes             = gimp_image_map_get_bytes;
   iface->get_buffer            = gimp_image_map_get_buffer;
   iface->get_tiles             = gimp_image_map_get_tiles;
@@ -258,14 +256,6 @@ gimp_image_map_get_format_with_alpha (GimpPickable *pickable)
   return gimp_pickable_get_format_with_alpha (GIMP_PICKABLE (image_map->drawable));
 }
 
-static GimpImageType
-gimp_image_map_get_image_type (GimpPickable *pickable)
-{
-  GimpImageMap *image_map = GIMP_IMAGE_MAP (pickable);
-
-  return gimp_pickable_get_image_type (GIMP_PICKABLE (image_map->drawable));
-}
-
 static gint
 gimp_image_map_get_bytes (GimpPickable *pickable)
 {
diff --git a/app/core/gimppickable.c b/app/core/gimppickable.c
index d5a5b27..fec11ce 100644
--- a/app/core/gimppickable.c
+++ b/app/core/gimppickable.c
@@ -91,21 +91,6 @@ gimp_pickable_get_image (GimpPickable *pickable)
   return NULL;
 }
 
-GimpImageType
-gimp_pickable_get_image_type (GimpPickable *pickable)
-{
-  GimpPickableInterface *pickable_iface;
-
-  g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), -1);
-
-  pickable_iface = GIMP_PICKABLE_GET_INTERFACE (pickable);
-
-  if (pickable_iface->get_image_type)
-    return pickable_iface->get_image_type (pickable);
-
-  return -1;
-}
-
 const Babl *
 gimp_pickable_get_format (GimpPickable *pickable)
 {
diff --git a/app/core/gimppickable.h b/app/core/gimppickable.h
index c757d83..5050786 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);
-  GimpImageType   (* get_image_type)        (GimpPickable *pickable);
   gint            (* get_bytes)             (GimpPickable *pickable);
   GeglBuffer    * (* get_buffer)            (GimpPickable *pickable);
   TileManager   * (* get_tiles)             (GimpPickable *pickable);
@@ -59,7 +58,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);
-GimpImageType   gimp_pickable_get_image_type        (GimpPickable *pickable);
 gint            gimp_pickable_get_bytes             (GimpPickable *pickable);
 GeglBuffer    * gimp_pickable_get_buffer            (GimpPickable *pickable);
 TileManager   * gimp_pickable_get_tiles             (GimpPickable *pickable);
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index c06bea2..57c0de4 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 GimpImageType gimp_projection_get_image_type      (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);
@@ -166,7 +165,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_image_type        = gimp_projection_get_image_type;
   iface->get_bytes             = gimp_projection_get_bytes;
   iface->get_buffer            = gimp_projection_get_buffer;
   iface->get_tiles             = gimp_projection_get_tiles;
@@ -318,33 +316,12 @@ gimp_projection_get_format (GimpPickable *pickable)
   return NULL;
 }
 
-static GimpImageType
-gimp_projection_get_image_type (GimpPickable *pickable)
-{
-  GimpProjection *proj = GIMP_PROJECTION (pickable);
-  GimpImageType   type;
-
-  type = gimp_projectable_get_image_type (proj->projectable);
-
-  switch (GIMP_IMAGE_TYPE_BASE_TYPE (type))
-    {
-    case GIMP_RGB:
-    case GIMP_INDEXED:
-      return GIMP_RGBA_IMAGE;
-
-    case GIMP_GRAY:
-      return GIMP_GRAYA_IMAGE;
-    }
-
-  g_assert_not_reached ();
-
-  return 0;
-}
-
 static gint
 gimp_projection_get_bytes (GimpPickable *pickable)
 {
-  return GIMP_IMAGE_TYPE_BYTES (gimp_projection_get_image_type (pickable));
+  const Babl *format = gimp_projection_get_format (pickable);
+
+  return babl_format_get_bytes_per_pixel (format);
 }
 
 static GeglBuffer *



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