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.
This commit is contained in:
Michael Natterer 2003-05-08 14:06:03 +00:00 committed by Michael Natterer
parent 54878b79ce
commit c1ab39a5e8
60 changed files with 367 additions and 394 deletions

View File

@ -1,3 +1,55 @@
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().

View File

@ -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

View File

@ -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)
{
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);
opacity = template->opacity;
mode = template->mode;
}

View File

@ -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;

View File

@ -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,

View File

@ -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);

View File

@ -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)));

View File

@ -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);

View File

@ -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)
{

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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),

View File

@ -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,

View File

@ -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 */

View File

@ -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)
{
@ -409,7 +410,8 @@ 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);

View File

@ -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;

View File

@ -236,7 +236,7 @@ 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);

View File

@ -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))
{
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. */
@ -602,8 +602,7 @@ 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 */
{

View File

@ -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);

View File

@ -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,7 +2616,7 @@ 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);
gimp_item_offsets (GIMP_ITEM (layer), &x, &y);
w = gimp_item_width (GIMP_ITEM (layer));
h = gimp_item_height (GIMP_ITEM (layer));
@ -2786,7 +2786,7 @@ 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,

View File

@ -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,

View File

@ -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,

View File

@ -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 +

View File

@ -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);

View File

@ -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))
{
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. */
@ -602,8 +602,7 @@ 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 */
{

View File

@ -393,29 +393,38 @@ gimp_display_coords_in_active_drawable (GimpDisplay *gdisp,
const GimpCoords *coords)
{
GimpDrawable *drawable;
gint x, y;
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), FALSE);
if (!gdisp->gimage)
return FALSE;
if (!(drawable = gimp_image_active_drawable (gdisp->gimage)))
return FALSE;
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_drawable_offsets (drawable, &x, &y);
if (drawable)
{
GimpItem *item;
gint x, y;
item = GIMP_ITEM (drawable);
gimp_item_offsets (item, &x, &y);
x = ROUND (coords->x) - x;
if (x < 0 || x > gimp_item_width (GIMP_ITEM (drawable)))
y = ROUND (coords->y) - y;
if (x < 0 || x > gimp_item_width (item))
return FALSE;
y = ROUND (coords->y) - y;
if (y < 0 || y > gimp_item_height (GIMP_ITEM (drawable)))
if (y < 0 || y > gimp_item_height (item))
return FALSE;
return TRUE;
}
return FALSE;
}
/* private functions */
static void

View File

@ -393,29 +393,38 @@ gimp_display_coords_in_active_drawable (GimpDisplay *gdisp,
const GimpCoords *coords)
{
GimpDrawable *drawable;
gint x, y;
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), FALSE);
if (!gdisp->gimage)
return FALSE;
if (!(drawable = gimp_image_active_drawable (gdisp->gimage)))
return FALSE;
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_drawable_offsets (drawable, &x, &y);
if (drawable)
{
GimpItem *item;
gint x, y;
item = GIMP_ITEM (drawable);
gimp_item_offsets (item, &x, &y);
x = ROUND (coords->x) - x;
if (x < 0 || x > gimp_item_width (GIMP_ITEM (drawable)))
y = ROUND (coords->y) - y;
if (x < 0 || x > gimp_item_width (item))
return FALSE;
y = ROUND (coords->y) - y;
if (y < 0 || y > gimp_item_height (GIMP_ITEM (drawable)))
if (y < 0 || y > gimp_item_height (item))
return FALSE;
return TRUE;
}
return FALSE;
}
/* private functions */
static void

View File

