[gimp/metadata-browser] app: change GimpDrawable::set_tiles() to ::set_buffer()



commit c98589a97547459b88a76897e45b3552b56c65ee
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 21 23:37:16 2012 +0100

    app: change GimpDrawable::set_tiles() to ::set_buffer()
    
    and remove the "type" argument, GeglBuffers have a format.

 app/core/gimpchannel.c            |   32 ++++-----
 app/core/gimpdrawable-convert.c   |   16 ++---
 app/core/gimpdrawable-offset.c    |    7 +-
 app/core/gimpdrawable-transform.c |   14 +----
 app/core/gimpdrawable.c           |  133 +++++++++++--------------------------
 app/core/gimpdrawable.h           |   21 +-----
 app/core/gimpdrawablemodundo.c    |    7 +--
 app/core/gimpdrawablemodundo.h    |    1 -
 app/core/gimpgrouplayer.c         |    3 +-
 app/core/gimpimage-convert.c      |    6 +-
 app/core/gimplayer.c              |   22 ++----
 app/text/gimptextlayer.c          |   38 +++++------
 app/tools/gimptransformtool.c     |    3 +-
 13 files changed, 98 insertions(+), 205 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 8df564d..afc3240 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -156,11 +156,10 @@ static void      gimp_channel_replace_region (GimpDrawable        *drawable,
                                               PixelRegion          *maskPR,
                                               gint                 x,
                                               gint                 y);
-static void      gimp_channel_set_tiles      (GimpDrawable        *drawable,
+static void      gimp_channel_set_buffer     (GimpDrawable        *drawable,
                                               gboolean             push_undo,
                                               const gchar         *undo_desc,
-                                              TileManager         *tiles,
-                                              GimpImageType        type,
+                                              GeglBuffer          *buffer,
                                               gint                 offset_x,
                                               gint                 offset_y);
 static GeglNode * gimp_channel_get_node      (GimpItem            *item);
@@ -294,7 +293,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
   drawable_class->apply_region          = gimp_channel_apply_region;
   drawable_class->replace_region        = gimp_channel_replace_region;
   drawable_class->project_region        = gimp_channel_project_region;
-  drawable_class->set_tiles             = gimp_channel_set_tiles;
+  drawable_class->set_buffer            = gimp_channel_set_buffer;
   drawable_class->swap_pixels           = gimp_channel_swap_pixels;
 
   klass->boundary       = gimp_channel_real_boundary;
@@ -481,7 +480,7 @@ gimp_channel_convert (GimpItem  *item,
       g_object_unref (flatten);
 
       gimp_drawable_set_buffer_full (drawable, FALSE, NULL,
-                                     new_buffer, GIMP_GRAY_IMAGE,
+                                     new_buffer,
                                      gimp_item_get_offset_x (item),
                                      gimp_item_get_offset_y (item));
       g_object_unref (new_buffer);
@@ -621,7 +620,7 @@ gimp_channel_scale (GimpItem              *item,
 
       gimp_drawable_set_buffer_full (drawable,
                                      gimp_item_is_attached (item), NULL,
-                                     new_buffer, gimp_drawable_type (drawable),
+                                     new_buffer,
                                      new_offset_x, new_offset_y);
       g_object_unref (new_buffer);
 
@@ -852,18 +851,17 @@ gimp_channel_replace_region (GimpDrawable *drawable,
 }
 
 static void
-gimp_channel_set_tiles (GimpDrawable *drawable,
-                        gboolean      push_undo,
-                        const gchar  *undo_desc,
-                        TileManager  *tiles,
-                        GimpImageType type,
-                        gint          offset_x,
-                        gint          offset_y)
+gimp_channel_set_buffer (GimpDrawable *drawable,
+                         gboolean      push_undo,
+                         const gchar  *undo_desc,
+                         GeglBuffer   *buffer,
+                         gint          offset_x,
+                         gint          offset_y)
 {
-  GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
-                                                 push_undo, undo_desc,
-                                                 tiles, type,
-                                                 offset_x, offset_y);
+  GIMP_DRAWABLE_CLASS (parent_class)->set_buffer (drawable,
+                                                  push_undo, undo_desc,
+                                                  buffer,
+                                                  offset_x, offset_y);
 
   GIMP_CHANNEL (drawable)->bounds_known = FALSE;
 }
diff --git a/app/core/gimpdrawable-convert.c b/app/core/gimpdrawable-convert.c
index 2f0fa82..31c4aac 100644
--- a/app/core/gimpdrawable-convert.c
+++ b/app/core/gimpdrawable-convert.c
@@ -59,8 +59,7 @@ gimp_drawable_convert_rgb (GimpDrawable *drawable,
   gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
                     dest_buffer, NULL);
 
-  gimp_drawable_set_buffer (drawable, push_undo, NULL,
-                            dest_buffer, type);
+  gimp_drawable_set_buffer (drawable, push_undo, NULL, dest_buffer);
   g_object_unref (dest_buffer);
 }
 
@@ -90,8 +89,7 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
   gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
                     dest_buffer, NULL);
 
