[gimp/goat-invasion: 261/325] app: use gegl_buffer_set_format() to "cast" a dest buffers format



commit 48c1c4c1820aa90a04ec833a5449210ab7c89e58
Author: Michael Natterer <mitch gimp org>
Date:   Mon Mar 26 15:22:18 2012 +0200

    app: use gegl_buffer_set_format() to "cast" a dest buffers format
    
    in order to extract a src buffer's components

 app/core/gimpchannel.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index a750012..0ed69c2 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1646,7 +1646,6 @@ gimp_channel_new_from_alpha (GimpImage     *image,
                              const GimpRGB *color)
 {
   GimpChannel *channel;
-  TileManager *dest_tiles;
   GeglBuffer  *dest_buffer;
   gint         width;
   gint         height;
@@ -1662,14 +1661,12 @@ gimp_channel_new_from_alpha (GimpImage     *image,
 
   gimp_channel_clear (channel, NULL, FALSE);
 
-  dest_tiles = gimp_drawable_get_tiles (GIMP_DRAWABLE (channel));
-  dest_buffer = gimp_tile_manager_create_buffer (dest_tiles,
-                                                 babl_format ("A u8"));
+  dest_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
 
+  gegl_buffer_set_format (dest_buffer, babl_format ("A u8"));
   gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
                     dest_buffer, NULL);
-
-  g_object_unref (dest_buffer);
+  gegl_buffer_set_format (dest_buffer, NULL);
 
   channel->bounds_known = FALSE;
 
@@ -1685,7 +1682,6 @@ gimp_channel_new_from_component (GimpImage       *image,
   GimpProjection *projection;
   GimpChannel    *channel;
   GeglBuffer     *src_buffer;
-  TileManager    *dest_tiles;
   GeglBuffer     *dest_buffer;
   gint            width;
   gint            height;
@@ -1707,12 +1703,11 @@ gimp_channel_new_from_component (GimpImage       *image,
 
   channel = gimp_channel_new (image, width, height, name, color);
 
-  dest_tiles = gimp_drawable_get_tiles (GIMP_DRAWABLE (channel));
-  dest_buffer = gimp_tile_manager_create_buffer (dest_tiles, format);
+  dest_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
 
+  gegl_buffer_set_format (dest_buffer, format);
   gegl_buffer_copy (src_buffer, NULL, dest_buffer, NULL);
-
-  g_object_unref (dest_buffer);
+  gegl_buffer_set_format (dest_buffer, NULL);
 
   return channel;
 }



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