[gimp/goat-invasion: 185/526] app: remove gimp_selection_extract_buffer() again
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 185/526] app: remove gimp_selection_extract_buffer() again
- Date: Sun, 22 Apr 2012 13:14:49 +0000 (UTC)
commit 82d3b03ef5dfdf102a56aee82c8db3ee7bdf941d
Author: Michael Natterer <mitch gimp org>
Date: Wed Mar 21 14:43:38 2012 +0100
app: remove gimp_selection_extract_buffer() again
app/core/gimp-edit.c | 8 ++--
app/core/gimpdrawable-transform.c | 24 ++++++------
app/core/gimpselection.c | 79 +++++++++---------------------------
app/core/gimpselection.h | 12 +-----
4 files changed, 37 insertions(+), 86 deletions(-)
---
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index f10ca52..8de9757 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -585,10 +585,10 @@ gimp_edit_extract (GimpImage *image,
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_CUT, C_("undo-type", "Cut"));
/* Cut/copy the mask portion from the image */
- buffer = gimp_selection_extract_buffer (GIMP_SELECTION (gimp_image_get_mask (image)),
- pickable, context,
- cut_pixels, FALSE, FALSE,
- &offset_x, &offset_y, error);
+ buffer = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
+ pickable, context,
+ cut_pixels, FALSE, FALSE,
+ &offset_x, &offset_y, error);
if (cut_pixels)
gimp_image_undo_group_end (image);
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index 12c74fe..1768d95 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -956,12 +956,12 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
*/
if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h))
{
- buffer = gimp_selection_extract_buffer (GIMP_SELECTION (gimp_image_get_mask (image)),
- GIMP_PICKABLE (drawable),
- context,
- TRUE, FALSE, TRUE,
- offset_x, offset_y,
- NULL);
+ buffer = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
+ GIMP_PICKABLE (drawable),
+ context,
+ TRUE, FALSE, TRUE,
+ offset_x, offset_y,
+ NULL);
/* clear the selection */
gimp_channel_clear (gimp_image_get_mask (image), NULL, TRUE);
@@ -975,12 +975,12 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
}
else /* otherwise, just copy the layer */
{
- buffer = gimp_selection_extract_buffer (GIMP_SELECTION (gimp_image_get_mask (image)),
- GIMP_PICKABLE (drawable),
- context,
- FALSE, TRUE, GIMP_IS_LAYER (drawable),
- offset_x, offset_y,
- NULL);
+ buffer = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
+ GIMP_PICKABLE (drawable),
+ context,
+ FALSE, TRUE, GIMP_IS_LAYER (drawable),
+ offset_x, offset_y,
+ NULL);
*new_layer = FALSE;
}
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index e30fe7b..5f20caf 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -23,8 +23,6 @@
#include "core-types.h"
-#include "base/tile-manager.h"
-
#include "gegl/gimp-gegl-nodes.h"
#include "gegl/gimp-gegl-utils.h"
@@ -615,63 +613,29 @@ gimp_selection_save (GimpSelection *selection)
}
GeglBuffer *
-gimp_selection_extract_buffer (GimpSelection *selection,
- GimpPickable *pickable,
- GimpContext *context,
- gboolean cut_image,
- gboolean keep_indexed,
- gboolean add_alpha,
- gint *offset_x,
- gint *offset_y,
- GError **error)
-{
- TileManager *tiles;
- const Babl *format;
-
- tiles = gimp_selection_extract (selection, pickable, context,
- cut_image, keep_indexed, add_alpha,
- &format,
- offset_x, offset_y, error);
-
- if (tiles)
- {
- GeglBuffer *buffer;
-
- buffer = gimp_tile_manager_create_buffer (tiles, format);
- tile_manager_unref (tiles);
-
- return buffer;
- }
-
- return NULL;
-}
-
-TileManager *
gimp_selection_extract (GimpSelection *selection,
GimpPickable *pickable,
GimpContext *context,
gboolean cut_image,
gboolean keep_indexed,
gboolean add_alpha,
- const Babl **format,
gint *offset_x,
gint *offset_y,
GError **error)
{
- GimpImage *image;
- TileManager *tiles;
- GeglBuffer *src_buffer;
- GeglBuffer *dest_buffer;
- gint x1, y1, x2, y2;
- gboolean non_empty;
- gint off_x, off_y;
+ GimpImage *image;
+ GeglBuffer *src_buffer;
+ GeglBuffer *dest_buffer;
+ const Babl *format;
+ gint x1, y1, x2, y2;
+ gboolean non_empty;
+ gint off_x, off_y;
g_return_val_if_fail (GIMP_IS_SELECTION (selection), NULL);
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
if (GIMP_IS_ITEM (pickable))
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (pickable)), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
- g_return_val_if_fail (format != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
image = gimp_pickable_get_image (pickable);
@@ -709,26 +673,26 @@ gimp_selection_extract (GimpSelection *selection,
case GIMP_RGB:
case GIMP_GRAY:
if (add_alpha)
- *format = gimp_pickable_get_format_with_alpha (pickable);
+ format = gimp_pickable_get_format_with_alpha (pickable);
else
- *format = gimp_pickable_get_format (pickable);
+ format = gimp_pickable_get_format (pickable);
break;
case GIMP_INDEXED:
if (keep_indexed)
{
if (add_alpha)
- *format = gimp_pickable_get_format_with_alpha (pickable);
+ format = gimp_pickable_get_format_with_alpha (pickable);
else
- *format = gimp_pickable_get_format (pickable);
+ format = gimp_pickable_get_format (pickable);
}
else
{
if (add_alpha ||
GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_pickable_get_image_type (pickable)))
- *format = babl_format ("RGBA u8");
+ format = babl_format ("RGBA u8");
else
- *format = babl_format ("RGB u8");
+ format = babl_format ("RGB u8");
}
break;
@@ -751,13 +715,12 @@ gimp_selection_extract (GimpSelection *selection,
src_buffer = gimp_pickable_get_buffer (pickable);
/* Allocate the temp buffer */
- tiles = tile_manager_new (x2 - x1, y2 - y1,
- babl_format_get_bytes_per_pixel (*format));
- dest_buffer = gimp_tile_manager_create_buffer (tiles, *format);
+ dest_buffer = gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0, x2 - x1, y2 - y1),
+ format);
/* First, copy the pixels, possibly doing INDEXED->RGB and adding alpha */
gegl_buffer_copy (src_buffer, GIMP_GEGL_RECT (x1, y1, x2 - x1, y2 - y1),
- dest_buffer, GIMP_GEGL_RECT (0,0,0,0));
+ dest_buffer, GIMP_GEGL_RECT (0, 0,0 ,0 ));
if (non_empty)
{
@@ -808,12 +771,10 @@ gimp_selection_extract (GimpSelection *selection,
}
}
- g_object_unref (dest_buffer);
-
*offset_x = x1 + off_x;
*offset_y = y1 + off_y;
- return tiles;
+ return dest_buffer;
}
GimpLayer *
@@ -854,9 +815,9 @@ gimp_selection_float (GimpSelection *selection,
C_("undo-type", "Float Selection"));
/* Cut or copy the selected region */
- buffer = gimp_selection_extract_buffer (selection, GIMP_PICKABLE (drawable), context,
- cut_image, FALSE, TRUE,
- &x1, &y1, NULL);
+ buffer = gimp_selection_extract (selection, GIMP_PICKABLE (drawable), context,
+ cut_image, FALSE, TRUE,
+ &x1, &y1, NULL);
/* Clear the selection */
gimp_channel_clear (GIMP_CHANNEL (selection), NULL, TRUE);
diff --git a/app/core/gimpselection.h b/app/core/gimpselection.h
index b707351..faff9b1 100644
--- a/app/core/gimpselection.h
+++ b/app/core/gimpselection.h
@@ -58,7 +58,7 @@ void gimp_selection_load (GimpSelection *selection,
GimpChannel *channel);
GimpChannel * gimp_selection_save (GimpSelection *selection);
-GeglBuffer * gimp_selection_extract_buffer(GimpSelection *selection,
+GeglBuffer * gimp_selection_extract (GimpSelection *selection,
GimpPickable *pickable,
GimpContext *context,
gboolean cut_image,
@@ -67,16 +67,6 @@ GeglBuffer * gimp_selection_extract_buffer(GimpSelection *selection,
gint *offset_x,
gint *offset_y,
GError **error);
-TileManager * gimp_selection_extract (GimpSelection *selection,
- GimpPickable *pickable,
- GimpContext *context,
- gboolean cut_image,
- gboolean keep_indexed,
- gboolean add_alpha,
- const Babl **format,
- gint *offset_x,
- gint *offset_y,
- GError **error);
GimpLayer * gimp_selection_float (GimpSelection *selection,
GimpDrawable *drawable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]