-  gimp_drawable_set_buffer (drawable, push_undo, NULL,
-                            dest_buffer, type);
+  gimp_drawable_set_buffer (drawable, push_undo, NULL, dest_buffer);
   g_object_unref (dest_buffer);
 }
 
@@ -100,16 +98,13 @@ gimp_drawable_convert_indexed (GimpDrawable *drawable,
                                GimpImage    *dest_image,
                                gboolean      push_undo)
 {
-  GimpImageType  type;
-  GeglBuffer    *dest_buffer;
-  const Babl    *format;
+  GeglBuffer *dest_buffer;
+  const Babl *format;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (GIMP_IS_IMAGE (dest_image));
   g_return_if_fail (! gimp_drawable_is_gray (drawable));
 
-  type = GIMP_INDEXED_IMAGE;
-
   if (gimp_drawable_has_alpha (drawable))
     format = gimp_image_colormap_get_rgba_format (dest_image);
   else
@@ -124,7 +119,6 @@ gimp_drawable_convert_indexed (GimpDrawable *drawable,
   gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
                     dest_buffer, NULL);
 
-  gimp_drawable_set_buffer (drawable, push_undo, NULL,
-                            dest_buffer, type);
+  gimp_drawable_set_buffer (drawable, push_undo, NULL, dest_buffer);
   g_object_unref (dest_buffer);
 }
diff --git a/app/core/gimpdrawable-offset.c b/app/core/gimpdrawable-offset.c
index 428d0d8..2033f74 100644
--- a/app/core/gimpdrawable-offset.c
+++ b/app/core/gimpdrawable-offset.c
@@ -240,8 +240,9 @@ gimp_drawable_offset (GimpDrawable   *drawable,
         }
     }
 
-  gimp_drawable_set_buffer (drawable, gimp_item_is_attached (item),
-                            C_("undo-type", "Offset Drawable"), new_buffer,
-                            gimp_drawable_type (drawable));
+  gimp_drawable_set_buffer (drawable,
+                            gimp_item_is_attached (item),
+                            C_("undo-type", "Offset Drawable"),
+                            new_buffer);
   g_object_unref (new_buffer);
 }
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index 8ca7fd8..4b7c728 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -1032,20 +1032,8 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
     }
   else
     {
-      GimpImageType drawable_type;
-
-      if (GIMP_IS_LAYER (drawable) &&
-          babl_format_has_alpha (gegl_buffer_get_format (buffer)))
-        {
-          drawable_type = gimp_drawable_type_with_alpha (drawable);
-        }
-      else
-        {
-          drawable_type = gimp_drawable_type (drawable);
-        }
-
       gimp_drawable_set_buffer_full (drawable, TRUE, NULL,
-                                     buffer, drawable_type,
+                                     buffer,
                                      offset_x, offset_y);
     }
 
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index bd4682d..df538c2 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -142,11 +142,10 @@ static void       gimp_drawable_real_convert_type  (GimpDrawable      *drawable,
                                                     gboolean           push_undo);
 
 static TileManager * gimp_drawable_real_get_tiles  (GimpDrawable      *drawable);
