Commit c1ab39a5 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

removed gimp_drawable_offsets().

2003-05-08  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawable.[ch]: removed gimp_drawable_offsets().

	* app/core/gimpitem.[ch]: added gimp_item_offsets().

	* app/core/gimpdrawable-blend.c
	* app/core/gimpdrawable-bucket-fill.c
	* app/core/gimpdrawable-histogram.c
	* app/core/gimpedit.c
	* app/core/gimpimage-convert.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-mask-select.c
	* app/core/gimpimage-mask.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-pick-color.c
	* app/core/gimpimage-preview.c
	* app/core/gimpimage-projection.c
	* app/core/gimpimage-undo-push.c
	* app/core/gimpimage.c
	* app/core/gimplayer-floating-sel.c
	* app/core/gimplayer.c
	* app/display/gimpdisplay.c
	* app/display/gimpdisplayshell-transform.c
	* app/display/gimpdisplayshell.c
	* app/gui/channels-commands.c
	* app/gui/layers-commands.c
	* app/paint/gimppaintcore.c
	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpblendtool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpfliptool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimpinktool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimppainttool.c
	* app/tools/gimprectselecttool.c
	* app/tools/gimptransformtool.c
	* app/widgets/gimpselectioneditor.c
	* app/widgets/gimptoolbox.c
	* tools/pdbgen/pdb/color.pdb
	* tools/pdbgen/pdb/drawable.pdb: changed accordingly.

	* app/pdb/color_cmds.c
	* app/pdb/drawable_cmds.c: regenerated.
