[gimp/metadata-browser] app: remove GimpImageType based API and macro junk



commit 680a781263ea73cbb1c1731fbf66219a5dd0ba35
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 7 01:26:02 2012 +0200

    app: remove GimpImageType based API and macro junk

 app/core/gimpdrawable.c |   55 +++++++++++++++-------------------------------
 app/core/gimpdrawable.h |    3 --
 app/core/gimpimage.c    |   18 ---------------
 app/core/gimpimage.h    |   27 -----------------------
 4 files changed, 18 insertions(+), 85 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index e3d7599..dfc590e 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1665,36 +1665,43 @@ gimp_drawable_type_with_alpha (const GimpDrawable *drawable)
   return GIMP_IMAGE_TYPE_WITH_ALPHA (gimp_drawable_type (drawable));
 }
 
-GimpImageType
-gimp_drawable_type_without_alpha (const GimpDrawable *drawable)
-{
-  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
-
-  return GIMP_IMAGE_TYPE_WITHOUT_ALPHA (gimp_drawable_type (drawable));
-}
-
 gboolean
 gimp_drawable_is_rgb (const GimpDrawable *drawable)
 {
+  GimpImageType type;
+
   g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
 
-  return GIMP_IMAGE_TYPE_IS_RGB (gimp_drawable_type (drawable));
+  type = gimp_drawable_type (drawable);
+
+  return (type == GIMP_RGB_IMAGE ||
+          type == GIMP_RGBA_IMAGE);
 }
 
 gboolean
 gimp_drawable_is_gray (const GimpDrawable *drawable)
 {
+  GimpImageType type;
+
   g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
 
-  return GIMP_IMAGE_TYPE_IS_GRAY (gimp_drawable_type (drawable));
+  type = gimp_drawable_type (drawable);
+
+  return (type == GIMP_GRAY_IMAGE ||
+          type == GIMP_GRAYA_IMAGE);
 }
 
 gboolean
 gimp_drawable_is_indexed (const GimpDrawable *drawable)
 {
+  GimpImageType type;
+
   g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
 
-  return GIMP_IMAGE_TYPE_IS_INDEXED (gimp_drawable_type (drawable));
+  type = gimp_drawable_type (drawable);
+
+  return (type == GIMP_INDEXED_IMAGE ||
+          type == GIMP_INDEXEDA_IMAGE);
 }
 
 gint
@@ -1709,32 +1716,6 @@ gimp_drawable_bytes (const GimpDrawable *drawable)
   return babl_format_get_bytes_per_pixel (format);
 }
 
-gint
-gimp_drawable_bytes_with_alpha (const GimpDrawable *drawable)
-{
-  const Babl *format;
-
-  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
-
-  format = gimp_image_get_format_with_alpha (gimp_item_get_image (GIMP_ITEM (drawable)),
-                                             gimp_drawable_type (drawable));
-
-  return babl_format_get_bytes_per_pixel (format);
-}
-
-gint
-gimp_drawable_bytes_without_alpha (const GimpDrawable *drawable)
-{
-  const Babl *format;
-
-  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
-
-  format = gimp_image_get_format_without_alpha (gimp_item_get_image (GIMP_ITEM (drawable)),
-                                                gimp_drawable_type (drawable));
-
-  return babl_format_get_bytes_per_pixel (format);
-}
-
 const guchar *
 gimp_drawable_get_colormap (const GimpDrawable *drawable)
 {
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index fe52a41..40055c1 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -226,13 +226,10 @@ const Babl    * gimp_drawable_get_format_without_alpha
 gboolean        gimp_drawable_has_alpha          (const GimpDrawable *drawable);
 GimpImageType   gimp_drawable_type               (const GimpDrawable *drawable);
 GimpImageType   gimp_drawable_type_with_alpha    (const GimpDrawable *drawable);
-GimpImageType   gimp_drawable_type_without_alpha (const GimpDrawable *drawable);
 gboolean        gimp_drawable_is_rgb             (const GimpDrawable *drawable);
 gboolean        gimp_drawable_is_gray            (const GimpDrawable *drawable);
 gboolean        gimp_drawable_is_indexed         (const GimpDrawable *drawable);
 gint            gimp_drawable_bytes              (const GimpDrawable *drawable);
-gint            gimp_drawable_bytes_with_alpha   (const GimpDrawable *drawable);
-gint            gimp_drawable_bytes_without_alpha(const GimpDrawable *drawable);
 
 const guchar  * gimp_drawable_get_colormap       (const GimpDrawable *drawable);
 
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 50b0de0..95e51e6 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1468,24 +1468,6 @@ gimp_image_base_type (const GimpImage *image)
   return GIMP_IMAGE_GET_PRIVATE (image)->base_type;
 }
 