-static void       gimp_drawable_real_set_tiles     (GimpDrawable      *drawable,
+static void       gimp_drawable_real_set_buffer    (GimpDrawable      *drawable,
                                                     gboolean           push_undo,
                                                     const gchar       *undo_desc,
-                                                    TileManager       *tiles,
-                                                    GimpImageType      type,
+                                                    GeglBuffer        *buffer,
                                                     gint               offset_x,
                                                     gint               offset_y);
 static GeglNode * gimp_drawable_get_node           (GimpItem          *item);
@@ -247,7 +246,7 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
   klass->apply_region                = gimp_drawable_real_apply_region;
   klass->replace_region              = gimp_drawable_real_replace_region;
   klass->get_tiles                   = gimp_drawable_real_get_tiles;
-  klass->set_tiles                   = gimp_drawable_real_set_tiles;
+  klass->set_buffer                  = gimp_drawable_real_set_buffer;
   klass->push_undo                   = gimp_drawable_real_push_undo;
   klass->swap_pixels                 = gimp_drawable_real_swap_pixels;
 
@@ -516,7 +515,7 @@ gimp_drawable_scale (GimpItem              *item,
 #endif
 
   gimp_drawable_set_buffer_full (drawable, gimp_item_is_attached (item), NULL,
-                                 new_buffer, gimp_drawable_type (drawable),
+                                 new_buffer,
                                  new_offset_x, new_offset_y);
   g_object_unref (new_buffer);
 }
@@ -596,7 +595,7 @@ gimp_drawable_resize (GimpItem    *item,
     }
 
   gimp_drawable_set_buffer_full (drawable, gimp_item_is_attached (item), NULL,
-                                 new_buffer, gimp_drawable_type (drawable),
+                                 new_buffer,
                                  new_offset_x, new_offset_y);
   g_object_unref (new_buffer);
 }
@@ -782,21 +781,16 @@ gimp_drawable_real_get_tiles (GimpDrawable *drawable)
 }
 
 static void
-gimp_drawable_real_set_tiles (GimpDrawable *drawable,
-                              gboolean      push_undo,
-                              const gchar  *undo_desc,
-                              TileManager  *tiles,
-                              GimpImageType type,
-                              gint          offset_x,
-                              gint          offset_y)
-{
-  GimpItem *item;
+gimp_drawable_real_set_buffer (GimpDrawable *drawable,
+                               gboolean      push_undo,
+                               const gchar  *undo_desc,
+                               GeglBuffer   *buffer,
+                               gint          offset_x,
+                               gint          offset_y)
+{
+  GimpItem *item = GIMP_ITEM (drawable);
   gboolean  old_has_alpha;
 
-  g_return_if_fail (tile_manager_bpp (tiles) == GIMP_IMAGE_TYPE_BYTES (type));
-
-  item = GIMP_ITEM (drawable);
-
   old_has_alpha = gimp_drawable_has_alpha (drawable);
 
   gimp_drawable_invalidate_boundary (drawable);
@@ -806,22 +800,18 @@ gimp_drawable_real_set_tiles (GimpDrawable *drawable,
                                        drawable, FALSE);
 
   /*  ref new before unrefing old, they might be the same  */
-  tile_manager_ref (tiles);
+  g_object_ref (buffer);
 
   if (drawable->private->buffer)
     g_object_unref (drawable->private->buffer);
 
-  drawable->private->format = gimp_image_get_format (gimp_item_get_image (item),
-                                                     type);
-  drawable->private->buffer = gimp_tile_manager_create_buffer (tiles,
-                                                               drawable->private->format);
-
-  tile_manager_unref (tiles);
+  drawable->private->format = gegl_buffer_get_format (buffer);
+  drawable->private->buffer = buffer;
 
   gimp_item_set_offset (item, offset_x, offset_y);
   gimp_item_set_size (item,
-                      tile_manager_width  (tiles),
-                      tile_manager_height (tiles));
+                      gegl_buffer_get_width  (buffer),
+                      gegl_buffer_get_height (buffer));
 
   if (old_has_alpha != gimp_drawable_has_alpha (drawable))
     gimp_drawable_alpha_changed (drawable);
@@ -1472,50 +1462,6 @@ gimp_drawable_get_buffer (GimpDrawable *drawable)
   return drawable->private->buffer;
 }
 
