[gimp/goat-invasion: 306/418] app: more GimpImageType -> Babl



commit 45ed6c50547487f555236d00e6b20a2f78812afd
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 29 09:44:10 2012 +0200

    app: more GimpImageType -> Babl

 app/core/gimpimage-crop.c        |    8 ++++----
 app/paint/gimpheal.c             |   13 +++++++------
 app/paint/gimpperspectiveclone.c |    8 ++++----
 3 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/app/core/gimpimage-crop.c b/app/core/gimpimage-crop.c
index 133aaa1..086849f 100644
--- a/app/core/gimpimage-crop.c
+++ b/app/core/gimpimage-crop.c
@@ -313,7 +313,7 @@ gimp_image_crop_auto_shrink (GimpImage *image,
   gboolean         has_alpha;
   guchar          *buf = NULL;
   gint             width, height;
-  GimpImageType    type;
+  const Babl      *format;
   gint             bytes;
   gint             x, y, abort;
   gboolean         retval = FALSE;
@@ -349,9 +349,9 @@ gimp_image_crop_auto_shrink (GimpImage *image,
 
   gimp_pickable_flush (pickable);
 
-  type      = gimp_pickable_get_image_type (pickable);
-  bytes     = GIMP_IMAGE_TYPE_BYTES (type);
-  has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
+  format    = gimp_pickable_get_format (pickable);
+  bytes     = babl_format_get_bytes_per_pixel (format);
+  has_alpha = babl_format_has_alpha (format);
 
   switch (gimp_image_crop_guess_bgcolor (pickable,
                                          bytes, has_alpha, bgcolor,
diff --git a/app/paint/gimpheal.c b/app/paint/gimpheal.c
index da38b3b..422bfb8 100644
--- a/app/paint/gimpheal.c
+++ b/app/paint/gimpheal.c
@@ -459,7 +459,8 @@ gimp_heal_motion (GimpSourceCore   *source_core,
   PixelRegion         origPR;
   PixelRegion         tempPR;
   PixelRegion         destPR;
-  GimpImageType       src_type;
+  const Babl         *format;
+  const Babl         *format_alpha;
   const TempBuf      *mask_buf;
   gdouble             fade_point;
   gdouble             hardness;
@@ -480,11 +481,12 @@ gimp_heal_motion (GimpSourceCore   *source_core,
                                              GIMP_BRUSH_HARD,
                                              hardness);
 
-  src_type = gimp_pickable_get_image_type (src_pickable);
+  format       = gimp_pickable_get_format (src_pickable);
+  format_alpha = gimp_pickable_get_format_with_alpha (src_pickable);
 
   /* we need the source area with alpha and we modify it, so make a copy */
   src = temp_buf_new (srcPR->w, srcPR->h,
-                      GIMP_IMAGE_TYPE_BYTES (GIMP_IMAGE_TYPE_WITH_ALPHA (src_type)),
+                      babl_format_get_bytes_per_pixel (format_alpha),
                       0, 0, NULL);
 
   pixel_region_init_temp_buf (&tempPR, src, 0, 0, src->width, src->height);
@@ -493,7 +495,7 @@ gimp_heal_motion (GimpSourceCore   *source_core,
    * the effect of the following is to copy the contents of the source
    * region to the "src" temp-buf, adding an alpha channel if necessary
    */
-  if (GIMP_IMAGE_TYPE_HAS_ALPHA (src_type))
+  if (babl_format_has_alpha (format))
     copy_region (srcPR, &tempPR);
   else
     add_alpha_region (srcPR, &tempPR);
@@ -501,8 +503,7 @@ gimp_heal_motion (GimpSourceCore   *source_core,
   /* reinitialize srcPR */
   pixel_region_init_temp_buf (srcPR, src, 0, 0, src->width, src->height);
 
-  if (GIMP_IMAGE_TYPE_WITH_ALPHA (src_type) !=
-      gimp_drawable_type_with_alpha (drawable))
+  if (format_alpha != gimp_drawable_get_format_with_alpha (drawable))
     {
       GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
       TempBuf   *temp2;
diff --git a/app/paint/gimpperspectiveclone.c b/app/paint/gimpperspectiveclone.c
index 4906d36..7c57041 100644
--- a/app/paint/gimpperspectiveclone.c
+++ b/app/paint/gimpperspectiveclone.c
@@ -291,7 +291,7 @@ gimp_perspective_clone_get_source (GimpSourceCore   *source_core,
   GimpSourceOptions    *options    = GIMP_SOURCE_OPTIONS (paint_options);
   GimpImage            *src_image;
   GimpImage            *image;
-  GimpImageType         src_type;
+  const Babl           *src_format_alpha;
   gint                  x1d, y1d, x2d, y2d;
   gdouble               x1s, y1s, x2s, y2s, x3s, y3s, x4s, y4s;
   gint                  xmin, ymin, xmax, ymax;
@@ -305,8 +305,8 @@ gimp_perspective_clone_get_source (GimpSourceCore   *source_core,
   src_image = gimp_pickable_get_image (src_pickable);
   image     = gimp_item_get_image (GIMP_ITEM (drawable));
 
-  src_type  = gimp_pickable_get_image_type (src_pickable);
-  src_tiles = gimp_pickable_get_tiles (src_pickable);
+  src_format_alpha = gimp_pickable_get_format_with_alpha (src_pickable);
+  src_tiles        = gimp_pickable_get_tiles (src_pickable);
 
   /* Destination coordinates that will be painted */
   x1d = paint_area->x;
@@ -373,7 +373,7 @@ gimp_perspective_clone_get_source (GimpSourceCore   *source_core,
 
   /*  copy the original image to a tile manager, adding alpha if needed  */
 
-  bytes = GIMP_IMAGE_TYPE_BYTES (GIMP_IMAGE_TYPE_WITH_ALPHA (src_type));
+  bytes = babl_format_get_bytes_per_pixel (src_format_alpha);
 
   orig_tiles = tile_manager_new (xmax - xmin, ymax - ymin, bytes);
 



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