parent 54878b79
2003-05-08 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.[ch]: removed gimp_drawable_offsets().
* app/core/gimpitem.[ch]: added gimp_item_offsets().
* app/core/gimpdrawable-blend.c
* app/core/gimpdrawable-bucket-fill.c
* app/core/gimpdrawable-histogram.c
* app/core/gimpedit.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-mask-select.c
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-pick-color.c
* app/core/gimpimage-preview.c
* app/core/gimpimage-projection.c
* app/core/gimpimage-undo-push.c
* app/core/gimpimage.c
* app/core/gimplayer-floating-sel.c
* app/core/gimplayer.c
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-transform.c
* app/display/gimpdisplayshell.c
* app/gui/channels-commands.c
* app/gui/layers-commands.c
* app/paint/gimppaintcore.c
* app/tools/gimpbezierselecttool.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpclonetool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimpcurvestool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfliptool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimpinktool.c
* app/tools/gimplevelstool.c
* app/tools/gimppainttool.c
* app/tools/gimprectselecttool.c
* app/tools/gimptransformtool.c
* app/widgets/gimpselectioneditor.c
* app/widgets/gimptoolbox.c
* tools/pdbgen/pdb/color.pdb
* tools/pdbgen/pdb/drawable.pdb: changed accordingly.
* app/pdb/color_cmds.c
* app/pdb/drawable_cmds.c: regenerated.
2003-05-08 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.[ch]: removed gimp_drawable_width,height().
......@@ -326,9 +326,9 @@ channels_new_channel_query (GimpImage *gimage,
if (template)
{
gimp_item_offsets (GIMP_ITEM (template), &off_x, &off_y);
width = gimp_item_width (GIMP_ITEM (template));
height = gimp_item_height (GIMP_ITEM (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
color = template->color;
}
else
......
......@@ -301,7 +301,7 @@ layers_crop_cmd_callback (GtkWidget *widget,
return;
}
gimp_drawable_offsets (GIMP_DRAWABLE (active_layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (active_layer), &off_x, &off_y);
off_x -= x1;
off_y -= y1;
......@@ -503,7 +503,7 @@ layers_new_layer_query (GimpImage *gimage,
GtkWidget *button;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! template || GIMP_IS_LAYER (template));
g_return_if_fail (template == NULL || GIMP_IS_LAYER (template));
/* If there is a floating selection, the new command transforms
* the current fs into a new layer
......@@ -525,9 +525,9 @@ layers_new_layer_query (GimpImage *gimage,
if (template)
{
width = gimp_item_width (GIMP_ITEM (template));
height = gimp_item_height (GIMP_ITEM (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (template), &off_x, &off_y);
width = gimp_item_width (GIMP_ITEM (template));
height = gimp_item_height (GIMP_ITEM (template));
opacity = template->opacity;
mode = template->mode;
}
......
......@@ -201,7 +201,7 @@ gimp_edit_paste (GimpImage *gimage,
/* Set the offsets to the center of the image */
if (drawable)
{
gimp_drawable_offsets (drawable, &cx, &cy);
gimp_item_offsets (GIMP_ITEM (drawable), &cx, &cy);
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
cx += (x1 + x2) >> 1;
cy += (y1 + y2) >> 1;
......
......@@ -303,7 +303,7 @@ gimp_image_mask_select_fuzzy (GimpImage *gimage,
}
else
{
gimp_drawable_offsets (drawable, &mask_x, &mask_y);
gimp_item_offsets (GIMP_ITEM (drawable), &mask_x, &mask_y);
}
gimp_image_mask_select_channel (gimage,
......@@ -354,7 +354,7 @@ gimp_image_mask_select_by_color (GimpImage *gimage,
}
else
{
gimp_drawable_offsets (drawable, &mask_x, &mask_y);
gimp_item_offsets (GIMP_ITEM (drawable), &mask_x, &mask_y);
}
gimp_image_mask_select_channel (gimage,
......
......@@ -622,7 +622,7 @@ gradient_precalc_shapeburst (GimpImage *gimage,
gint offx, offy;
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
gimp_drawable_offsets (drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy);
/* the selection mask */
mask = gimp_image_get_mask (gimage);
......
......@@ -247,7 +247,7 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
gint off_y = 0;
if (! sample_merged)
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
gimp_channel_combine_mask (mask, gimp_image_get_mask (gimage),
GIMP_CHANNEL_OP_INTERSECT,
......@@ -265,7 +265,7 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
item = GIMP_ITEM (drawable);
/* Limit the channel bounds to the drawable's extents */
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (item, &off_x, &off_y);
x1 = CLAMP (x1, off_x, (off_x + gimp_item_width (item)));
y1 = CLAMP (y1, off_y, (off_y + gimp_item_height (item)));
......
......@@ -59,7 +59,7 @@ gimp_drawable_calculate_histogram (GimpDrawable *drawable,
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
sel_mask = gimp_image_get_mask (gimage);
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
pixel_region_init (&mask, gimp_drawable_data (GIMP_DRAWABLE (sel_mask)),
x1 + off_x, y1 + off_y, (x2 - x1), (y2 - y1), FALSE);
gimp_histogram_calculate (histogram, &region, &mask);
......
......@@ -504,17 +504,19 @@ gimp_drawable_update (GimpDrawable *drawable,
gint w,
gint h)
{
GimpItem *item;
GimpImage *gimage;
gint offset_x;
gint offset_y;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
item = GIMP_ITEM (drawable);
gimage = gimp_item_get_image (item);
g_return_if_fail (gimage != NULL);
gimp_drawable_offsets (drawable, &offset_x, &offset_y);
gimp_item_offsets (item, &offset_x, &offset_y);
x += offset_x;
y += offset_y;
......@@ -712,7 +714,7 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (item, &off_x, &off_y);
*x1 = CLAMP (*x1 - off_x, 0, gimp_item_width (item));
*y1 = CLAMP (*y1 - off_y, 0, gimp_item_height (item));
......@@ -856,17 +858,6 @@ gimp_drawable_set_visible (GimpDrawable *drawable,
}
}
void
gimp_drawable_offsets (const GimpDrawable *drawable,
gint *off_x,
gint *off_y)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (off_x) *off_x = GIMP_ITEM (drawable)->offset_x;
if (off_y) *off_y = GIMP_ITEM (drawable)->offset_y;
}
guchar *
gimp_drawable_cmap (const GimpDrawable *drawable)
{
......
......@@ -117,10 +117,6 @@ void gimp_drawable_set_visible (GimpDrawable *drawable,
gboolean visible,
gboolean push_undo);
void gimp_drawable_offsets (const GimpDrawable *drawable,
gint *offset_x,
gint *offset_y);
guchar * gimp_drawable_cmap (const GimpDrawable *drawable);
guchar * gimp_drawable_get_color_at (GimpDrawable *drawable,
......
......@@ -201,7 +201,7 @@ gimp_edit_paste (GimpImage *gimage,
/* Set the offsets to the center of the image */
if (drawable)
{
gimp_drawable_offsets (drawable, &cx, &cy);
gimp_item_offsets (GIMP_ITEM (drawable), &cx, &cy);
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
cx += (x1 + x2) >> 1;
cy += (y1 + y2) >> 1;
......
......@@ -1282,7 +1282,7 @@ generate_histogram_rgb (CFHistogram histogram,
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offsetx, &offsety);
gimp_item_offsets (GIMP_ITEM (layer), &offsetx, &offsety);
/* g_print ("col_limit = %d, nfc = %d\n", col_limit, num_found_cols);*/
......@@ -2846,7 +2846,7 @@ median_cut_pass2_no_dither_gray (QuantizeObj *quantobj,
gint offsetx, offsety;
gpointer pr;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offsetx, &offsety);
gimp_item_offsets (GIMP_ITEM (layer), &offsetx, &offsety);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
......@@ -2922,7 +2922,7 @@ median_cut_pass2_fixed_dither_gray (QuantizeObj *quantobj,
gint offsetx, offsety;
gpointer pr;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offsetx, &offsety);
gimp_item_offsets (GIMP_ITEM (layer), &offsetx, &offsety);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
......@@ -3014,7 +3014,7 @@ median_cut_pass2_no_dither_rgb (QuantizeObj *quantobj,
gint offsetx, offsety;
gulong *index_used_count = quantobj->index_used_count;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offsetx, &offsety);
gimp_item_offsets (GIMP_ITEM (layer), &offsetx, &offsety);
/* In the case of web/mono palettes, we actually force
* grayscale drawables through the rgb pass2 functions
......@@ -3103,7 +3103,7 @@ median_cut_pass2_fixed_dither_rgb (QuantizeObj *quantobj,
gint offsetx, offsety;
gulong *index_used_count = quantobj->index_used_count;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offsetx, &offsety);
gimp_item_offsets (GIMP_ITEM (layer), &offsetx, &offsety);
/* In the case of web/mono palettes, we actually force
* grayscale drawables through the rgb pass2 functions
......@@ -3220,7 +3220,7 @@ median_cut_pass2_nodestruct_dither_rgb (QuantizeObj *quantobj,
gint lastblue = -1;
gint offsetx, offsety;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offsetx, &offsety);
gimp_item_offsets (GIMP_ITEM (layer), &offsetx, &offsety);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
......@@ -3416,7 +3416,7 @@ median_cut_pass2_fs_dither_gray (QuantizeObj *quantobj,
gint width, height;
gulong *index_used_count = quantobj->index_used_count;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offsetx, &offsety);
gimp_item_offsets (GIMP_ITEM (layer), &offsetx, &offsety);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
......@@ -3644,7 +3644,7 @@ median_cut_pass2_fs_dither_rgb (QuantizeObj *quantobj,
gint global_gmax = 0, global_gmin = G_MAXINT;
gint global_bmax = 0, global_bmin = G_MAXINT;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offsetx, &offsety);
gimp_item_offsets (GIMP_ITEM (layer), &offsetx, &offsety);
/* In the case of web/mono palettes, we actually force
* grayscale drawables through the rgb pass2 functions
......
......@@ -120,7 +120,7 @@ gimp_image_crop (GimpImage *gimage,
layer = gimp_image_get_active_layer (gimage);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &doff_x, &doff_y);
gimp_item_offsets (GIMP_ITEM (layer), &doff_x, &doff_y);
off_x = (doff_x - x1);
off_y = (doff_y - y1);
......@@ -184,12 +184,10 @@ gimp_image_crop (GimpImage *gimage,
gimp_layer_translate (layer, -x1, -y1, TRUE);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
if (crop_layers)
{
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
lx1 = CLAMP (off_x, 0, gimage->width);
ly1 = CLAMP (off_y, 0, gimage->height);
lx2 = CLAMP ((gimp_item_width (GIMP_ITEM (layer)) + off_x),
......
......@@ -303,7 +303,7 @@ gimp_image_mask_select_fuzzy (GimpImage *gimage,
}
else
{
gimp_drawable_offsets (drawable, &mask_x, &mask_y);
gimp_item_offsets (GIMP_ITEM (drawable), &mask_x, &mask_y);
}
gimp_image_mask_select_channel (gimage,
......@@ -354,7 +354,7 @@ gimp_image_mask_select_by_color (GimpImage *gimage,
}
else
{
gimp_drawable_offsets (drawable, &mask_x, &mask_y);
gimp_item_offsets (GIMP_ITEM (drawable), &mask_x, &mask_y);
}
gimp_image_mask_select_channel (gimage,
......
......@@ -106,7 +106,8 @@ gimp_image_mask_boundary (GimpImage *gimage,
{
gint off_x, off_y;
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
x1 = CLAMP (off_x, 0, gimage->width);
y1 = CLAMP (off_y, 0, gimage->height);
x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), 0,
......@@ -273,7 +274,7 @@ gimp_image_mask_extract (GimpImage *gimage,
if (cut_gimage && non_empty)
gimp_drawable_push_undo (drawable, NULL, x1, y1, x2, y2, NULL, FALSE);
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
/* Allocate the temp buffer */
tiles = tile_manager_new ((x2 - x1), (y2 - y1), bytes);
......@@ -692,7 +693,7 @@ gimp_image_mask_stroke (GimpImage *gimage,
pdb_string = gimp_context_get_tool (context)->paint_info->pdb_string;
/* find the drawable offsets */
gimp_drawable_offsets (drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy);
gimp_image_mask_stroking = TRUE;
/* Start an undo group */
......
......@@ -235,7 +235,8 @@ gimp_image_merge_layers (GimpImage *gimage,
while (merge_list)
{
layer = (GimpLayer *) merge_list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
switch (merge_type)
{
......@@ -245,7 +246,7 @@ gimp_image_merge_layers (GimpImage *gimage,
{
x1 = off_x;
y1 = off_y;
x2 = off_x + gimp_item_width (GIMP_ITEM (layer));
x2 = off_x + gimp_item_width (GIMP_ITEM (layer));
y2 = off_y + gimp_item_height (GIMP_ITEM (layer));
}
else
......@@ -409,10 +410,11 @@ gimp_image_merge_layers (GimpImage *gimage,
return NULL;
}
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
x3 = CLAMP (off_x, x1, x2);
y3 = CLAMP (off_y, y1, y2);
x4 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), x1, x2);
x4 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), x1, x2);
y4 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), y1, y2);
/* configure the pixel regions */
......
......@@ -65,7 +65,7 @@ gimp_image_pick_color (GimpImage *gimage,
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
x -= off_x;
y -= off_y;
......
......@@ -236,11 +236,11 @@ gimp_image_get_new_preview (GimpViewable *viewable,
{
layer = (GimpLayer *) reverse_list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
x = (gint) RINT (ratio * off_x);
y = (gint) RINT (ratio * off_y);
w = (gint) RINT (ratio * gimp_item_width (GIMP_ITEM (layer)));
w = (gint) RINT (ratio * gimp_item_width (GIMP_ITEM (layer)));
h = (gint) RINT (ratio * gimp_item_height (GIMP_ITEM (layer)));
if (w < 1 || h < 1)
......
......@@ -390,7 +390,7 @@ gimp_image_construct_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
......@@ -520,7 +520,6 @@ gimp_image_initialize_projection (GimpImage *gimage,
{
GList *list;
GimpLayer *layer;
gint coverage = 0;
PixelRegion PR;
guchar clear[4] = { 0, 0, 0, 0 };
......@@ -534,17 +533,19 @@ gimp_image_initialize_projection (GimpImage *gimage,
list;
list = g_list_next (list))
{
gint off_x, off_y;
GimpItem *item;
gint off_x, off_y;
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
item = (GimpItem *) list->data;
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) &&
gimp_item_offsets (item, &off_x, &off_y);
if (gimp_drawable_get_visible (GIMP_DRAWABLE (item)) &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (item)) &&
(off_x <= x) &&
(off_y <= y) &&
(off_x + gimp_item_width (GIMP_ITEM (layer)) >= x + w) &&
(off_y + gimp_item_height (GIMP_ITEM (layer)) >= y + h))
(off_x + gimp_item_width (item) >= x + w) &&
(off_y + gimp_item_height (item) >= y + h))
{
coverage = 1;
break;
......@@ -579,8 +580,7 @@ gimp_image_construct (GimpImage *gimage,
if (gimage->layers)
{
gimp_drawable_offsets (GIMP_DRAWABLE ((GimpLayer*) gimage->layers->data),
&xoff, &yoff);
gimp_item_offsets (GIMP_ITEM (gimage->layers->data), &xoff, &yoff);
}
if ((gimage->layers) && /* There's a layer. */
......@@ -601,9 +601,8 @@ gimp_image_construct (GimpImage *gimage,
{
gint xoff;
gint yoff;
gimp_drawable_offsets (GIMP_DRAWABLE (gimage->layers->data),
&xoff, &yoff);
gimp_item_offsets (GIMP_ITEM (gimage->layers->data), &xoff, &yoff);
if ((xoff==0) && (yoff==0)) /* Starts at 0,0 */
{
......
......@@ -1751,17 +1751,17 @@ undo_pop_layer_displace (GimpUndo *undo,
GimpUndoAccumulator *accum)
{
LayerDisplaceUndo *ldu;
GimpLayer *layer;
GimpItem *item;
gint offset_x;
gint offset_y;
ldu = (LayerDisplaceUndo *) undo->data;
layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
item = GIMP_ITEM_UNDO (undo)->item;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offset_x, &offset_y);
gimp_item_offsets (item, &offset_x, &offset_y);
gimp_layer_translate (layer,
gimp_layer_translate (GIMP_LAYER (item),
ldu->old_offset_x - offset_x,
ldu->old_offset_y - offset_y,
FALSE);
......
......@@ -1667,7 +1667,7 @@ gimp_image_apply_image (GimpImage *gimage,
}
/* get the layer offsets */
gimp_drawable_offsets (drawable, &offset_x, &offset_y);
gimp_item_offsets (item, &offset_x, &offset_y);
/* make sure the image application coordinates are within gimage bounds */
x1 = CLAMP (x, 0, gimp_item_width (item));
......@@ -1789,7 +1789,7 @@ gimp_image_replace_image (GimpImage *gimage,
}
/* get the layer offsets */
gimp_drawable_offsets (drawable, &offset_x, &offset_y);
gimp_item_offsets (item, &offset_x, &offset_y);
/* make sure the image application coordinates are within gimage bounds */
x1 = CLAMP (x, 0, gimp_item_width (item));
......@@ -2616,8 +2616,8 @@ gimp_image_remove_layer (GimpImage *gimage,
/* Send out REMOVED signal from layer */
gimp_item_removed (GIMP_ITEM (layer));
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x, &y);
w = gimp_item_width (GIMP_ITEM (layer));
gimp_item_offsets (GIMP_ITEM (layer), &x, &y);
w = gimp_item_width (GIMP_ITEM (layer));
h = gimp_item_height (GIMP_ITEM (layer));
g_object_unref (layer);
......@@ -2786,11 +2786,11 @@ gimp_image_position_layer (GimpImage *gimage,
gimp_container_reorder (gimage->layers, GIMP_OBJECT (layer), new_index);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
gimp_image_update (gimage,
off_x, off_y,
gimp_item_width (GIMP_ITEM (layer)),
gimp_item_width (GIMP_ITEM (layer)),
gimp_item_height (GIMP_ITEM (layer)));
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimage));
......
......@@ -344,6 +344,17 @@ gimp_item_height (const GimpItem *item)
return item->height;
}
void
gimp_item_offsets (const GimpItem *item,
gint *off_x,
gint *off_y)
{
g_return_if_fail (GIMP_IS_ITEM (item));
if (off_x) *off_x = item->offset_x;
if (off_y) *off_y = item->offset_y;
}
void
gimp_item_scale (GimpItem *item,
gint new_width,
......
......@@ -96,6 +96,9 @@ void gimp_item_rename (GimpItem *item,
gint gimp_item_width (const GimpItem *item);
gint gimp_item_height (const GimpItem *item);
void gimp_item_offsets (const GimpItem *item,
gint *offset_x,
gint *offset_y);
void gimp_item_scale (GimpItem *item,
gint new_width,
......
......@@ -184,13 +184,16 @@ floating_sel_reset (GimpLayer *layer)
void
floating_sel_to_layer (GimpLayer *layer)
{
GimpItem *item;
GimpImage *gimage;
gint off_x, off_y;
gint width, height;
g_return_if_fail (GIMP_IS_LAYER (layer));
if (! (gimage = gimp_item_get_image (GIMP_ITEM (layer))))
item = GIMP_ITEM (layer);
if (! (gimage = gimp_item_get_image (item)))
return;
/* Check if the floating layer belongs to a channel... */
......@@ -204,13 +207,14 @@ floating_sel_to_layer (GimpLayer *layer)
/* restore the contents of the drawable */
floating_sel_restore (layer,
GIMP_ITEM (layer)->offset_x,
GIMP_ITEM (layer)->offset_y,
GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height);
item->offset_x,
item->offset_y,
item->width,
item->height);
/* determine whether the resulting layer needs an update */
gimp_drawable_offsets (layer->fs.drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer->fs.drawable), &off_x, &off_y);
width = gimp_item_width (GIMP_ITEM (layer->fs.drawable));
height = gimp_item_height (GIMP_ITEM (layer->fs.drawable));
......@@ -270,7 +274,7 @@ floating_sel_store (GimpLayer *layer,
* drawable that this floating selection obscures. We do this so
* that it will be possible to subsequently restore the drawable's area
*/
gimp_drawable_offsets (layer->fs.drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (layer->fs.drawable), &offx, &offy);
/* Find the minimum area we need to uncover -- in gimage space */
x1 = MAX (GIMP_ITEM (layer)->offset_x, offx);
......@@ -317,7 +321,8 @@ floating_sel_restore (GimpLayer *layer,
*/
/* Find the minimum area we need to uncover -- in gimage space */
gimp_drawable_offsets (layer->fs.drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (layer->fs.drawable), &offx, &offy);
x1 = MAX (GIMP_ITEM (layer)->offset_x, offx);
y1 = MAX (GIMP_ITEM (layer)->offset_y, offy);
x2 = MIN (GIMP_ITEM (layer)->offset_x + GIMP_ITEM (layer)->width,
......@@ -422,7 +427,8 @@ floating_sel_composite (GimpLayer *layer,
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* Find the minimum area we need to composite -- in gimage space */
gimp_drawable_offsets (layer->fs.drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (layer->fs.drawable), &offx, &offy);
x1 = MAX (GIMP_ITEM (layer)->offset_x, offx);
y1 = MAX (GIMP_ITEM (layer)->offset_y, offy);
x2 = MIN (GIMP_ITEM (layer)->offset_x +
......
......@@ -1298,7 +1298,7 @@ gimp_layer_resize_to_image (GimpLayer *layer)
if (gimp_layer_is_floating_sel (layer))
floating_sel_relax (layer, TRUE);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &offset_x, &offset_y);
gimp_item_offsets (GIMP_ITEM (layer), &offset_x, &offset_y);
gimp_item_resize (GIMP_ITEM (layer), gimage->width, gimage->height,
offset_x, offset_y);
......
......@@ -390,7 +390,7 @@ gimp_image_construct_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
......@@ -520,7 +520,6 @@ gimp_image_initialize_projection (GimpImage *gimage,
{
GList *list;
GimpLayer *layer;
gint coverage = 0;
PixelRegion PR;
guchar clear[4] = { 0, 0, 0, 0 };
......@@ -534,17 +533,19 @@ gimp_image_initialize_projection (GimpImage *gimage,
list;
list = g_list_next (list))
{
gint off_x, off_y;
GimpItem *item;
gint off_x, off_y;
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
item = (GimpItem *) list->data;
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) &&
gimp_item_offsets (item, &off_x, &off_y);
if (gimp_drawable_get_visible (GIMP_DRAWABLE (item)) &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (item)) &&