-void
-gimp_drawable_set_buffer (GimpDrawable  *drawable,
-                          gboolean       push_undo,
-                          const gchar   *undo_desc,
-                          GeglBuffer    *buffer,
-                          GimpImageType  type)
-{
-  gint offset_x, offset_y;
-
-  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-  g_return_if_fail (GEGL_IS_BUFFER (buffer));
-
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
-    push_undo = FALSE;
-
-  gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y);
-
-  gimp_drawable_set_buffer_full (drawable, push_undo, undo_desc, buffer, type,
-                                 offset_x, offset_y);
-}
-
-void
-gimp_drawable_set_buffer_full (GimpDrawable  *drawable,
-                               gboolean       push_undo,
-                               const gchar   *undo_desc,
-                               GeglBuffer    *buffer,
-                               GimpImageType  type,
-                               gint           offset_x,
-                               gint           offset_y)
-{
-  TileManager *tiles;
-
-  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-  g_return_if_fail (GEGL_IS_BUFFER (buffer));
-
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
-    push_undo = FALSE;
-
-  tiles = gimp_gegl_buffer_get_tiles (buffer);
-
-  gimp_drawable_set_tiles_full (drawable, push_undo, undo_desc, tiles, type,
-                                offset_x, offset_y);
-}
-
 TileManager *
 gimp_drawable_get_tiles (GimpDrawable *drawable)
 {
@@ -1528,49 +1474,46 @@ gimp_drawable_get_tiles (GimpDrawable *drawable)
 }
 
 void
-gimp_drawable_set_tiles (GimpDrawable  *drawable,
-                         gboolean       push_undo,
-                         const gchar   *undo_desc,
-                         TileManager   *tiles,
-                         GimpImageType  type)
+gimp_drawable_set_buffer (GimpDrawable *drawable,
+                          gboolean      push_undo,
+                          const gchar  *undo_desc,
+                          GeglBuffer   *buffer)
 {
   gint offset_x, offset_y;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-  g_return_if_fail (tiles != NULL);
+  g_return_if_fail (GEGL_IS_BUFFER (buffer));
 
   if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
     push_undo = FALSE;
 
   gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y);
 
-  gimp_drawable_set_tiles_full (drawable, push_undo, undo_desc, tiles, type,
-                                offset_x, offset_y);
+  gimp_drawable_set_buffer_full (drawable, push_undo, undo_desc, buffer,
+                                 offset_x, offset_y);
 }
 
 void
