[gimp/goat-invasion: 64/418] app: implement gimp_layer_add_alpha() with gegl_buffer_copy()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 64/418] app: implement gimp_layer_add_alpha() with gegl_buffer_copy()
- Date: Wed, 4 Apr 2012 10:31:09 +0000 (UTC)
commit 9c11d50fee300cb3ab949679d4aa3914fe72f2c1
Author: Michael Natterer <mitch gimp org>
Date: Fri Mar 16 00:22:12 2012 +0100
app: implement gimp_layer_add_alpha() with gegl_buffer_copy()
app/core/gimplayer.c | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 934ea29..3b464b2 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1878,8 +1878,8 @@ gimp_layer_add_alpha (GimpLayer *layer)
{
GimpItem *item;
GimpDrawable *drawable;
- PixelRegion srcPR, destPR;
TileManager *new_tiles;
+ GeglBuffer *dest_buffer;
GimpImageType new_type;
g_return_if_fail (GIMP_IS_LAYER (layer));
@@ -1892,27 +1892,17 @@ gimp_layer_add_alpha (GimpLayer *layer)
new_type = gimp_drawable_type_with_alpha (drawable);
- /* Allocate the new tiles */
new_tiles = tile_manager_new (gimp_item_get_width (item),
gimp_item_get_height (item),
GIMP_IMAGE_TYPE_BYTES (new_type));
- /* Configure the pixel regions */
- pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
- 0, 0,
- gimp_item_get_width (item),
- gimp_item_get_height (item),
- FALSE);
- pixel_region_init (&destPR, new_tiles,
- 0, 0,
- gimp_item_get_width (item),
- gimp_item_get_height (item),
- TRUE);
+ dest_buffer = gimp_tile_manager_create_buffer (new_tiles, TRUE);
- /* Add an alpha channel */
- add_alpha_region (&srcPR, &destPR);
+ gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
+ dest_buffer, NULL);
+
+ g_object_unref (dest_buffer);
- /* Set the new tiles */
gimp_drawable_set_tiles (GIMP_DRAWABLE (layer),
gimp_item_is_attached (GIMP_ITEM (layer)),
C_("undo-type", "Add Alpha Channel"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]