[gimp/goat-invasion: 122/526] app: use gimp_drawable_apply_operation_to_buffer() in gimp_layer_flatten()



commit 51630231e21da8c5da004751647180a37437853a
Author: Michael Natterer <mitch gimp org>
Date:   Sun Mar 18 16:27:08 2012 +0100

    app: use gimp_drawable_apply_operation_to_buffer() in gimp_layer_flatten()
    
    and not gimp_drawable_apply_operation_to_tiles() because that would
    guess the wrong Babl format for the new tiles if the image is indexed.

 app/core/gimplayer.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 3456448..22a1368 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1791,6 +1791,7 @@ gimp_layer_flatten (GimpLayer   *layer,
 {
   GeglNode      *flatten;
   TileManager   *new_tiles;
+  GeglBuffer    *dest_buffer;
   GimpImageType  new_type;
   GimpRGB        background;
 
@@ -1806,13 +1807,18 @@ gimp_layer_flatten (GimpLayer   *layer,
                                 gimp_item_get_height (GIMP_ITEM (layer)),
                                 GIMP_IMAGE_TYPE_BYTES (new_type));
 
+  dest_buffer = gimp_tile_manager_create_buffer (new_tiles,
+                                                 gimp_drawable_get_format_without_alpha (GIMP_DRAWABLE (layer)),
+                                                 TRUE);
+
   gimp_context_get_background (context, &background);
   flatten = gimp_gegl_create_flatten_node (&background);
 
-  gimp_drawable_apply_operation_to_tiles (GIMP_DRAWABLE (layer), NULL, NULL,
-                                          flatten, TRUE, new_tiles);
+  gimp_drawable_apply_operation_to_buffer (GIMP_DRAWABLE (layer), NULL, NULL,
+                                           flatten, TRUE, dest_buffer);
 
   g_object_unref (flatten);
+  g_object_unref (dest_buffer);
 
   gimp_drawable_set_tiles (GIMP_DRAWABLE (layer),
                            gimp_item_is_attached (GIMP_ITEM (layer)),



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