-gimp_drawable_set_tiles_full (GimpDrawable  *drawable,
-                              gboolean       push_undo,
-                              const gchar   *undo_desc,
-                              TileManager   *tiles,
-                              GimpImageType  type,
-                              gint           offset_x,
-                              gint           offset_y)
+gimp_drawable_set_buffer_full (GimpDrawable *drawable,
+                               gboolean      push_undo,
+                               const gchar  *undo_desc,
+                               GeglBuffer   *buffer,
+                               gint          offset_x,
+                               gint          offset_y)
 {
   GimpItem *item;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-  g_return_if_fail (tiles != NULL);
-  g_return_if_fail (tile_manager_bpp (tiles) == GIMP_IMAGE_TYPE_BYTES (type));
+  g_return_if_fail (GEGL_IS_BUFFER (buffer));
 
   item = GIMP_ITEM (drawable);
 
   if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
     push_undo = FALSE;
 
-  if (gimp_item_get_width  (item)   != tile_manager_width (tiles)  ||
-      gimp_item_get_height (item)   != tile_manager_height (tiles) ||
-      gimp_item_get_offset_x (item) != offset_x                    ||
+  if (gimp_item_get_width  (item)   != gegl_buffer_get_width (buffer)  ||
+      gimp_item_get_height (item)   != gegl_buffer_get_height (buffer) ||
+      gimp_item_get_offset_x (item) != offset_x                        ||
       gimp_item_get_offset_y (item) != offset_y)
     {
       gimp_drawable_update (drawable,
@@ -1581,10 +1524,10 @@ gimp_drawable_set_tiles_full (GimpDrawable  *drawable,
 
   g_object_freeze_notify (G_OBJECT (drawable));
 
-  GIMP_DRAWABLE_GET_CLASS (drawable)->set_tiles (drawable,
-                                                 push_undo, undo_desc,
-                                                 tiles, type,
-                                                 offset_x, offset_y);
+  GIMP_DRAWABLE_GET_CLASS (drawable)->set_buffer (drawable,
+                                                  push_undo, undo_desc,
+                                                  buffer,
+                                                  offset_x, offset_y);
 
   g_object_thaw_notify (G_OBJECT (drawable));
 
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index 95c2918..932235c 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -89,11 +89,10 @@ struct _GimpDrawableClass
                                            PixelRegion          *projPR,
                                            gboolean              combine);
   TileManager * (* get_tiles)             (GimpDrawable         *drawable);
-  void          (* set_tiles)             (GimpDrawable         *drawable,
+  void          (* set_buffer)            (GimpDrawable         *drawable,
                                            gboolean              push_undo,
                                            const gchar          *undo_desc,
-                                           TileManager          *tiles,
-                                           GimpImageType         type,
+                                           GeglBuffer           *buffer,
                                            gint                  offset_x,
                                            gint                  offset_y);
   void          (* push_undo)             (GimpDrawable         *drawable,
@@ -182,29 +181,15 @@ GeglBuffer    * gimp_drawable_get_buffer         (GimpDrawable       *drawable);
 void            gimp_drawable_set_buffer         (GimpDrawable       *drawable,
                                                   gboolean            push_undo,
                                                   const gchar        *undo_desc,
-                                                  GeglBuffer         *buffer,
-                                                  GimpImageType       type);
+                                                  GeglBuffer         *buffer);
 void            gimp_drawable_set_buffer_full    (GimpDrawable       *drawable,
                                                   gboolean            push_undo,
                                                   const gchar        *undo_desc,
                                                   GeglBuffer         *buffer,
-                                                  GimpImageType       type,
                                                   gint                offset_x,
                                                   gint                offset_y);
 
 TileManager   * gimp_drawable_get_tiles          (GimpDrawable       *drawable);
-void            gimp_drawable_set_tiles          (GimpDrawable       *drawable,
-                                                  gboolean            push_undo,
-                                                  const gchar        *undo_desc,
-                                                  TileManager        *tiles,
-                                                  GimpImageType       type);
-void            gimp_drawable_set_tiles_full     (GimpDrawable       *drawable,
-                                                  gboolean            push_undo,
-                                                  const gchar        *undo_desc,
-                                                  TileManager        *tiles,
-                                                  GimpImageType       type,
-                                                  gint                offset_x,
-                                                  gint                offset_y);
 
 GeglNode      * gimp_drawable_get_source_node    (GimpDrawable       *drawable);
 GeglNode      * gimp_drawable_get_mode_node      (GimpDrawable       *drawable);
diff --git a/app/core/gimpdrawablemodundo.c b/app/core/gimpdrawablemodundo.c
index 7db1cf7..bbb9e71 100644
--- a/app/core/gimpdrawablemodundo.c
+++ b/app/core/gimpdrawablemodundo.c
@@ -116,8 +116,6 @@ gimp_drawable_mod_undo_constructed (GObject *object)
         g_object_ref (gimp_drawable_get_buffer (drawable));
     }
 
-  drawable_mod_undo->type = gimp_drawable_type (drawable);
-
   gimp_item_get_offset (item,
                         &drawable_mod_undo->offset_x,
                         &drawable_mod_undo->offset_y);
@@ -184,26 +182,23 @@ gimp_drawable_mod_undo_pop (GimpUndo            *undo,
   GimpDrawableModUndo *drawable_mod_undo = GIMP_DRAWABLE_MOD_UNDO (undo);
   GimpDrawable        *drawable          = GIMP_DRAWABLE (GIMP_ITEM_UNDO (undo)->item);
   GeglBuffer          *buffer;
-  GimpImageType        type;
   gint                 offset_x;
   gint                 offset_y;
 
   GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
 
   buffer   = drawable_mod_undo->buffer;
-  type     = drawable_mod_undo->type;
   offset_x = drawable_mod_undo->offset_x;
   offset_y = drawable_mod_undo->offset_y;
 
   drawable_mod_undo->buffer = g_object_ref (gimp_drawable_get_buffer (drawable));
-  drawable_mod_undo->type   = gimp_drawable_type (drawable);
 
   gimp_item_get_offset (GIMP_ITEM (drawable),
                         &drawable_mod_undo->offset_x,
                         &drawable_mod_undo->offset_y);
 
   gimp_drawable_set_buffer_full (drawable, FALSE, NULL,
-                                 buffer, type, offset_x, offset_y);
+                                 buffer, offset_x, offset_y);
   g_object_unref (buffer);
 }
 
diff --git a/app/core/gimpdrawablemodundo.h b/app/core/gimpdrawablemodundo.h
index 61e5a3d..53d2c70 100644
--- a/app/core/gimpdrawablemodundo.h
+++ b/app/core/gimpdrawablemodundo.h
@@ -38,7 +38,6 @@ struct _GimpDrawableModUndo
 
   GeglBuffer    *buffer;
   gboolean       copy_buffer;
-  GimpImageType  type;
   gint           offset_x;
   gint           offset_y;
 };
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 02e1959..9ee5718 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -864,7 +864,7 @@ gimp_group_layer_convert_type (GimpDrawable      *drawable,
 
   gimp_drawable_set_buffer_full (drawable,
                                  FALSE, NULL,
-                                 buffer, new_type,
+                                 buffer,
                                  gimp_item_get_offset_x (GIMP_ITEM (drawable)),
                                  gimp_item_get_offset_y (GIMP_ITEM (drawable)));
 
@@ -1129,7 +1129,6 @@ gimp_group_layer_update_size (GimpGroupLayer *group)
           gimp_drawable_set_buffer_full (GIMP_DRAWABLE (group),
                                          FALSE, NULL,
                                          buffer,
-                                         gimp_drawable_type (GIMP_DRAWABLE (group)),
                                          x, y);
 
           g_object_unref (buffer);
diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c
index 937474f..d224978 100644
--- a/app/core/gimpimage-convert.c
+++ b/app/core/gimpimage-convert.c
@@ -989,11 +989,13 @@ gimp_image_convert (GimpImage               *image,
             quantobj->nth_layer = nth_layer;
             (* quantobj->second_pass) (quantobj, layer, new_tiles);
 
-            new_buffer = gimp_tile_manager_create_buffer (new_tiles, NULL);
+            new_buffer = gimp_tile_manager_create_buffer (new_tiles,
+                                                          gimp_image_get_format (image,
+                                                                                 new_layer_type));
             tile_manager_unref (new_tiles);
 
             gimp_drawable_set_buffer (GIMP_DRAWABLE (layer), TRUE, NULL,
-                                      new_buffer, new_layer_type);
+                                      new_buffer);
             g_object_unref (new_buffer);
           }
           break;
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index d67370d..cadaf77 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1758,10 +1758,9 @@ gimp_layer_get_show_mask (const GimpLayer *layer)
 void
 gimp_layer_add_alpha (GimpLayer *layer)
 {
-  GimpItem      *item;
-  GimpDrawable  *drawable;
-  GeglBuffer    *new_buffer;
-  GimpImageType  new_type;
+  GimpItem     *item;
+  GimpDrawable *drawable;
+  GeglBuffer   *new_buffer;
 
   g_return_if_fail (GIMP_IS_LAYER (layer));
 
@@ -1771,8 +1770,6 @@ gimp_layer_add_alpha (GimpLayer *layer)
   item     = GIMP_ITEM (layer);
   drawable = GIMP_DRAWABLE (layer);
 
-  new_type = gimp_drawable_type_with_alpha (drawable);
-
   new_buffer =
     gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0,
                                           gimp_item_get_width  (item),
@@ -1785,7 +1782,7 @@ gimp_layer_add_alpha (GimpLayer *layer)
   gimp_drawable_set_buffer (GIMP_DRAWABLE (layer),
                             gimp_item_is_attached (GIMP_ITEM (layer)),
                             C_("undo-type", "Add Alpha Channel"),
-                            new_buffer, new_type);
+                            new_buffer);
   g_object_unref (new_buffer);
 }
 
@@ -1793,10 +1790,9 @@ void
 gimp_layer_flatten (GimpLayer   *layer,
                     GimpContext *context)
 {
-  GeglNode      *flatten;
-  GeglBuffer    *new_buffer;
-  GimpImageType  new_type;
-  GimpRGB        background;
+  GeglNode   *flatten;
+  GeglBuffer *new_buffer;
+  GimpRGB     background;
 
   g_return_if_fail (GIMP_IS_LAYER (layer));
   g_return_if_fail (GIMP_IS_CONTEXT (context));
@@ -1804,8 +1800,6 @@ gimp_layer_flatten (GimpLayer   *layer,
   if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
     return;
 
-  new_type = gimp_drawable_type_without_alpha (GIMP_DRAWABLE (layer));
-
   new_buffer =
     gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0,
                                           gimp_item_get_width  (GIMP_ITEM (layer)),
@@ -1823,7 +1817,7 @@ gimp_layer_flatten (GimpLayer   *layer,
   gimp_drawable_set_buffer (GIMP_DRAWABLE (layer),
                             gimp_item_is_attached (GIMP_ITEM (layer)),
                             C_("undo-type", "Remove Alpha Channel"),
-                            new_buffer, new_type);
+                            new_buffer);
   g_object_unref (new_buffer);
 }
 
diff --git a/app/text/gimptextlayer.c b/app/text/gimptextlayer.c
index b486247..c1ec117 100644
--- a/app/text/gimptextlayer.c
+++ b/app/text/gimptextlayer.c
@@ -83,11 +83,10 @@ static gboolean   gimp_text_layer_rename         (GimpItem        *item,
                                                   const gchar     *undo_desc,
                                                   GError         **error);
 
-static void       gimp_text_layer_set_tiles      (GimpDrawable    *drawable,
+static void       gimp_text_layer_set_buffer     (GimpDrawable    *drawable,
                                                   gboolean         push_undo,
                                                   const gchar     *undo_desc,
-                                                  TileManager     *tiles,
-                                                  GimpImageType    type,
+                                                  GeglBuffer      *buffer,
                                                   gint             offset_x,
                                                   gint             offset_y);
 static void       gimp_text_layer_push_undo      (GimpDrawable    *drawable,
@@ -146,7 +145,7 @@ gimp_text_layer_class_init (GimpTextLayerClass *klass)
   item_class->rotate_desc          = _("Rotate Text Layer");
   item_class->transform_desc       = _("Transform Text Layer");
 
-  drawable_class->set_tiles        = gimp_text_layer_set_tiles;
+  drawable_class->set_buffer       = gimp_text_layer_set_buffer;
   drawable_class->push_undo        = gimp_text_layer_push_undo;
 
   GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_TEXT,
@@ -303,13 +302,12 @@ gimp_text_layer_rename (GimpItem     *item,
 }
 
 static void
-gimp_text_layer_set_tiles (GimpDrawable  *drawable,
-                           gboolean       push_undo,
-                           const gchar   *undo_desc,
-                           TileManager   *tiles,
-                           GimpImageType  type,
-                           gint           offset_x,
-                           gint           offset_y)
+gimp_text_layer_set_buffer (GimpDrawable *drawable,
+                            gboolean      push_undo,
+                            const gchar  *undo_desc,
+                            GeglBuffer   *buffer,
+                            gint          offset_x,
+                            gint          offset_y)
 {
   GimpTextLayer *layer = GIMP_TEXT_LAYER (drawable);
   GimpImage     *image = gimp_item_get_image (GIMP_ITEM (layer));
@@ -318,10 +316,10 @@ gimp_text_layer_set_tiles (GimpDrawable  *drawable,
     gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_DRAWABLE_MOD,
                                  undo_desc);
 
-  GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
-                                                 push_undo, undo_desc,
-                                                 tiles, type,
-                                                 offset_x, offset_y);
+  GIMP_DRAWABLE_CLASS (parent_class)->set_buffer (drawable,
+                                                  push_undo, undo_desc,
+                                                  buffer,
+                                                  offset_x, offset_y);
 
   if (push_undo && ! layer->modified)
     {
@@ -591,13 +589,11 @@ gimp_text_layer_render (GimpTextLayer *layer)
       (width  != gimp_item_get_width  (item) ||
        height != gimp_item_get_height (item)))
     {
-      GeglBuffer *new_buffer =
-        gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0, width, height),
-                              gimp_drawable_get_format (drawable));
-
-      gimp_drawable_set_buffer (drawable, FALSE, NULL, new_buffer,
-                                gimp_drawable_type (drawable));
+      GeglBuffer *new_buffer;
 
+      new_buffer = gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0, width, height),
+                                         gimp_drawable_get_format (drawable));
+      gimp_drawable_set_buffer (drawable, FALSE, NULL, new_buffer);
       g_object_unref (new_buffer);
 
       if (gimp_layer_get_mask (GIMP_LAYER (layer)))
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 46ffb98..db9cdbf 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -1165,8 +1165,7 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
           gimp_channel_push_undo (GIMP_CHANNEL (active_item), NULL);
 
           gimp_drawable_set_buffer (GIMP_DRAWABLE (active_item),
-                                    FALSE, NULL, new_buffer,
-                                    gimp_drawable_type (GIMP_DRAWABLE (active_item)));
+                                    FALSE, NULL, new_buffer);
           g_object_unref (new_buffer);
         }
       break;



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