-GimpImageType
-gimp_image_base_type_with_alpha (const GimpImage *image)
-{
-  g_return_val_if_fail (GIMP_IS_IMAGE (image), -1);
-
-  switch (GIMP_IMAGE_GET_PRIVATE (image)->base_type)
-    {
-    case GIMP_RGB:
-      return GIMP_RGBA_IMAGE;
-    case GIMP_GRAY:
-      return GIMP_GRAYA_IMAGE;
-    case GIMP_INDEXED:
-      return GIMP_INDEXEDA_IMAGE;
-    }
-
-  return GIMP_RGB_IMAGE;
-}
-
 CombinationMode
 gimp_image_get_combination_mode (GimpImageType dest_type,
                                  gint          src_bytes)
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 5fdf9f8..9c9064b 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -22,17 +22,6 @@
 #include "gimpviewable.h"
 
 
-#define GIMP_IMAGE_TYPE_IS_RGB(t)          ((t) == GIMP_RGB_IMAGE ||         \
-                                            (t) == GIMP_RGBA_IMAGE)
-#define GIMP_IMAGE_TYPE_IS_GRAY(t)         ((t) == GIMP_GRAY_IMAGE ||        \
-                                            (t) == GIMP_GRAYA_IMAGE)
-#define GIMP_IMAGE_TYPE_IS_INDEXED(t)      ((t) == GIMP_INDEXED_IMAGE ||     \
-                                            (t) == GIMP_INDEXEDA_IMAGE)
-
-#define GIMP_IMAGE_TYPE_HAS_ALPHA(t)       ((t) == GIMP_RGBA_IMAGE  ||       \
-                                            (t) == GIMP_GRAYA_IMAGE ||       \
-                                            (t) == GIMP_INDEXEDA_IMAGE)
-
 #define GIMP_IMAGE_TYPE_WITH_ALPHA(t)     (((t) == GIMP_RGB_IMAGE ||         \
                                             (t) == GIMP_RGBA_IMAGE) ?        \
                                            GIMP_RGBA_IMAGE :                 \
@@ -42,21 +31,6 @@
                                            ((t) == GIMP_INDEXED_IMAGE ||     \
                                             (t) == GIMP_INDEXEDA_IMAGE) ?    \
                                            GIMP_INDEXEDA_IMAGE : -1)
-#define GIMP_IMAGE_TYPE_WITHOUT_ALPHA(t)  (((t) == GIMP_RGB_IMAGE ||         \
-                                            (t) == GIMP_RGBA_IMAGE) ?        \
-                                           GIMP_RGB_IMAGE :                  \
-                                           ((t) == GIMP_GRAY_IMAGE ||        \
-                                            (t) == GIMP_GRAYA_IMAGE) ?       \
-                                           GIMP_GRAY_IMAGE :                 \
-                                           ((t) == GIMP_INDEXED_IMAGE ||     \
-                                            (t) == GIMP_INDEXEDA_IMAGE) ?    \
-                                           GIMP_INDEXED_IMAGE : -1)
-#define GIMP_IMAGE_TYPE_BYTES(t)           ((t) == GIMP_RGBA_IMAGE     ? 4 : \
-                                            (t) == GIMP_RGB_IMAGE      ? 3 : \
-                                            (t) == GIMP_GRAYA_IMAGE    ? 2 : \
-                                            (t) == GIMP_GRAY_IMAGE     ? 1 : \
-                                            (t) == GIMP_INDEXEDA_IMAGE ? 2 : \
-                                            (t) == GIMP_INDEXED_IMAGE  ? 1 : -1)
 #define GIMP_IMAGE_TYPE_FROM_BYTES(b)      ((b) == 4 ? GIMP_RGBA_IMAGE  :    \
                                             (b) == 3 ? GIMP_RGB_IMAGE   :    \
                                             (b) == 2 ? GIMP_GRAYA_IMAGE :    \
@@ -166,7 +140,6 @@ GimpImage     * gimp_image_new                   (Gimp               *gimp,
                                                   GimpImageBaseType   base_type);
 
 GimpImageBaseType  gimp_image_base_type            (const GimpImage  *image);
-GimpImageType      gimp_image_base_type_with_alpha (const GimpImage  *image);
 CombinationMode    gimp_image_get_combination_mode (GimpImageType     dest_type,
                                                     gint              src_bytes);
 



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