Commit bc8d5f84 authored by Michael Natterer's avatar Michael Natterer 😴

app: remove the "offset" API from TileManager

It made the transform code hard to read and never belonged into the
tile manager anyway. It's a simple pixel buffer that should not know
about any position in an image. Instead, pass around the offsets of
tile managers explicitly, so everything is less obscure for the price
of having more parameters. This will also help replacing TileManagers
with GeglBuffers.
parent 41ab7d8e
......@@ -23,8 +23,6 @@ struct _TileManager
{
gint ref_count; /* reference counter */
gint x, y; /* tile manager offsets */
gint width; /* the width of the tiled area */
gint height; /* the height of the tiled area */
gint bpp; /* the bpp of each tile */
......
......@@ -591,29 +591,6 @@ tile_manager_tiles_per_row (const TileManager *tm)
return tm->ntile_rows;
}
void
tile_manager_get_offsets (const TileManager *tm,
gint *x,
gint *y)
{
g_return_if_fail (tm != NULL);
g_return_if_fail (x != NULL && y != NULL);
*x = tm->x;
*y = tm->y;
}
void
tile_manager_set_offsets (TileManager *tm,
gint x,
gint y)
{
g_return_if_fail (tm != NULL);
tm->x = x;
tm->y = y;
}
gint64
tile_manager_get_memsize (const TileManager *tm,
gboolean sparse)
......
......@@ -98,13 +98,6 @@ gint tile_manager_bpp (const TileManager *tm);
gint tile_manager_tiles_per_col (const TileManager *tm);
gint tile_manager_tiles_per_row (const TileManager *tm);
void tile_manager_get_offsets (const TileManager *tm,
gint *x,
gint *y);
void tile_manager_set_offsets (TileManager *tm,
gint x,
gint y);
gint64 tile_manager_get_memsize (const TileManager *tm,
gboolean sparse);
......
......@@ -495,6 +495,8 @@ gimp_edit_extract (GimpImage *image,
GError **error)
{
TileManager *tiles;
gint offset_x;
gint offset_y;
if (cut_pixels)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_CUT, C_("undo-type", "Cut"));
......@@ -502,14 +504,16 @@ gimp_edit_extract (GimpImage *image,
/* Cut/copy the mask portion from the image */
tiles = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
pickable, context,
cut_pixels, FALSE, FALSE, error);
cut_pixels, FALSE, FALSE,
&offset_x, &offset_y, error);
if (cut_pixels)
gimp_image_undo_group_end (image);
if (tiles)
{
GimpBuffer *buffer = gimp_buffer_new (tiles, _("Global Buffer"), FALSE);
GimpBuffer *buffer = gimp_buffer_new (tiles, _("Global Buffer"),
offset_x, offset_y, FALSE);
tile_manager_unref (tiles);
......
......@@ -169,6 +169,8 @@ void
gimp_transform_region (GimpPickable *pickable,
GimpContext *context,
TileManager *orig_tiles,
gint orig_offset_x,
gint orig_offset_y,
PixelRegion *destPR,
gint dest_x1,
gint dest_y1,
......@@ -187,8 +189,8 @@ gimp_transform_region (GimpPickable *pickable,
g_return_if_fail (GIMP_IS_PICKABLE (pickable));
tile_manager_get_offsets (orig_tiles, &u1, &v1);
u1 = orig_offset_x;
v1 = orig_offset_y;
u2 = u1 + tile_manager_width (orig_tiles);
v2 = v1 + tile_manager_height (orig_tiles);
......
......@@ -22,6 +22,8 @@
void gimp_transform_region (GimpPickable *pickable,
GimpContext *context,
TileManager *orig_tiles,
gint orig_offset_x,
gint orig_offset_y,
PixelRegion *destPR,
gint dest_x1,
gint dest_y1,
......
......@@ -216,6 +216,8 @@ gimp_buffer_get_description (GimpViewable *viewable,
GimpBuffer *
gimp_buffer_new (TileManager *tiles,
const gchar *name,
gint offset_x,
gint offset_y,
gboolean copy_pixels)
{
GimpBuffer *buffer;
......@@ -236,12 +238,17 @@ gimp_buffer_new (TileManager *tiles,
else
buffer->tiles = tile_manager_ref (tiles);
buffer->offset_x = offset_x;
buffer->offset_y = offset_y;
return buffer;
}
GimpBuffer *
gimp_buffer_new_from_pixbuf (GdkPixbuf *pixbuf,
const gchar *name)
const gchar *name,
gint offset_x,
gint offset_y)
{
GimpBuffer *buffer;
TileManager *tiles;
......@@ -272,7 +279,7 @@ gimp_buffer_new_from_pixbuf (GdkPixbuf *pixbuf,
pixel_region_set_row (&destPR, 0, y, width, pixels);
}
buffer = gimp_buffer_new (tiles, name, FALSE);
buffer = gimp_buffer_new (tiles, name, offset_x, offset_y, FALSE);
tile_manager_unref (tiles);
......
......@@ -37,6 +37,8 @@ struct _GimpBuffer
GimpViewable parent_instance;
TileManager *tiles;
gint offset_x;
gint offset_y;
};
struct _GimpBufferClass
......@@ -49,9 +51,13 @@ GType gimp_buffer_get_type (void) G_GNUC_CONST;
GimpBuffer * gimp_buffer_new (TileManager *tiles,
const gchar *name,
gint offset_x,
gint offset_y,
gboolean copy_pixels);
GimpBuffer * gimp_buffer_new_from_pixbuf (GdkPixbuf *pixbuf,
const gchar *name);
const gchar *name,
gint offset_x,
gint offset_y);
gint gimp_buffer_get_width (const GimpBuffer *buffer);
gint gimp_buffer_get_height (const GimpBuffer *buffer);
......
......@@ -71,11 +71,15 @@ TileManager *
gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
gint orig_offset_x,
gint orig_offset_y,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gint recursion_level,
GimpTransformResize clip_result,
gint *new_offset_x,
gint *new_offset_y,
GimpProgress *progress)
{
GimpImage *image;
......@@ -91,6 +95,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (orig_tiles != NULL, NULL);
g_return_val_if_fail (matrix != NULL, NULL);
g_return_val_if_fail (new_offset_x != NULL, NULL);
g_return_val_if_fail (new_offset_y != NULL, NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -111,8 +117,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
gimp_matrix3_invert (&m);
}
tile_manager_get_offsets (orig_tiles, &u1, &v1);
u1 = orig_offset_x;
v1 = orig_offset_y;
u2 = u1 + tile_manager_width (orig_tiles);
v2 = v1 + tile_manager_height (orig_tiles);
......@@ -131,11 +137,12 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
tile_manager_bpp (orig_tiles));
pixel_region_init (&destPR, new_tiles,
0, 0, x2 - x1, y2 - y1, TRUE);
tile_manager_set_offsets (new_tiles, x1, y1);
gimp_transform_region (GIMP_PICKABLE (drawable),
context,
orig_tiles,
orig_offset_x,
orig_offset_y,
&destPR,
x1,
y1,
......@@ -146,6 +153,9 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
recursion_level,
progress);
*new_offset_x = x1;
*new_offset_y = y1;
return new_tiles;
}
......@@ -153,9 +163,13 @@ TileManager *
gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
gint orig_offset_x,
gint orig_offset_y,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result)
gboolean clip_result,
gint *new_offset_x,
gint *new_offset_y)
{
GimpImage *image;
TileManager *new_tiles;
......@@ -174,12 +188,12 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
image = gimp_item_get_image (GIMP_ITEM (drawable));
orig_x = orig_offset_x;
orig_y = orig_offset_y;
orig_width = tile_manager_width (orig_tiles);
orig_height = tile_manager_height (orig_tiles);
orig_bpp = tile_manager_bpp (orig_tiles);
tile_manager_get_offsets (orig_tiles, &orig_x, &orig_y);
new_x = orig_x;
new_y = orig_y;
new_width = orig_width;
......@@ -210,7 +224,8 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
gint clip_x, clip_y;
gint clip_width, clip_height;
tile_manager_set_offsets (new_tiles, orig_x, orig_y);
*new_offset_x = orig_x;
*new_offset_y = orig_y;
gimp_image_get_background (image, context, gimp_drawable_type (drawable),
bg_color);
......@@ -237,7 +252,8 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
}
else
{
tile_manager_set_offsets (new_tiles, new_x, new_y);
*new_offset_x = new_x;
*new_offset_y = new_y;
orig_x = 0;
orig_y = 0;
......@@ -321,10 +337,14 @@ TileManager *
gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
gint orig_offset_x,
gint orig_offset_y,
GimpRotationType rotate_type,
gdouble center_x,
gdouble center_y,
gboolean clip_result)
gboolean clip_result,
gint *new_offset_x,
gint *new_offset_y)
{
GimpImage *image;
TileManager *new_tiles;
......@@ -344,12 +364,12 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
image = gimp_item_get_image (GIMP_ITEM (drawable));
orig_x = orig_offset_x;
orig_y = orig_offset_y;
orig_width = tile_manager_width (orig_tiles);
orig_height = tile_manager_height (orig_tiles);
orig_bpp = tile_manager_bpp (orig_tiles);
tile_manager_get_offsets (orig_tiles, &orig_x, &orig_y);
switch (rotate_type)
{
case GIMP_ROTATE_90:
......@@ -394,7 +414,8 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
new_tiles = tile_manager_new (orig_width, orig_height, orig_bpp);
tile_manager_set_offsets (new_tiles, orig_x, orig_y);
*new_offset_x = orig_x;
*new_offset_y = orig_y;
gimp_image_get_background (image, context, gimp_drawable_type (drawable),
bg_color);
......@@ -469,7 +490,8 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
{
new_tiles = tile_manager_new (new_width, new_height, orig_bpp);
tile_manager_set_offsets (new_tiles, new_x, new_y);
*new_offset_x = new_x;
*new_offset_y = new_y;
orig_x = 0;
orig_y = 0;
......@@ -555,6 +577,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
{
GimpImage *image;
TileManager *orig_tiles;
gint offset_x;
gint offset_y;
gint new_offset_x;
gint new_offset_y;
gboolean new_layer;
GimpDrawable *result = NULL;
......@@ -572,7 +598,8 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
C_("undo-type", "Transform"));
/* Cut/Copy from the specified drawable */
orig_tiles = gimp_drawable_transform_cut (drawable, context, &new_layer);
orig_tiles = gimp_drawable_transform_cut (drawable, context,
&offset_x, &offset_y, &new_layer);
if (orig_tiles)
{
......@@ -601,11 +628,14 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_affine (drawable, context,
orig_tiles,
offset_x, offset_y,
matrix,
direction,
interpolation_type,
recursion_level,
clip_result,
&new_offset_x,
&new_offset_y,
progress);
/* Free the cut/copied buffer */
......@@ -614,6 +644,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
if (new_tiles)
{
result = gimp_drawable_transform_paste (drawable, new_tiles,
new_offset_x, new_offset_y,
new_layer);
tile_manager_unref (new_tiles);
}
......@@ -634,6 +665,10 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
{
GimpImage *image;
TileManager *orig_tiles;
gint offset_x;
gint offset_y;
gint new_offset_x;
gint new_offset_y;
gboolean new_layer;
GimpDrawable *result = NULL;
......@@ -649,7 +684,8 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
C_("undo-type", "Flip"));
/* Cut/Copy from the specified drawable */
orig_tiles = gimp_drawable_transform_cut (drawable, context, &new_layer);
orig_tiles = gimp_drawable_transform_cut (drawable, context,
&offset_x, &offset_y, &new_layer);
if (orig_tiles)
{
......@@ -677,8 +713,12 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
{
new_tiles = gimp_drawable_transform_tiles_flip (drawable, context,
orig_tiles,
offset_x,
offset_y,
flip_type, axis,
clip_result);
clip_result,
&new_offset_x,
&new_offset_y);
/* Free the cut/copied buffer */
tile_manager_unref (orig_tiles);
......@@ -687,6 +727,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
if (new_tiles)
{
result = gimp_drawable_transform_paste (drawable, new_tiles,
new_offset_x, new_offset_y,
new_layer);
tile_manager_unref (new_tiles);
}
......@@ -708,6 +749,10 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
{
GimpImage *image;
TileManager *orig_tiles;
gint offset_x;
gint offset_y;
gint new_offset_x;
gint new_offset_y;
gboolean new_layer;
GimpDrawable *result = NULL;
......@@ -723,7 +768,8 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
C_("undo-type", "Rotate"));
/* Cut/Copy from the specified drawable */
orig_tiles = gimp_drawable_transform_cut (drawable, context, &new_layer);
orig_tiles = gimp_drawable_transform_cut (drawable, context,
&offset_x, &offset_y, &new_layer);
if (orig_tiles)
{
......@@ -750,9 +796,13 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_rotate (drawable, context,
orig_tiles,
offset_x,
offset_y,
rotate_type,
center_x, center_y,
clip_result);
clip_result,
&new_offset_x,
&new_offset_y);
/* Free the cut/copied buffer */
tile_manager_unref (orig_tiles);
......@@ -760,6 +810,7 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
if (new_tiles)
{
result = gimp_drawable_transform_paste (drawable, new_tiles,
new_offset_x, new_offset_y,
new_layer);
tile_manager_unref (new_tiles);
}
......@@ -774,6 +825,8 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
TileManager *
gimp_drawable_transform_cut (GimpDrawable *drawable,
GimpContext *context,
gint *offset_x,
gint *offset_y,
gboolean *new_layer)
{
GimpImage *image;
......@@ -782,6 +835,8 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (offset_x != NULL, NULL);
g_return_val_if_fail (offset_y != NULL, NULL);
g_return_val_if_fail (new_layer != NULL, NULL);
image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -801,6 +856,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
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);
......@@ -819,6 +875,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
GIMP_PICKABLE (drawable),
context,
FALSE, TRUE, GIMP_IS_LAYER (drawable),
offset_x, offset_y,
NULL);
*new_layer = FALSE;
......@@ -830,13 +887,13 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
GimpDrawable *
gimp_drawable_transform_paste (GimpDrawable *drawable,
TileManager *tiles,
gint offset_x,
gint offset_y,
gboolean new_layer)
{
GimpImage *image;
GimpLayer *layer = NULL;
const gchar *undo_desc = NULL;
gint offset_x;
gint offset_y;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
......@@ -851,8 +908,6 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
else
return NULL;
tile_manager_get_offsets (tiles, &offset_x, &offset_y);
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE, undo_desc);
if (new_layer)
......
......@@ -35,26 +35,38 @@ typedef enum
TileManager * gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
gint orig_offset_x,
gint orig_offset_y,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gint recursion_level,
GimpTransformResize clip_result,
gint *new_offset_x,
gint *new_offset_y,
GimpProgress *progress);
TileManager * gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
gint orig_offset_x,
gint orig_offset_y,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result);
gboolean clip_result,
gint *new_offset_x,
gint *new_offset_y);
TileManager * gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
gint orig_offset_x,
gint orig_offset_y,
GimpRotationType rotate_type,
gdouble center_x,
gdouble center_y,
gboolean clip_result);
gboolean clip_result,
gint *new_offset_x,
gint *new_offset_y);
GimpDrawable * gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpContext *context,
......@@ -80,9 +92,13 @@ GimpDrawable * gimp_drawable_transform_rotate (GimpDrawable *dra
TileManager * gimp_drawable_transform_cut (GimpDrawable *drawable,
GimpContext *context,
gint *offset_x,
gint *offset_y,
gboolean *new_layer);
GimpDrawable * gimp_drawable_transform_paste (GimpDrawable *drawable,
TileManager *tiles,
gint offset_x,
gint offset_y,
gboolean new_layer);
......
......@@ -611,26 +611,21 @@ gimp_drawable_flip (GimpItem *item,
GimpDrawable *drawable = GIMP_DRAWABLE (item);
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
gint new_off_x, new_off_y;
gimp_item_get_offset (item, &off_x, &off_y);
tile_manager_get_offsets (gimp_drawable_get_tiles (drawable),
&old_off_x, &old_off_y);
tile_manager_set_offsets (gimp_drawable_get_tiles (drawable),
off_x, off_y);
tiles = gimp_drawable_transform_tiles_flip (drawable, context,
gimp_drawable_get_tiles (drawable),
off_x, off_y,
flip_type, axis,
clip_result);
tile_manager_set_offsets (gimp_drawable_get_tiles (drawable),
old_off_x, old_off_y);
clip_result,
&new_off_x, &new_off_y);
if (tiles)
{
gimp_drawable_transform_paste (drawable, tiles, FALSE);
gimp_drawable_transform_paste (drawable, tiles,
new_off_x, new_off_y, FALSE);
tile_manager_unref (tiles);
}
}
......@@ -646,26 +641,21 @@ gimp_drawable_rotate (GimpItem *item,
GimpDrawable *drawable = GIMP_DRAWABLE (item);
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
gint new_off_x, new_off_y;
gimp_item_get_offset (item, &off_x, &off_y);
tile_manager_get_offsets (gimp_drawable_get_tiles (drawable),
&old_off_x, &old_off_y);
tile_manager_set_offsets (gimp_drawable_get_tiles (drawable),
off_x, off_y);
tiles = gimp_drawable_transform_tiles_rotate (drawable, context,
gimp_drawable_get_tiles (drawable),
off_x, off_y,
rotate_type, center_x, center_y,
clip_result);
tile_manager_set_offsets (gimp_drawable_get_tiles (drawable),
old_off_x, old_off_y);
clip_result,
&new_off_x, &new_off_y);
if (tiles)
{
gimp_drawable_transform_paste (drawable, tiles, FALSE);
gimp_drawable_transform_paste (drawable, tiles,
new_off_x, new_off_y, FALSE);
tile_manager_unref (tiles);
}
}
......@@ -683,29 +673,24 @@ gimp_drawable_transform (GimpItem *item,
GimpDrawable *drawable = GIMP_DRAWABLE (item);
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
gint new_off_x, new_off_y;
gimp_item_get_offset (item, &off_x, &off_y);
tile_manager_get_offsets (gimp_drawable_get_tiles (drawable),
&old_off_x, &old_off_y);
tile_manager_set_offsets (gimp_drawable_get_tiles (drawable),
off_x, off_y);
tiles = gimp_drawable_transform_tiles_affine (drawable, context,
gimp_drawable_get_tiles (drawable),
off_x, off_y,
matrix, direction,
interpolation_type,
recursion_level,
clip_result,
&new_off_x, &new_off_y,
progress);
tile_manager_set_offsets (gimp_drawable_get_tiles (drawable),
old_off_x, old_off_y);
if (tiles)
{
gimp_drawable_transform_paste (drawable, tiles, FALSE);
gimp_drawable_transform_paste (drawable, tiles,
new_off_y, new_off_y, FALSE);
tile_manager_unref (tiles);
}
}
......
......@@ -627,6 +627,8 @@ gimp_selection_extract (GimpSelection *selection,
gboolean cut_image,
gboolean keep_indexed,
gboolean add_alpha,
gint *offset_x,
gint *offset_y,
GError **error)
{
GimpImage *image;
......@@ -736,7 +738,6 @@ gimp_selection_extract (GimpSelection *selection,
/* Allocate the temp buffer */
tiles = tile_manager_new (x2 - x1, y2 - y1, bytes);
tile_manager_set_offsets (tiles, x1 + off_x, y1 + off_y);
/* configure the pixel regions */
pixel_region_init (&srcPR, gimp_pickable_get_tiles (pickable),
......@@ -809,6 +810,9 @@ gimp_selection_extract (GimpSelection *selection,
}
}
*offset_x = x1 + off_x;
*offset_y = y1 + off_y;
return tiles;
}
......@@ -851,7 +855,7 @@ gimp_selection_float (GimpSelection *selection,
/* Cut or copy the selected region */
tiles = gimp_selection_extract (selection, GIMP_PICKABLE (drawable), context,
cut_image, FALSE, TRUE, NULL);
cut_image, FALSE, TRUE, &x1, &y1, NULL);
/* Clear the selection */
gimp_channel_clear (GIMP_CHANNEL (selection), NULL, TRUE);
......@@ -867,8 +871,6 @@ gimp_selection_float (GimpSelection *selection,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
/* Set the offsets */
tile_manager_get_offsets (tiles, &x1, &y1);
gimp_item_set_offset (GIMP_ITEM (layer), x1 + off_x, y1 + off_y);
/* Free the temp buffer */
......
......@@ -64,6 +64,8 @@ TileManager * gimp_selection_extract (GimpSelection *selection,
gboolean cut_image,
gboolean keep_indexed,
gboolean add_alpha,
gint *offset_x,
gint *offset_y,
GError **error);
GimpLayer * gimp_selection_float (GimpSelection *selection,
......
......@@ -380,8 +380,6 @@ gimp_perspective_clone_get_source (GimpSourceCore *source_core,
orig_tiles = tile_manager_new (xmax - xmin, ymax - ymin, bytes);
tile_manager_set_offsets (orig_tiles, xmin, ymin);
pixel_region_init (&destPR, orig_tiles,
0, 0, xmax - xmin, ymax - ymin,
TRUE);
......@@ -405,6 +403,7 @@ gimp_perspective_clone_get_source (GimpSourceCore *source_core,
gimp_transform_region (src_pickable,
GIMP_CONTEXT (paint_options),
orig_tiles,
xmin, ymin,
&destPR,
x1d, y1d, x2d, y2d,
&matrix,
......
......@@ -58,7 +58,9 @@ static void gimp_flip_tool_cursor_update (GimpTool *tool,
static TileManager * gimp_flip_tool_transform (GimpTransformTool *tool,
GimpItem *item,