[gimp/goat-invasion: 527/608] app: don't hardcode "Y u8" when checking whether to clip transformed buffers



commit b1f31c34d48ba4151ce3cb9cde3d62925ebb891e
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 22 15:15:22 2012 +0200

    app: don't hardcode "Y u8" when checking whether to clip transformed buffers
    
    instead, check if the format has alpha.

 app/core/gimpdrawable-transform.c |   14 +++++++-------
 app/tools/gimptransformtool.c     |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index c62cc30..a272ec4 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -118,7 +118,7 @@ gimp_drawable_transform_buffer_affine (GimpDrawable           *drawable,
 
   /*  Always clip unfloated buffers since they must keep their size  */
   if (G_TYPE_FROM_INSTANCE (drawable) == GIMP_TYPE_CHANNEL &&
-      gegl_buffer_get_format (orig_buffer) == babl_format ("Y u8"))
+      ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
     clip_result = GIMP_TRANSFORM_RESIZE_CLIP;
 
   /*  Find the bounding coordinates of target */
@@ -669,7 +669,7 @@ gimp_drawable_transform_affine (GimpDrawable           *drawable,
 
       /*  always clip unfloated buffers so they keep their size  */
       if (GIMP_IS_CHANNEL (drawable) &&
-          gegl_buffer_get_format (orig_buffer) == babl_format ("Y u8"))
+          ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
         clip_result = GIMP_TRANSFORM_RESIZE_CLIP;
 
       /*  also transform the mask if we are transforming an entire layer  */
@@ -756,9 +756,9 @@ gimp_drawable_transform_flip (GimpDrawable        *drawable,
       gint        new_offset_x;
       gint        new_offset_y;
 
-      /*  always clip unfloated tiles so they keep their size  */
+      /*  always clip unfloated buffers so they keep their size  */
       if (GIMP_IS_CHANNEL (drawable) &&
-          gegl_buffer_get_format (orig_buffer) == babl_format ("Y u8"))
+          ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
         clip_result = TRUE;
 
       /*  also transform the mask if we are transforming an entire layer  */
@@ -842,9 +842,9 @@ gimp_drawable_transform_rotate (GimpDrawable     *drawable,
       gint        new_offset_x;
       gint        new_offset_y;
 
-      /*  always clip unfloated tiles so they keep their size  */
+      /*  always clip unfloated buffers so they keep their size  */
       if (GIMP_IS_CHANNEL (drawable) &&
-          gegl_buffer_get_format (orig_buffer) == babl_format ("Y u8"))
+          ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
         clip_result = TRUE;
 
       /*  also transform the mask if we are transforming an entire layer  */
@@ -915,7 +915,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
       gint x, y, w, h;
 
       /* set the keep_indexed flag to FALSE here, since we use
-       * gimp_layer_new_from_tiles() later which assumes that the tiles
+       * gimp_layer_new_from_buffer() later which assumes that the buffer
        * are either RGB or GRAY.  Eeek!!!              (Sven)
        */
       if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h))
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index db9cdbf..2d64f46 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -995,7 +995,7 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
        *  so they keep their size
        */
       if (GIMP_IS_CHANNEL (active_item) &&
-          gegl_buffer_get_format (orig_buffer) == babl_format ("Y u8"))
+          ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
         clip = GIMP_TRANSFORM_RESIZE_CLIP;
 
       ret = gimp_drawable_transform_buffer_affine (GIMP_DRAWABLE (active_item),



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