@ -1013,7 +1013,7 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
/* If there is a floating selection, handle things differently */
if ((layer = gimp_image_floating_sel (shell->gdisp->gimage)))
{
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
if (! gimp_channel_bounds (gimp_image_get_mask (shell->gdisp->gimage),
x1, y1, x2, y2))

View File

@ -100,7 +100,7 @@ gimp_display_shell_transform_xy (GimpDisplayShell *shell,
scaley = SCALEFACTOR_Y (shell);
if (use_offsets)
gimp_drawable_offsets (gimp_image_active_drawable (shell->gdisp->gimage),
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (shell->gdisp->gimage)),
&offset_x, &offset_y);
*nx = (gint) (scalex * (x + offset_x) - shell->offset_x);
@ -136,7 +136,7 @@ gimp_display_shell_untransform_xy (GimpDisplayShell *shell,
scaley = SCALEFACTOR_Y (shell);
if (use_offsets)
gimp_drawable_offsets (gimp_image_active_drawable (shell->gdisp->gimage),
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (shell->gdisp->gimage)),
&offset_x, &offset_y);
if (round)
@ -173,7 +173,7 @@ gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
scaley = SCALEFACTOR_Y (shell);
if (use_offsets)
gimp_drawable_offsets (gimp_image_active_drawable (shell->gdisp->gimage),
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (shell->gdisp->gimage)),
&offset_x, &offset_y);
*nx = scalex * (x + offset_x) - shell->offset_x;
@ -208,7 +208,7 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
scaley = SCALEFACTOR_Y (shell);
if (use_offsets)
gimp_drawable_offsets (gimp_image_active_drawable (shell->gdisp->gimage),
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (shell->gdisp->gimage)),
&offset_x, &offset_y);
*nx = (x + shell->offset_x) / scalex - offset_x;

View File

@ -1013,7 +1013,7 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
/* If there is a floating selection, handle things differently */
if ((layer = gimp_image_floating_sel (shell->gdisp->gimage)))
{
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
if (! gimp_channel_bounds (gimp_image_get_mask (shell->gdisp->gimage),
x1, y1, x2, y2))

View File

@ -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

View File

@ -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)
{
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);
opacity = template->opacity;
mode = template->mode;
}

View File

@ -290,6 +290,7 @@ gimp_ink_tool_button_press (GimpTool *tool,
GimpInkOptions *options;
GimpDrawable *drawable;
GimpCoords curr_coords;
gint off_x, off_y;
Blob *b;
ink_tool = GIMP_INK_TOOL (tool);
@ -299,14 +300,10 @@ gimp_ink_tool_button_press (GimpTool *tool,
curr_coords = *coords;
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
curr_coords.x -= off_x;
curr_coords.y -= off_y;
}
ink_init (ink_tool, drawable, curr_coords.x, curr_coords.y);
@ -378,6 +375,7 @@ gimp_ink_tool_motion (GimpTool *tool,
GimpInkOptions *options;
GimpDrawable *drawable;
GimpCoords curr_coords;
gint off_x, off_y;
Blob *b;
Blob *blob_union;
gdouble velocity;
@ -391,14 +389,10 @@ gimp_ink_tool_motion (GimpTool *tool,
curr_coords = *coords;
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
curr_coords.x -= off_x;
curr_coords.y -= off_y;
}
lasttime = ink_tool->last_time;
@ -464,19 +458,9 @@ gimp_ink_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpLayer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{
gint off_x, off_y;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (coords->x >= off_x &&
coords->y >= off_y &&
coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
if (gimp_display_coords_in_active_drawable (gdisp, coords))
{
/* One more test--is there a selected region?
* if so, is cursor inside?
@ -486,7 +470,6 @@ gimp_ink_tool_cursor_update (GimpTool *tool,
else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y))
ctype = GIMP_MOUSE_CURSOR;
}
}
gimp_tool_control_set_cursor (tool->control, ctype);
@ -1044,7 +1027,7 @@ ink_paste (GimpInkTool *ink_tool,
* instead of drawable_update because we don't want the drawable
* preview to be constantly invalidated
*/
gimp_drawable_offsets (drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy);
gimp_image_update (gimage,
canvas_buf->x + offx,
canvas_buf->y + offy,

View File

@ -1475,7 +1475,7 @@ gimp_paint_core_paste (GimpPaintCore *core,
* instead of drawable_update because we don't want the drawable
* preview to be constantly invalidated
*/
gimp_drawable_offsets (drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy);
gimp_image_update (gimage,
core->canvas_buf->x + offx,
core->canvas_buf->y + offy,
@ -1587,7 +1587,7 @@ gimp_paint_core_replace (GimpPaintCore *core,
* instead of drawable_update because we don't want the drawable
* preview to be constantly invalidated
*/
gimp_drawable_offsets (drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy);
gimp_image_update (gimage,
core->canvas_buf->x + offx,
core->canvas_buf->y + offy,

View File

@ -939,7 +939,7 @@ histogram_invoker (Gimp *gimp,
{
/* The information collection should occur only within selection bounds */
no_mask = (gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2) == FALSE);
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
/* Configure the src from the drawable data */
pixel_region_init (&srcPR, gimp_drawable_data (drawable),

View File

@ -929,7 +929,7 @@ drawable_offsets_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_drawable_offsets (drawable, &offset_x, &offset_y);
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);
return_args = procedural_db_return_args (&drawable_offsets_proc, success);

View File

@ -3444,7 +3444,7 @@ bezier_stroke (GimpBezierSelectTool *bezier_sel,
gdouble *ptr;
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_drawable_offsets (drawable, &offset_x, &offset_y);
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);
ptr = rpnts->stroke_points;
while (ptr < rpnts->stroke_points + (rpnts->num_stroke_points * 2))

View File

@ -189,7 +189,7 @@ gimp_blend_tool_button_press (GimpTool *tool,
break;
}
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
blend_tool->endx = blend_tool->startx = coords->x - off_x;
blend_tool->endy = blend_tool->starty = coords->y - off_y;
@ -276,7 +276,7 @@ gimp_blend_tool_motion (GimpTool *tool,
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage)),
&off_x, &off_y);
/* Get the current coordinates */

View File

@ -249,6 +249,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
GimpBrush *current_brush;
GimpDrawable *drawable;
GimpCoords curr_coords;
gint off_x, off_y;
gboolean draw_line = FALSE;
draw_tool = GIMP_DRAW_TOOL (tool);
@ -261,14 +262,10 @@ gimp_paint_tool_button_press (GimpTool *tool,
curr_coords = *coords;
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
curr_coords.x -= off_x;
curr_coords.y -= off_y;
}
if (draw_tool->gdisp)
gimp_draw_tool_stop (draw_tool);
@ -431,6 +428,7 @@ gimp_paint_tool_motion (GimpTool *tool,
GimpPaintOptions *paint_options;
GimpPaintCore *core;
GimpDrawable *drawable;
gint off_x, off_y;
paint_tool = GIMP_PAINT_TOOL (tool);
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
@ -446,14 +444,10 @@ gimp_paint_tool_motion (GimpTool *tool,
core->cur_coords = *coords;
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
core->cur_coords.x -= off_x;
core->cur_coords.y -= off_y;
}
if (paint_tool->pick_state)
{
@ -529,17 +523,14 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
gdouble dx, dy, dist;
gchar status_str[STATUSBAR_SIZE];
gint off_x, off_y;
core->cur_coords = *coords;
{
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);
core->cur_coords.x -= off_x;
core->cur_coords.y -= off_y;
}
if (state & GDK_CONTROL_MASK)
{

View File

@ -169,7 +169,7 @@ gimp_bucket_fill_tool_button_press (GimpTool *tool,
{
gint off_x, off_y;
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage)),
&off_x, &off_y);
bucket_tool->target_x -= off_x;
@ -251,20 +251,11 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpBucketFillOptions *options;
GimpLayer *layer;
GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE;
gint off_x, off_y;
options = GIMP_BUCKET_FILL_OPTIONS (tool->tool_info->tool_options);
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (coords->x >= off_x &&
coords->y >= off_y &&
coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
if (gimp_display_coords_in_active_drawable (gdisp, coords))
{
/* One more test--is there a selected region?
* if so, is cursor inside?
@ -277,16 +268,17 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
case GIMP_FG_BUCKET_FILL:
cmodifier = GIMP_CURSOR_MODIFIER_FOREGROUND;
break;
case GIMP_BG_BUCKET_FILL:
cmodifier = GIMP_CURSOR_MODIFIER_BACKGROUND;
break;
case GIMP_PATTERN_BUCKET_FILL:
cmodifier = GIMP_CURSOR_MODIFIER_PATTERN;
break;
}
}
}
}
gimp_tool_control_set_cursor_modifier (tool->control, cmodifier);

View File

@ -170,7 +170,7 @@ gimp_by_color_select_tool_button_press (GimpTool *tool,
{
gint off_x, off_y;
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage)),
&off_x, &off_y);
by_color_sel->x -= off_x;

View File

@ -234,21 +234,11 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpCloneOptions *options;
GimpLayer *layer;
GdkCursorType ctype = GIMP_MOUSE_CURSOR;
options = (GimpCloneOptions *) tool->tool_info->tool_options;
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{
gint off_x, off_y;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (coords->x >= off_x &&
coords->y >= off_y &&
coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
if (gimp_display_coords_in_active_drawable (gdisp, coords))
{
/* One more test--is there a selected region?
* if so, is cursor inside?
@ -258,7 +248,6 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y))
ctype = GIMP_MOUSE_CURSOR;
}
}
if (options->clone_type == GIMP_IMAGE_CLONE)
{
@ -297,7 +286,8 @@ gimp_clone_tool_draw (GimpDrawTool *draw_tool)
gint off_x;
gint off_y;
gimp_drawable_offsets (clone->src_drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (clone->src_drawable),
&off_x, &off_y);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,

View File

@ -266,7 +266,7 @@ gimp_color_picker_tool_button_press (GimpTool *tool,
GIMP_VIEWABLE (tool->drawable));
/* Keep the coordinates of the target */
gimp_drawable_offsets (tool->drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (tool->drawable), &off_x, &off_y);
cp_tool->centerx = coords->x - off_x;
cp_tool->centery = coords->y - off_y;
@ -356,7 +356,7 @@ gimp_color_picker_tool_motion (GimpTool *tool,
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
gimp_drawable_offsets (tool->drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (tool->drawable), &off_x, &off_y);
cp_tool->centerx = coords->x - off_x;
cp_tool->centery = coords->y - off_y;

View File

@ -480,7 +480,7 @@ gimp_crop_tool_motion (GimpTool *tool,
if (options->layer_only)
{
layer = gimp_image_get_active_layer (gdisp->gimage);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &min_x, &min_y);
gimp_item_offsets (GIMP_ITEM (layer), &min_x, &min_y);
max_x = gimp_item_width (GIMP_ITEM (layer)) + min_x;
max_y = gimp_item_height (GIMP_ITEM (layer)) + min_y;
}
@ -641,7 +641,7 @@ gimp_crop_tool_arrow_key (GimpTool *tool,
if (options->layer_only)
{
layer = gimp_image_get_active_layer (gdisp->gimage);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &min_x, &min_y);
gimp_item_offsets (GIMP_ITEM (layer), &min_x, &min_y);
max_x = gimp_item_width (GIMP_ITEM (layer)) + min_x;
max_y = gimp_item_height (GIMP_ITEM (layer)) + min_y;
}
@ -1170,8 +1170,7 @@ crop_selection_callback (GtkWidget *widget,
if (options->layer_only)
{
layer = gimp_image_get_active_layer (gdisp->gimage);
gimp_drawable_offsets (GIMP_DRAWABLE (layer),
&crop->x1, &crop->y1);
gimp_item_offsets (GIMP_ITEM (layer), &crop->x1, &crop->y1);
crop->x2 = gimp_item_width (GIMP_ITEM (layer)) + crop->x1;
crop->y2 = gimp_item_height (GIMP_ITEM (layer)) + crop->y1;
}
@ -1214,10 +1213,9 @@ crop_automatic_callback (GtkWidget *widget,
if (! active_drawable)
return;
gimp_item_offsets (GIMP_ITEM (active_drawable), &offset_x, &offset_y);
width = gimp_item_width (GIMP_ITEM (active_drawable));
height = gimp_item_height (GIMP_ITEM (active_drawable));
gimp_drawable_offsets (GIMP_DRAWABLE (active_drawable),
&offset_x, &offset_y);
}
else
{

View File

@ -470,7 +470,7 @@ curves_color_update (GimpTool *tool,
c_tool = GIMP_CURVES_TOOL (tool);
gimp_drawable_offsets (drawable, &x, &y);
gimp_item_offsets (GIMP_ITEM (drawable), &x, &y);
x = RINT (coords->x) - x;
y = RINT (coords->y) - y;

View File

@ -259,7 +259,7 @@ init_edit_selection (GimpTool *tool,
active_drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_drawable_offsets (active_drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (active_drawable), &off_x, &off_y);
edit_select->edit_type = edit_type;
@ -333,7 +333,7 @@ init_edit_selection (GimpTool *tool,
{
g_print ("linked!\n");
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x3, &y3);
gimp_item_offsets (GIMP_ITEM (layer), &x3, &y3);
x4 = x3 + gimp_item_width (GIMP_ITEM (layer));
y4 = y3 + gimp_item_height (GIMP_ITEM (layer));
@ -473,6 +473,7 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
{
GimpEditSelectionTool *edit_select;
GimpDisplayShell *shell;
gint off_x, off_y;
gdouble motion_x, motion_y;
edit_select = GIMP_EDIT_SELECTION_TOOL (tool);
@ -483,15 +484,11 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
{
gint off_x, off_y;
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage)),
&off_x, &off_y);
motion_x = coords->x - off_x;
motion_y = coords->y - off_y;
}
/* now do the actual move. */
@ -724,8 +721,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
break;
case EDIT_LAYER_TRANSLATE:
gimp_drawable_offsets (GIMP_DRAWABLE (gdisp->gimage->active_layer),
&x1, &y1);
gimp_item_offsets (GIMP_ITEM (gdisp->gimage->active_layer), &x1, &y1);
x2 = x1 + gimp_item_width (GIMP_ITEM (gdisp->gimage->active_layer));
y2 = y1 + gimp_item_height (GIMP_ITEM (gdisp->gimage->active_layer));
@ -740,7 +736,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
if ((layer != gdisp->gimage->active_layer) &&
gimp_layer_get_linked (layer))
{
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x3, &y3);
gimp_item_offsets (GIMP_ITEM (layer), &x3, &y3);
x4 = x3 + gimp_item_width (GIMP_ITEM (layer));
y4 = y3 + gimp_item_height (GIMP_ITEM (layer));

View File

@ -202,16 +202,7 @@ gimp_flip_tool_cursor_update (GimpTool *tool,
options = GIMP_FLIP_OPTIONS (tool->tool_info->tool_options);
if ((drawable = gimp_image_active_drawable (gdisp->gimage)))
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
if (coords->x >= off_x &&
coords->y >= off_y &&
coords->x < (off_x + gimp_item_width (GIMP_ITEM (drawable))) &&
coords->y < (off_y + gimp_item_height (GIMP_ITEM (drawable))))
if (gimp_display_coords_in_active_drawable (gdisp, coords))
{
/* Is there a selected region? If so, is cursor inside? */
if (gimp_image_mask_is_empty (gdisp->gimage) ||
@ -220,7 +211,6 @@ gimp_flip_tool_cursor_update (GimpTool *tool,
bad_cursor = FALSE;
}
}
}
if (bad_cursor)
{

View File

@ -288,7 +288,7 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
}
gimp_image_mask_select_channel (gdisp->gimage,
@ -413,7 +413,7 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel,
{
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;

View File

@ -290,6 +290,7 @@ gimp_ink_tool_button_press (GimpTool *tool,
GimpInkOptions *options;
GimpDrawable *drawable;
GimpCoords curr_coords;
gint off_x, off_y;
Blob *b;
ink_tool = GIMP_INK_TOOL (tool);
@ -299,14 +300,10 @@ gimp_ink_tool_button_press (GimpTool *tool,
curr_coords = *coords;
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
curr_coords.x -= off_x;
curr_coords.y -= off_y;
}
ink_init (ink_tool, drawable, curr_coords.x, curr_coords.y);
@ -378,6 +375,7 @@ gimp_ink_tool_motion (GimpTool *tool,
GimpInkOptions *options;
GimpDrawable *drawable;
GimpCoords curr_coords;
gint off_x, off_y;
Blob *b;
Blob *blob_union;
gdouble velocity;
@ -391,14 +389,10 @@ gimp_ink_tool_motion (GimpTool *tool,
curr_coords = *coords;
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
curr_coords.x -= off_x;
curr_coords.y -= off_y;
}
lasttime = ink_tool->last_time;
@ -464,19 +458,9 @@ gimp_ink_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpLayer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{
gint off_x, off_y;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (coords->x >= off_x &&
coords->y >= off_y &&
coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
if (gimp_display_coords_in_active_drawable (gdisp, coords))
{
/* One more test--is there a selected region?
* if so, is cursor inside?
@ -486,7 +470,6 @@ gimp_ink_tool_cursor_update (GimpTool *tool,
else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y))
ctype = GIMP_MOUSE_CURSOR;
}
}
gimp_tool_control_set_cursor (tool->control, ctype);
@ -1044,7 +1027,7 @@ ink_paste (GimpInkTool *ink_tool,
* instead of drawable_update because we don't want the drawable
* preview to be constantly invalidated
*/
gimp_drawable_offsets (drawable, &offx, &offy);
gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy);
gimp_image_update (gimage,
canvas_buf->x + offx,
canvas_buf->y + offy,

View File

@ -1409,7 +1409,7 @@ levels_input_color_pick (GimpTool *tool,
if (! l_tool->active_picker || !drawable)
return;
gimp_drawable_offsets (drawable, &x, &y);
gimp_item_offsets (GIMP_ITEM (drawable), &x, &y);
x = RINT (coords->x) - x;
y = RINT (coords->y) - y;

View File

@ -249,6 +249,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
GimpBrush *current_brush;
GimpDrawable *drawable;
GimpCoords curr_coords;
gint off_x, off_y;
gboolean draw_line = FALSE;
draw_tool = GIMP_DRAW_TOOL (tool);
@ -261,14 +262,10 @@ gimp_paint_tool_button_press (GimpTool *tool,
curr_coords = *coords;
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
curr_coords.x -= off_x;
curr_coords.y -= off_y;
}
if (draw_tool->gdisp)
gimp_draw_tool_stop (draw_tool);
@ -431,6 +428,7 @@ gimp_paint_tool_motion (GimpTool *tool,
GimpPaintOptions *paint_options;
GimpPaintCore *core;
GimpDrawable *drawable;
gint off_x, off_y;
paint_tool = GIMP_PAINT_TOOL (tool);
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
@ -446,14 +444,10 @@ gimp_paint_tool_motion (GimpTool *tool,
core->cur_coords = *coords;
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
core->cur_coords.x -= off_x;
core->cur_coords.y -= off_y;
}
if (paint_tool->pick_state)
{
@ -529,17 +523,14 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
gdouble dx, dy, dist;
gchar status_str[STATUSBAR_SIZE];
gint off_x, off_y;
core->cur_coords = *coords;
{
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);
core->cur_coords.x -= off_x;
core->cur_coords.y -= off_y;
}
if (state & GDK_CONTROL_MASK)
{

View File

@ -543,7 +543,7 @@ gimp_rect_select_tool_rect_select (GimpRectSelectTool *rect_tool,
drawable = gimp_image_active_drawable (tool->gdisp->gimage);
item = GIMP_ITEM (drawable);
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (item, &off_x, &off_y);
width = gimp_item_width (item);
height = gimp_item_height (item);

View File

@ -288,7 +288,7 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
}
gimp_image_mask_select_channel (gdisp->gimage,
@ -413,7 +413,7 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel,
{
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;

View File

@ -234,21 +234,11 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpCloneOptions *options;
GimpLayer *layer;
GdkCursorType ctype = GIMP_MOUSE_CURSOR;
options = (GimpCloneOptions *) tool->tool_info->tool_options;
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{
gint off_x, off_y;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (coords->x >= off_x &&
coords->y >= off_y &&
coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
if (gimp_display_coords_in_active_drawable (gdisp, coords))
{
/* One more test--is there a selected region?
* if so, is cursor inside?
@ -258,7 +248,6 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y))
ctype = GIMP_MOUSE_CURSOR;
}
}
if (options->clone_type == GIMP_IMAGE_CLONE)
{
@ -297,7 +286,8 @@ gimp_clone_tool_draw (GimpDrawTool *draw_tool)
gint off_x;
gint off_y;
gimp_drawable_offsets (clone->src_drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (clone->src_drawable),
&off_x, &off_y);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,

View File

@ -349,7 +349,7 @@ gimp_transform_tool_button_press (GimpTool *tool,
/* Initialisation stuff: if the cursor is clicked inside the current
* selection, show the bounding box and handles...
*/
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
if (coords->x >= off_x &&
coords->y >= off_y &&
@ -629,19 +629,12 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
if ((drawable = gimp_image_active_drawable (gdisp->gimage)))
{
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y);
if (GIMP_IS_LAYER (drawable) &&
gimp_layer_get_mask (GIMP_LAYER (drawable)))
{
ctype = GIMP_BAD_CURSOR;
}
else if (coords->x >= off_x &&
coords->y >= off_y &&
coords->x < (off_x + GIMP_ITEM (drawable)->width) &&
coords->y < (off_y + GIMP_ITEM (drawable)->height))
else if (gimp_display_coords_in_active_drawable (gdisp, coords))
{
if (gimp_image_mask_is_empty (gdisp->gimage) ||
gimp_image_mask_value (gdisp->gimage, coords->x, coords->y))
@ -984,7 +977,7 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
{
gint offset_x, offset_y;
gimp_drawable_offsets (drawable, &offset_x, &offset_y);
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);
gimp_drawable_mask_bounds (drawable,
&tr_tool->x1, &tr_tool->y1,

View File

@ -357,7 +357,7 @@ gimp_selection_preview_button_press (GtkWidget *widget,
item = GIMP_ITEM (drawable);
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (item, &off_x, &off_y);
x -= off_x;
y -= off_y;

View File

@ -891,7 +891,7 @@ toolbox_drop_drawable (GtkWidget *widget,
gimp_object_set_name (GIMP_OBJECT (new_layer),
gimp_object_get_name (GIMP_OBJECT (drawable)));
gimp_drawable_offsets (GIMP_DRAWABLE (new_layer), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (new_layer), &off_x, &off_y);
gimp_layer_translate (new_layer, -off_x, -off_y, FALSE);
gimp_image_add_layer (new_gimage, new_layer, 0);

View File

@ -577,7 +577,7 @@ HELP
{
/* The information collection should occur only within selection bounds */
no_mask = (gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2) == FALSE);
gimp_drawable_offsets (drawable, &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
/* Configure the src from the drawable data */
pixel_region_init (&srcPR, gimp_drawable_data (drawable),

View File

@ -325,7 +325,7 @@ HELP
desc => "$_ offset of drawable", void_ret => 1 }
}
%invoke = ( code => 'gimp_drawable_offsets (drawable, &offset_x, &offset_y);' );
%invoke = ( code => 'gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);' );
}
sub drawable_is_layer {