removed gimp_drawable_width,height().

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

	* app/core/gimpdrawable.[ch]: removed gimp_drawable_width,height().

	* app/core/gimpitem.[ch]: added gimp_item_width,height().

	* app/core/gimpchannel.c
	* app/core/gimpdrawable-bucket-fill.c
	* app/core/gimpdrawable-offset.c
	* app/core/gimpdrawable-preview.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpimage-contiguous-region.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-mask.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-preview.c
	* app/core/gimpimage-projection.c
	* app/core/gimpimage-undo-push.c
	* app/core/gimpimage.c
	* app/core/gimpimagemap.c
	* app/core/gimplayer-floating-sel.c
	* app/core/gimplayer.c
	* app/core/gimplayermask.c
	* app/core/gimpscanconvert.c
	* app/display/gimpdisplay.c
	* app/display/gimpdisplayshell-dnd.c
	* app/display/gimpdisplayshell.c
	* app/gui/channels-commands.c
	* app/gui/layers-commands.c
	* app/paint/gimpclone.c
	* app/paint/gimpconvolve.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimppaintcore.c
	* app/paint/gimpsmudge.c
	* app/text/gimptextlayer.c
	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpfliptool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimphistogramtool.c
	* app/tools/gimpinktool.c
	* app/tools/gimprectselecttool.c
	* app/tools/gimptransformtool.c
	* app/widgets/gimpselectioneditor.c
	* app/widgets/gimptoolbox.c
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/selection.pdb: changed accordingly.

	* app/pdb/drawable_cmds.c
	* app/pdb/selection_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2003-05-08 13:12:46 +00:00 committed by Michael Natterer
parent 4136e61ddc
commit 54878b79ce
63 changed files with 503 additions and 374 deletions

View File

@ -1,3 +1,58 @@
2003-05-08 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.[ch]: removed gimp_drawable_width,height().
* app/core/gimpitem.[ch]: added gimp_item_width,height().
* app/core/gimpchannel.c
* app/core/gimpdrawable-bucket-fill.c
* app/core/gimpdrawable-offset.c
* app/core/gimpdrawable-preview.c
* app/core/gimpdrawable-transform.c
* app/core/gimpimage-contiguous-region.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-preview.c
* app/core/gimpimage-projection.c
* app/core/gimpimage-undo-push.c
* app/core/gimpimage.c
* app/core/gimpimagemap.c
* app/core/gimplayer-floating-sel.c
* app/core/gimplayer.c
* app/core/gimplayermask.c
* app/core/gimpscanconvert.c
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell.c
* app/gui/channels-commands.c
* app/gui/layers-commands.c
* app/paint/gimpclone.c
* app/paint/gimpconvolve.c
* app/paint/gimpdodgeburn.c
* app/paint/gimppaintcore.c
* app/paint/gimpsmudge.c
* app/text/gimptextlayer.c
* app/tools/gimpbezierselecttool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpclonetool.c
* app/tools/gimpcroptool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfliptool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimphistogramtool.c
* app/tools/gimpinktool.c
* app/tools/gimprectselecttool.c
* app/tools/gimptransformtool.c
* app/widgets/gimpselectioneditor.c
* app/widgets/gimptoolbox.c
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/selection.pdb: changed accordingly.
* app/pdb/drawable_cmds.c
* app/pdb/selection_cmds.c: regenerated.
2003-05-08 Michael Natterer <mitch@gimp.org> 2003-05-08 Michael Natterer <mitch@gimp.org>
More transform virtualization preparation: More transform virtualization preparation:

View File

@ -326,8 +326,8 @@ channels_new_channel_query (GimpImage *gimage,
if (template) if (template)
{ {
width = gimp_drawable_width (GIMP_DRAWABLE (template)); width = gimp_item_width (GIMP_ITEM (template));
height = gimp_drawable_height (GIMP_DRAWABLE (template)); height = gimp_item_height (GIMP_ITEM (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y); gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
color = template->color; color = template->color;
} }

View File

@ -525,8 +525,8 @@ layers_new_layer_query (GimpImage *gimage,
if (template) if (template)
{ {
width = gimp_drawable_width (GIMP_DRAWABLE (template)); width = gimp_item_width (GIMP_ITEM (template));
height = gimp_drawable_height (GIMP_DRAWABLE (template)); height = gimp_item_height (GIMP_ITEM (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y); gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
opacity = template->opacity; opacity = template->opacity;
mode = template->mode; mode = template->mode;
@ -981,8 +981,8 @@ layers_scale_layer_query (GimpImage *gimage,
options->resize = options->resize =
resize_widget_new (GIMP_VIEWABLE (layer), resize_widget_new (GIMP_VIEWABLE (layer),
ScaleWidget, ScaleWidget,
gimp_drawable_width (GIMP_DRAWABLE (layer)), gimp_item_width (GIMP_ITEM (layer)),
gimp_drawable_height (GIMP_DRAWABLE (layer)), gimp_item_height (GIMP_ITEM (layer)),
gimage->xresolution, gimage->xresolution,
gimage->yresolution, gimage->yresolution,
gimage->unit, gimage->unit,
@ -1075,8 +1075,8 @@ layers_resize_layer_query (GimpImage *gimage,
options->resize = options->resize =
resize_widget_new (GIMP_VIEWABLE (layer), resize_widget_new (GIMP_VIEWABLE (layer),
ResizeWidget, ResizeWidget,
gimp_drawable_width (GIMP_DRAWABLE (layer)), gimp_item_width (GIMP_ITEM (layer)),
gimp_drawable_height (GIMP_DRAWABLE (layer)), gimp_item_height (GIMP_ITEM (layer)),
gimage->xresolution, gimage->xresolution,
gimage->yresolution, gimage->yresolution,
gimage->unit, gimage->unit,

View File

@ -726,8 +726,8 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
gimp_drawable_update (drawable, gimp_drawable_update (drawable,
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (GIMP_ITEM (drawable)),
gimp_drawable_height (drawable)); gimp_item_height (GIMP_ITEM (drawable)));
/* if we were operating on the floating selection, then it's boundary /* if we were operating on the floating selection, then it's boundary
* and previews need invalidating * and previews need invalidating

View File

@ -1269,8 +1269,8 @@ gimp_channel_feather (GimpChannel *mask,
pixel_region_init (&srcPR, GIMP_DRAWABLE (mask)->tiles, pixel_region_init (&srcPR, GIMP_DRAWABLE (mask)->tiles,
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (mask)), gimp_item_width (GIMP_ITEM (mask)),
gimp_drawable_height (GIMP_DRAWABLE (mask)), gimp_item_height (GIMP_ITEM (mask)),
FALSE); FALSE);
gaussian_blur_region (&srcPR, radius_x, radius_y); gaussian_blur_region (&srcPR, radius_x, radius_y);
@ -1291,8 +1291,9 @@ gimp_channel_sharpen (GimpChannel *mask,
pixel_region_init (&maskPR, GIMP_DRAWABLE (mask)->tiles, pixel_region_init (&maskPR, GIMP_DRAWABLE (mask)->tiles,
0, 0, 0, 0,
GIMP_ITEM (mask)->width, gimp_item_width (GIMP_ITEM (mask)),
GIMP_ITEM (mask)->height, TRUE); gimp_item_height (GIMP_ITEM (mask)),
TRUE);
lut = threshold_lut_new (0.5, 1); lut = threshold_lut_new (0.5, 1);
pixel_regions_process_parallel ((p_func) gimp_lut_process_inline, pixel_regions_process_parallel ((p_func) gimp_lut_process_inline,

View File

@ -1269,8 +1269,8 @@ gimp_channel_feather (GimpChannel *mask,
pixel_region_init (&srcPR, GIMP_DRAWABLE (mask)->tiles, pixel_region_init (&srcPR, GIMP_DRAWABLE (mask)->tiles,
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (mask)), gimp_item_width (GIMP_ITEM (mask)),
gimp_drawable_height (GIMP_DRAWABLE (mask)), gimp_item_height (GIMP_ITEM (mask)),
FALSE); FALSE);
gaussian_blur_region (&srcPR, radius_x, radius_y); gaussian_blur_region (&srcPR, radius_x, radius_y);
@ -1291,8 +1291,9 @@ gimp_channel_sharpen (GimpChannel *mask,
pixel_region_init (&maskPR, GIMP_DRAWABLE (mask)->tiles, pixel_region_init (&maskPR, GIMP_DRAWABLE (mask)->tiles,
0, 0, 0, 0,
GIMP_ITEM (mask)->width, gimp_item_width (GIMP_ITEM (mask)),
GIMP_ITEM (mask)->height, TRUE); gimp_item_height (GIMP_ITEM (mask)),
TRUE);
lut = threshold_lut_new (0.5, 1); lut = threshold_lut_new (0.5, 1);
pixel_regions_process_parallel ((p_func) gimp_lut_process_inline, pixel_regions_process_parallel ((p_func) gimp_lut_process_inline,

View File

@ -259,14 +259,18 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
/* make sure we handle the mask correctly if it was sample-merged */ /* make sure we handle the mask correctly if it was sample-merged */
if (sample_merged) if (sample_merged)
{ {
gint off_x, off_y; GimpItem *item;
gint off_x, off_y;
item = GIMP_ITEM (drawable);
/* Limit the channel bounds to the drawable's extents */ /* Limit the channel bounds to the drawable's extents */
gimp_drawable_offsets (drawable, &off_x, &off_y); gimp_drawable_offsets (drawable, &off_x, &off_y);
x1 = CLAMP (x1, off_x, (off_x + gimp_drawable_width (drawable)));
y1 = CLAMP (y1, off_y, (off_y + gimp_drawable_height (drawable))); x1 = CLAMP (x1, off_x, (off_x + gimp_item_width (item)));
x2 = CLAMP (x2, off_x, (off_x + gimp_drawable_width (drawable))); y1 = CLAMP (y1, off_y, (off_y + gimp_item_height (item)));
y2 = CLAMP (y2, off_y, (off_y + gimp_drawable_height (drawable))); x2 = CLAMP (x2, off_x, (off_x + gimp_item_width (item)));
y2 = CLAMP (y2, off_y, (off_y + gimp_item_height (item)));
pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)), pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)),
x1, y1, (x2 - x1), (y2 - y1), TRUE); x1, y1, (x2 - x1), (y2 - y1), TRUE);

View File

@ -48,6 +48,7 @@ gimp_drawable_offset (GimpDrawable *drawable,
gint offset_x, gint offset_x,
gint offset_y) gint offset_y)
{ {
GimpItem *item;
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
TileManager *new_tiles; TileManager *new_tiles;
gint width, height; gint width, height;
@ -55,11 +56,12 @@ gimp_drawable_offset (GimpDrawable *drawable,
gint dest_x, dest_y; gint dest_x, dest_y;
guchar fill[MAX_CHANNELS] = { 0 }; guchar fill[MAX_CHANNELS] = { 0 };
if (! drawable) g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
return;
width = gimp_drawable_width (drawable); item = GIMP_ITEM (drawable);
height = gimp_drawable_height (drawable);
width = gimp_item_width (item);
height = gimp_item_height (item);
if (wrap_around) if (wrap_around)
{ {
@ -124,18 +126,18 @@ gimp_drawable_offset (GimpDrawable *drawable,
{ {
if (offset_x >= 0 && offset_y >= 0) if (offset_x >= 0 && offset_y >= 0)
{ {
src_x = gimp_drawable_width (drawable) - offset_x; src_x = gimp_item_width (item) - offset_x;
src_y = gimp_drawable_height (drawable) - offset_y; src_y = gimp_item_height (item) - offset_y;
} }
else if (offset_x >= 0 && offset_y < 0) else if (offset_x >= 0 && offset_y < 0)
{ {
src_x = gimp_drawable_width (drawable) - offset_x; src_x = gimp_item_width (item) - offset_x;
src_y = 0; src_y = 0;
} }
else if (offset_x < 0 && offset_y >= 0) else if (offset_x < 0 && offset_y >= 0)
{ {
src_x = 0; src_x = 0;
src_y = gimp_drawable_height (drawable) - offset_y; src_y = gimp_item_height (item) - offset_y;
} }
else if (offset_x < 0 && offset_y < 0) else if (offset_x < 0 && offset_y < 0)
{ {
@ -143,21 +145,24 @@ gimp_drawable_offset (GimpDrawable *drawable,
src_y = 0; src_y = 0;
} }
dest_x = (src_x + offset_x) % gimp_drawable_width (drawable); dest_x = (src_x + offset_x) % gimp_item_width (item);
if (dest_x < 0) if (dest_x < 0)
dest_x = gimp_drawable_width (drawable) + dest_x; dest_x = gimp_item_width (item) + dest_x;
dest_y = (src_y + offset_y) % gimp_drawable_height (drawable);
dest_y = (src_y + offset_y) % gimp_item_height (item);
if (dest_y < 0) if (dest_y < 0)
dest_y = gimp_drawable_height (drawable) + dest_y; dest_y = gimp_item_height (item) + dest_y;
/* intersecting region */ /* intersecting region */
if (offset_x != 0 && offset_y != 0) if (offset_x != 0 && offset_y != 0)
{ {
pixel_region_init (&srcPR, gimp_drawable_data (drawable), pixel_region_init (&srcPR, gimp_drawable_data (drawable),
src_x, src_y, ABS (offset_x), ABS (offset_y) src_x, src_y,
, FALSE); ABS (offset_x), ABS (offset_y),
FALSE);
pixel_region_init (&destPR, new_tiles, pixel_region_init (&destPR, new_tiles,
dest_x, dest_y, ABS (offset_x), ABS (offset_y), dest_x, dest_y,
ABS (offset_x), ABS (offset_y),
TRUE); TRUE);
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
} }
@ -169,12 +174,12 @@ gimp_drawable_offset (GimpDrawable *drawable,
{ {
pixel_region_init (&srcPR, gimp_drawable_data (drawable), pixel_region_init (&srcPR, gimp_drawable_data (drawable),
src_x, 0, ABS (offset_x), src_x, 0, ABS (offset_x),
gimp_drawable_height (drawable) - ABS (offset_y), gimp_item_height (item) - ABS (offset_y),
FALSE); FALSE);
pixel_region_init (&destPR, new_tiles, pixel_region_init (&destPR, new_tiles,
dest_x, dest_y + offset_y, dest_x, dest_y + offset_y,
ABS (offset_x), ABS (offset_x),
gimp_drawable_height (drawable) - ABS (offset_y), gimp_item_height (item) - ABS (offset_y),
TRUE); TRUE);
} }
else if (offset_y < 0) else if (offset_y < 0)
@ -182,12 +187,12 @@ gimp_drawable_offset (GimpDrawable *drawable,
pixel_region_init (&srcPR, gimp_drawable_data (drawable), pixel_region_init (&srcPR, gimp_drawable_data (drawable),
src_x, src_y - offset_y, src_x, src_y - offset_y,
ABS (offset_x), ABS (offset_x),
gimp_drawable_height (drawable) - ABS (offset_y), gimp_item_height (item) - ABS (offset_y),
FALSE); FALSE);
pixel_region_init (&destPR, new_tiles, pixel_region_init (&destPR, new_tiles,
dest_x, 0, dest_x, 0,
ABS (offset_x), ABS (offset_x),
gimp_drawable_height (drawable) - ABS (offset_y), gimp_item_height (item) - ABS (offset_y),
TRUE); TRUE);
} }
@ -201,20 +206,20 @@ gimp_drawable_offset (GimpDrawable *drawable,
{ {
pixel_region_init (&srcPR, gimp_drawable_data (drawable), pixel_region_init (&srcPR, gimp_drawable_data (drawable),
0, src_y, 0, src_y,
gimp_drawable_width (drawable) - ABS (offset_x), gimp_item_width (item) - ABS (offset_x),
ABS (offset_y), FALSE); ABS (offset_y), FALSE);
pixel_region_init (&destPR, new_tiles, dest_x + offset_x, dest_y, pixel_region_init (&destPR, new_tiles, dest_x + offset_x, dest_y,
gimp_drawable_width (drawable) - ABS (offset_x), gimp_item_width (item) - ABS (offset_x),
ABS (offset_y), TRUE); ABS (offset_y), TRUE);
} }
else if (offset_x < 0) else if (offset_x < 0)
{ {
pixel_region_init (&srcPR, gimp_drawable_data (drawable), pixel_region_init (&srcPR, gimp_drawable_data (drawable),
src_x - offset_x, src_y, src_x - offset_x, src_y,
gimp_drawable_width (drawable) - ABS (offset_x), gimp_item_width (item) - ABS (offset_x),
ABS (offset_y), FALSE); ABS (offset_y), FALSE);
pixel_region_init (&destPR, new_tiles, 0, dest_y, pixel_region_init (&destPR, new_tiles, 0, dest_y,
gimp_drawable_width (drawable) - ABS (offset_x), gimp_item_width (item) - ABS (offset_x),
ABS (offset_y), TRUE); ABS (offset_y), TRUE);
} }
@ -229,7 +234,7 @@ gimp_drawable_offset (GimpDrawable *drawable,
Gimp *gimp; Gimp *gimp;
GimpRGB color; GimpRGB color;
gimp = gimp_item_get_image (GIMP_ITEM (drawable))->gimp; gimp = gimp_item_get_image (item)->gimp;
gimp_context_get_background (gimp_get_current_context (gimp), &color); gimp_context_get_background (gimp_get_current_context (gimp), &color);
@ -247,17 +252,17 @@ gimp_drawable_offset (GimpDrawable *drawable,
else if (offset_x >= 0 && offset_y < 0) else if (offset_x >= 0 && offset_y < 0)
{ {
dest_x = 0; dest_x = 0;
dest_y = gimp_drawable_height (drawable) + offset_y; dest_y = gimp_item_height (item) + offset_y;
} }
else if (offset_x < 0 && offset_y >= 0) else if (offset_x < 0 && offset_y >= 0)
{ {
dest_x = gimp_drawable_width (drawable) + offset_x; dest_x = gimp_item_width (item) + offset_x;
dest_y = 0; dest_y = 0;
} }
else if (offset_x < 0 && offset_y < 0) else if (offset_x < 0 && offset_y < 0)
{ {
dest_x = gimp_drawable_width (drawable) + offset_x; dest_x = gimp_item_width (item) + offset_x;
dest_y = gimp_drawable_height (drawable) + offset_y; dest_y = gimp_item_height (item) + offset_y;
} }
/* intersecting region */ /* intersecting region */
@ -275,13 +280,13 @@ gimp_drawable_offset (GimpDrawable *drawable,
pixel_region_init (&destPR, new_tiles, pixel_region_init (&destPR, new_tiles,
dest_x, dest_y + offset_y, dest_x, dest_y + offset_y,
ABS (offset_x), ABS (offset_x),
gimp_drawable_height (drawable) - ABS (offset_y), gimp_item_height (item) - ABS (offset_y),
TRUE); TRUE);
else if (offset_y < 0) else if (offset_y < 0)
pixel_region_init (&destPR, new_tiles, pixel_region_init (&destPR, new_tiles,
dest_x, 0, dest_x, 0,
ABS (offset_x), ABS (offset_x),
gimp_drawable_height (drawable) - ABS (offset_y), gimp_item_height (item) - ABS (offset_y),
TRUE); TRUE);
color_region (&destPR, fill); color_region (&destPR, fill);
@ -294,13 +299,13 @@ gimp_drawable_offset (GimpDrawable *drawable,
pixel_region_init (&destPR, new_tiles, pixel_region_init (&destPR, new_tiles,
dest_x + offset_x, dest_x + offset_x,
dest_y, dest_y,
gimp_drawable_width (drawable) - ABS (offset_x), gimp_item_width (item) - ABS (offset_x),
ABS (offset_y), ABS (offset_y),
TRUE); TRUE);
else if (offset_x < 0) else if (offset_x < 0)
pixel_region_init (&destPR, new_tiles, pixel_region_init (&destPR, new_tiles,
0, dest_y, 0, dest_y,
gimp_drawable_width (drawable) - ABS (offset_x), gimp_item_width (item) - ABS (offset_x),
ABS (offset_y), ABS (offset_y),
TRUE); TRUE);
@ -311,18 +316,17 @@ gimp_drawable_offset (GimpDrawable *drawable,
/* push an undo */ /* push an undo */
gimp_drawable_push_undo (drawable, _("Offset Drawable"), gimp_drawable_push_undo (drawable, _("Offset Drawable"),
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (item),
gimp_drawable_height (drawable), gimp_item_height (item),
gimp_drawable_data (drawable), gimp_drawable_data (drawable),
FALSE); FALSE);
/* swap the tiles */ /* swap the tiles */
drawable->tiles = new_tiles; drawable->tiles = new_tiles;
/* update the drawable */ /* update the drawable */
gimp_drawable_update (drawable, gimp_drawable_update (drawable,
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (item),
gimp_drawable_height (drawable)); gimp_item_height (item));
} }

View File

@ -223,6 +223,8 @@ gimp_drawable_preview_private (GimpDrawable *drawable,
/* The hard way */ /* The hard way */
else else
{ {
GimpItem *item = GIMP_ITEM (drawable);
type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)); type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));
switch (type) switch (type)
@ -244,14 +246,14 @@ gimp_drawable_preview_private (GimpDrawable *drawable,
if (width < 1) width = 1; if (width < 1) width = 1;
if (height < 1) height = 1; if (height < 1) height = 1;
while ((width * (subsample + 1) * 2 < gimp_drawable_width (drawable)) && while ((width * (subsample + 1) * 2 < gimp_item_width (item)) &&
(height * (subsample + 1) * 2 < gimp_drawable_height (drawable))) (height * (subsample + 1) * 2 < gimp_item_height (item)))
subsample += 1; subsample += 1;
pixel_region_init (&srcPR, gimp_drawable_data (drawable), pixel_region_init (&srcPR, gimp_drawable_data (drawable),
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (item),
gimp_drawable_height (drawable), gimp_item_height (item),
FALSE); FALSE);
preview_buf = temp_buf_new (width, height, bytes, 0, 0, NULL); preview_buf = temp_buf_new (width, height, bytes, 0, 0, NULL);

View File

@ -726,8 +726,8 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
gimp_drawable_update (drawable, gimp_drawable_update (drawable,
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (GIMP_ITEM (drawable)),
gimp_drawable_height (drawable)); gimp_item_height (GIMP_ITEM (drawable)));
/* if we were operating on the floating selection, then it's boundary /* if we were operating on the floating selection, then it's boundary
* and previews need invalidating * and previews need invalidating

View File

@ -581,6 +581,7 @@ void
gimp_drawable_fill (GimpDrawable *drawable, gimp_drawable_fill (GimpDrawable *drawable,
const GimpRGB *color) const GimpRGB *color)
{ {
GimpItem *item;
GimpImage *gimage; GimpImage *gimage;
PixelRegion destPR; PixelRegion destPR;
guchar c[MAX_CHANNELS]; guchar c[MAX_CHANNELS];
@ -588,7 +589,8 @@ gimp_drawable_fill (GimpDrawable *drawable,
g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); 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); g_return_if_fail (gimage != NULL);
@ -638,15 +640,15 @@ gimp_drawable_fill (GimpDrawable *drawable,
pixel_region_init (&destPR, pixel_region_init (&destPR,
gimp_drawable_data (drawable), gimp_drawable_data (drawable),
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (item),
gimp_drawable_height (drawable), gimp_item_height (item),
TRUE); TRUE);
color_region (&destPR, c); color_region (&destPR, c);
gimp_drawable_update (drawable, gimp_drawable_update (drawable,
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (item),
gimp_drawable_height (drawable)); gimp_item_height (item));
} }
void void
@ -696,28 +698,32 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
gint *x2, gint *x2,
gint *y2) gint *y2)
{ {
GimpItem *item;
GimpImage *gimage; GimpImage *gimage;
gint off_x, off_y;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable)); item = GIMP_ITEM (drawable);
gimage = gimp_item_get_image (item);
g_return_val_if_fail (gimage != NULL, FALSE); g_return_val_if_fail (gimage != NULL, FALSE);
if (gimp_image_mask_bounds (gimage, x1, y1, x2, y2)) if (gimp_image_mask_bounds (gimage, x1, y1, x2, y2))
{ {
gint off_x, off_y;
gimp_drawable_offsets (drawable, &off_x, &off_y); gimp_drawable_offsets (drawable, &off_x, &off_y);
*x1 = CLAMP (*x1 - off_x, 0, gimp_drawable_width (drawable));
*y1 = CLAMP (*y1 - off_y, 0, gimp_drawable_height (drawable)); *x1 = CLAMP (*x1 - off_x, 0, gimp_item_width (item));
*x2 = CLAMP (*x2 - off_x, 0, gimp_drawable_width (drawable)); *y1 = CLAMP (*y1 - off_y, 0, gimp_item_height (item));
*y2 = CLAMP (*y2 - off_y, 0, gimp_drawable_height (drawable)); *x2 = CLAMP (*x2 - off_x, 0, gimp_item_width (item));
*y2 = CLAMP (*y2 - off_y, 0, gimp_item_height (item));
return TRUE; return TRUE;
} }
else else
{ {
*x2 = gimp_drawable_width (drawable); *x2 = gimp_item_width (item);
*y2 = gimp_drawable_height (drawable); *y2 = gimp_item_height (item);
return FALSE; return FALSE;
} }
} }
@ -815,22 +821,6 @@ gimp_drawable_bytes_with_alpha (const GimpDrawable *drawable)
return GIMP_IMAGE_TYPE_BYTES (type); return GIMP_IMAGE_TYPE_BYTES (type);
} }
gint
gimp_drawable_width (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
return GIMP_ITEM (drawable)->width;
}
gint
gimp_drawable_height (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
return GIMP_ITEM (drawable)->height;
}
gboolean gboolean
gimp_drawable_get_visible (const GimpDrawable *drawable) gimp_drawable_get_visible (const GimpDrawable *drawable)
{ {

View File

@ -111,8 +111,6 @@ TileManager * gimp_drawable_data (const GimpDrawable *drawable);
TileManager * gimp_drawable_shadow (GimpDrawable *drawable); TileManager * gimp_drawable_shadow (GimpDrawable *drawable);
gint gimp_drawable_bytes (const GimpDrawable *drawable); gint gimp_drawable_bytes (const GimpDrawable *drawable);
gint gimp_drawable_bytes_with_alpha (const GimpDrawable *drawable); gint gimp_drawable_bytes_with_alpha (const GimpDrawable *drawable);
gint gimp_drawable_width (const GimpDrawable *drawable);
gint gimp_drawable_height (const GimpDrawable *drawable);
gboolean gimp_drawable_get_visible (const GimpDrawable *drawable); gboolean gimp_drawable_get_visible (const GimpDrawable *drawable);
void gimp_drawable_set_visible (GimpDrawable *drawable, void gimp_drawable_set_visible (GimpDrawable *drawable,

View File

@ -112,8 +112,8 @@ gimp_image_contiguous_region_by_seed (GimpImage *gimage,
{ {
pixel_region_init (&srcPR, gimp_drawable_data (drawable), pixel_region_init (&srcPR, gimp_drawable_data (drawable),
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (GIMP_ITEM (drawable)),
gimp_drawable_height (drawable), gimp_item_height (GIMP_ITEM (drawable)),
FALSE); FALSE);
has_alpha = gimp_drawable_has_alpha (drawable); has_alpha = gimp_drawable_has_alpha (drawable);
@ -127,8 +127,8 @@ gimp_image_contiguous_region_by_seed (GimpImage *gimage,
mask = gimp_channel_new_mask (gimage, srcPR.w, srcPR.h); mask = gimp_channel_new_mask (gimage, srcPR.w, srcPR.h);
pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)), pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)),
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (mask)), gimp_item_width (GIMP_ITEM (mask)),
gimp_drawable_height (GIMP_DRAWABLE (mask)), gimp_item_height (GIMP_ITEM (mask)),
TRUE); TRUE);
tile = tile_manager_get_tile (srcPR.tiles, x, y, TRUE, FALSE); tile = tile_manager_get_tile (srcPR.tiles, x, y, TRUE, FALSE);
@ -217,8 +217,8 @@ gimp_image_contiguous_region_by_color (GimpImage *gimage,
d_type = gimp_drawable_type (drawable); d_type = gimp_drawable_type (drawable);
has_alpha = gimp_drawable_has_alpha (drawable); has_alpha = gimp_drawable_has_alpha (drawable);
indexed = gimp_drawable_is_indexed (drawable); indexed = gimp_drawable_is_indexed (drawable);
width = gimp_drawable_width (drawable); width = gimp_item_width (GIMP_ITEM (drawable));
height = gimp_drawable_height (drawable); height = gimp_item_height (GIMP_ITEM (drawable));
pixel_region_init (&imagePR, gimp_drawable_data (drawable), pixel_region_init (&imagePR, gimp_drawable_data (drawable),
0, 0, 0, 0,

View File

@ -192,9 +192,9 @@ gimp_image_crop (GimpImage *gimage,
lx1 = CLAMP (off_x, 0, gimage->width); lx1 = CLAMP (off_x, 0, gimage->width);
ly1 = CLAMP (off_y, 0, gimage->height); ly1 = CLAMP (off_y, 0, gimage->height);
lx2 = CLAMP ((gimp_drawable_width (GIMP_DRAWABLE (layer)) + off_x), lx2 = CLAMP ((gimp_item_width (GIMP_ITEM (layer)) + off_x),
0, gimage->width); 0, gimage->width);
ly2 = CLAMP ((gimp_drawable_height (GIMP_DRAWABLE (layer)) + off_y), ly2 = CLAMP ((gimp_item_height (GIMP_ITEM (layer)) + off_y),
0, gimage->height); 0, gimage->height);
width = lx2 - lx1; width = lx2 - lx1;
height = ly2 - ly1; height = ly2 - ly1;

View File

@ -109,9 +109,9 @@ gimp_image_mask_boundary (GimpImage *gimage,
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y); gimp_drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
x1 = CLAMP (off_x, 0, gimage->width); x1 = CLAMP (off_x, 0, gimage->width);
y1 = CLAMP (off_y, 0, gimage->height); y1 = CLAMP (off_y, 0, gimage->height);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), 0, x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), 0,
gimage->width); gimage->width);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), 0, y2 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), 0,
gimage->height); gimage->height);
return gimp_channel_boundary (gimp_image_get_mask (gimage), return gimp_channel_boundary (gimp_image_get_mask (gimage),

View File

@ -245,8 +245,8 @@ gimp_image_merge_layers (GimpImage *gimage,
{ {
x1 = off_x; x1 = off_x;
y1 = off_y; y1 = off_y;
x2 = off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)); x2 = off_x + gimp_item_width (GIMP_ITEM (layer));
y2 = off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)); y2 = off_y + gimp_item_height (GIMP_ITEM (layer));
} }
else else
{ {
@ -254,10 +254,10 @@ gimp_image_merge_layers (GimpImage *gimage,
x1 = off_x; x1 = off_x;
if (off_y < y1) if (off_y < y1)
y1 = off_y; y1 = off_y;
if ((off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) > x2) if ((off_x + gimp_item_width (GIMP_ITEM (layer))) > x2)
x2 = (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))); x2 = (off_x + gimp_item_width (GIMP_ITEM (layer)));
if ((off_y + gimp_drawable_height (GIMP_DRAWABLE (layer))) > y2) if ((off_y + gimp_item_height (GIMP_ITEM (layer))) > y2)
y2 = (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer))); y2 = (off_y + gimp_item_height (GIMP_ITEM (layer)));
} }
if (merge_type == GIMP_CLIP_TO_IMAGE) if (merge_type == GIMP_CLIP_TO_IMAGE)
{ {
@ -273,8 +273,8 @@ gimp_image_merge_layers (GimpImage *gimage,
{ {
x1 = off_x; x1 = off_x;
y1 = off_y; y1 = off_y;
x2 = off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)); x2 = off_x + gimp_item_width (GIMP_ITEM (layer));
y2 = off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)); y2 = off_y + gimp_item_height (GIMP_ITEM (layer));
} }
break; break;
@ -412,8 +412,8 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y); gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
x3 = CLAMP (off_x, x1, x2); x3 = CLAMP (off_x, x1, x2);
y3 = CLAMP (off_y, y1, y2); y3 = CLAMP (off_y, y1, y2);
x4 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x1, x2); x4 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), x1, x2);
y4 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), y1, y2); y4 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), y1, y2);
/* configure the pixel regions */ /* configure the pixel regions */
pixel_region_init (&src1PR, pixel_region_init (&src1PR,
@ -494,8 +494,8 @@ gimp_image_merge_layers (GimpImage *gimage,
gimp_drawable_update (GIMP_DRAWABLE (merge_layer), gimp_drawable_update (GIMP_DRAWABLE (merge_layer),
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (merge_layer)), gimp_item_width (GIMP_ITEM (merge_layer)),
gimp_drawable_height (GIMP_DRAWABLE (merge_layer))); gimp_item_height (GIMP_ITEM (merge_layer)));
return merge_layer; return merge_layer;
} }

View File

@ -240,8 +240,8 @@ gimp_image_get_new_preview (GimpViewable *viewable,
x = (gint) RINT (ratio * off_x); x = (gint) RINT (ratio * off_x);
y = (gint) RINT (ratio * off_y); y = (gint) RINT (ratio * off_y);
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer))); w = (gint) RINT (ratio * gimp_item_width (GIMP_ITEM (layer)));
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer))); h = (gint) RINT (ratio * gimp_item_height (GIMP_ITEM (layer)));
if (w < 1 || h < 1) if (w < 1 || h < 1)
continue; continue;

View File

@ -394,10 +394,8 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w); x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h); y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), x, x + w);
x, x + w); y2 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), y, y + h);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */ /* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage), pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -545,8 +543,8 @@ gimp_image_initialize_projection (GimpImage *gimage,
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) && ! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) &&
(off_x <= x) && (off_x <= x) &&
(off_y <= y) && (off_y <= y) &&
(off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)) >= x + w) && (off_x + gimp_item_width (GIMP_ITEM (layer)) >= x + w) &&
(off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)) >= y + h)) (off_y + gimp_item_height (GIMP_ITEM (layer)) >= y + h))
{ {
coverage = 1; coverage = 1;
break; break;
@ -591,9 +589,9 @@ gimp_image_construct (GimpImage *gimage,
/* It's !flat. */ /* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) && (gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */ /* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) == (gimp_item_width (GIMP_ITEM (gimage->layers->data)) ==
gimage->width) && gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) == (gimp_item_height (GIMP_ITEM (gimage->layers->data)) ==
gimage->height) && /* Covers all. */ gimage->height) && /* Covers all. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) && (!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
/* Not indexed. */ /* Not indexed. */

View File

@ -89,20 +89,23 @@ gimp_image_undo_push_image (GimpImage *gimage,
gint y2) gint y2)
{ {
GimpUndo *new; GimpUndo *new;
GimpItem *item;
gsize size; gsize size;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
x1 = CLAMP (x1, 0, gimp_drawable_width (drawable)); item = GIMP_ITEM (drawable);
y1 = CLAMP (y1, 0, gimp_drawable_height (drawable));
x2 = CLAMP (x2, 0, gimp_drawable_width (drawable)); x1 = CLAMP (x1, 0, gimp_item_width (item));
y2 = CLAMP (y2, 0, gimp_drawable_height (drawable)); y1 = CLAMP (y1, 0, gimp_item_height (item));
x2 = CLAMP (x2, 0, gimp_item_width (item));
y2 = CLAMP (y2, 0, gimp_item_height (item));
size = sizeof (ImageUndo) + ((x2 - x1) * (y2 - y1) * size = sizeof (ImageUndo) + ((x2 - x1) * (y2 - y1) *
gimp_drawable_bytes (drawable)); gimp_drawable_bytes (drawable));
if ((new = gimp_image_undo_push_item (gimage, GIMP_ITEM (drawable), if ((new = gimp_image_undo_push_item (gimage, item,
size, sizeof (ImageUndo), size, sizeof (ImageUndo),
GIMP_UNDO_IMAGE, undo_desc, GIMP_UNDO_IMAGE, undo_desc,
TRUE, TRUE,
@ -153,6 +156,7 @@ gimp_image_undo_push_image_mod (GimpImage *gimage,
gboolean sparse) gboolean sparse)
{ {
GimpUndo *new; GimpUndo *new;
GimpItem *item;
gsize size; gsize size;
gint dwidth, dheight; gint dwidth, dheight;
@ -160,8 +164,10 @@ gimp_image_undo_push_image_mod (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (tiles != NULL, FALSE); g_return_val_if_fail (tiles != NULL, FALSE);
dwidth = gimp_drawable_width (drawable); item = GIMP_ITEM (drawable);
dheight = gimp_drawable_height (drawable);
dwidth = gimp_item_width (item);
dheight = gimp_item_height (item);
x1 = CLAMP (x1, 0, dwidth); x1 = CLAMP (x1, 0, dwidth);
y1 = CLAMP (y1, 0, dheight); y1 = CLAMP (y1, 0, dheight);
@ -170,7 +176,7 @@ gimp_image_undo_push_image_mod (GimpImage *gimage,
size = sizeof (ImageUndo) + tile_manager_get_memsize (tiles); size = sizeof (ImageUndo) + tile_manager_get_memsize (tiles);
if ((new = gimp_image_undo_push_item (gimage, GIMP_ITEM (drawable), if ((new = gimp_image_undo_push_item (gimage, item,
size, sizeof (ImageUndo), size, sizeof (ImageUndo),
GIMP_UNDO_IMAGE_MOD, undo_desc, GIMP_UNDO_IMAGE_MOD, undo_desc,
TRUE, TRUE,

View File

@ -1635,6 +1635,7 @@ gimp_image_apply_image (GimpImage *gimage,
gint x, gint x,
gint y) gint y)
{ {
GimpItem *item;
GimpChannel *mask; GimpChannel *mask;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
gint offset_x, offset_y; gint offset_x, offset_y;
@ -1643,6 +1644,9 @@ gimp_image_apply_image (GimpImage *gimage,
gboolean active_components[MAX_CHANNELS]; gboolean active_components[MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
item = GIMP_ITEM (drawable);
/* get the selection mask if one exists */ /* get the selection mask if one exists */
mask = (gimp_image_mask_is_empty (gimage) ? mask = (gimp_image_mask_is_empty (gimage) ?
@ -1666,10 +1670,10 @@ gimp_image_apply_image (GimpImage *gimage,
gimp_drawable_offsets (drawable, &offset_x, &offset_y); gimp_drawable_offsets (drawable, &offset_x, &offset_y);
/* make sure the image application coordinates are within gimage bounds */ /* make sure the image application coordinates are within gimage bounds */
x1 = CLAMP (x, 0, gimp_drawable_width (drawable)); x1 = CLAMP (x, 0, gimp_item_width (item));
y1 = CLAMP (y, 0, gimp_drawable_height (drawable)); y1 = CLAMP (y, 0, gimp_item_height (item));
x2 = CLAMP (x + src2PR->w, 0, gimp_drawable_width (drawable)); x2 = CLAMP (x + src2PR->w, 0, gimp_item_width (item));
y2 = CLAMP (y + src2PR->h, 0, gimp_drawable_height (drawable)); y2 = CLAMP (y + src2PR->h, 0, gimp_item_height (item));
if (mask) if (mask)
{ {
@ -1677,10 +1681,10 @@ gimp_image_apply_image (GimpImage *gimage,
* we need to add the layer offset to transform coords * we need to add the layer offset to transform coords
* into the mask coordinate system * into the mask coordinate system
*/ */
x1 = CLAMP (x1, -offset_x, gimp_drawable_width (GIMP_DRAWABLE (mask))-offset_x); x1 = CLAMP (x1, -offset_x, gimp_item_width (GIMP_ITEM (mask))-offset_x);
y1 = CLAMP (y1, -offset_y, gimp_drawable_height (GIMP_DRAWABLE (mask))-offset_y); y1 = CLAMP (y1, -offset_y, gimp_item_height (GIMP_ITEM (mask))-offset_y);
x2 = CLAMP (x2, -offset_x, gimp_drawable_width (GIMP_DRAWABLE (mask))-offset_x); x2 = CLAMP (x2, -offset_x, gimp_item_width (GIMP_ITEM (mask))-offset_x);
y2 = CLAMP (y2, -offset_y, gimp_drawable_height (GIMP_DRAWABLE (mask))-offset_y); y2 = CLAMP (y2, -offset_y, gimp_item_height (GIMP_ITEM (mask))-offset_y);
} }
/* If the calling procedure specified an undo step... */ /* If the calling procedure specified an undo step... */
@ -1752,6 +1756,7 @@ gimp_image_replace_image (GimpImage *gimage,
gint x, gint x,
gint y) gint y)
{ {
GimpItem *item;
GimpChannel *mask; GimpChannel *mask;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
gint offset_x, offset_y; gint offset_x, offset_y;
@ -1762,6 +1767,9 @@ gimp_image_replace_image (GimpImage *gimage,
gboolean active_components[MAX_CHANNELS]; gboolean active_components[MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
item = GIMP_ITEM (drawable);
/* get the selection mask if one exists */ /* get the selection mask if one exists */
mask = (gimp_image_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage); mask = (gimp_image_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1784,10 +1792,10 @@ gimp_image_replace_image (GimpImage *gimage,
gimp_drawable_offsets (drawable, &offset_x, &offset_y); gimp_drawable_offsets (drawable, &offset_x, &offset_y);
/* make sure the image application coordinates are within gimage bounds */ /* make sure the image application coordinates are within gimage bounds */
x1 = CLAMP (x, 0, gimp_drawable_width (drawable)); x1 = CLAMP (x, 0, gimp_item_width (item));
y1 = CLAMP (y, 0, gimp_drawable_height (drawable)); y1 = CLAMP (y, 0, gimp_item_height (item));
x2 = CLAMP (x + src2PR->w, 0, gimp_drawable_width (drawable)); x2 = CLAMP (x + src2PR->w, 0, gimp_item_width (item));
y2 = CLAMP (y + src2PR->h, 0, gimp_drawable_height (drawable)); y2 = CLAMP (y + src2PR->h, 0, gimp_item_height (item));
if (mask) if (mask)
{ {
@ -1795,10 +1803,10 @@ gimp_image_replace_image (GimpImage *gimage,
* we need to add the layer offset to transform coords * we need to add the layer offset to transform coords
* into the mask coordinate system * into the mask coordinate system
*/ */
x1 = CLAMP (x1, -offset_x, gimp_drawable_width (GIMP_DRAWABLE (mask))-offset_x); x1 = CLAMP (x1, -offset_x, gimp_item_width (GIMP_ITEM (mask))-offset_x);
y1 = CLAMP (y1, -offset_y, gimp_drawable_height(GIMP_DRAWABLE (mask))-offset_y); y1 = CLAMP (y1, -offset_y, gimp_item_height(GIMP_ITEM (mask))-offset_y);
x2 = CLAMP (x2, -offset_x, gimp_drawable_width (GIMP_DRAWABLE (mask))-offset_x); x2 = CLAMP (x2, -offset_x, gimp_item_width (GIMP_ITEM (mask))-offset_x);
y2 = CLAMP (y2, -offset_y, gimp_drawable_height(GIMP_DRAWABLE (mask))-offset_y); y2 = CLAMP (y2, -offset_y, gimp_item_height(GIMP_ITEM (mask))-offset_y);
} }
/* If the calling procedure specified an undo step... */ /* If the calling procedure specified an undo step... */
@ -2553,8 +2561,8 @@ gimp_image_add_layer (GimpImage *gimage,
/* update the new layer's area */ /* update the new layer's area */
gimp_drawable_update (GIMP_DRAWABLE (layer), gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (layer)), gimp_item_width (GIMP_ITEM (layer)),
gimp_drawable_height (GIMP_DRAWABLE (layer))); gimp_item_height (GIMP_ITEM (layer)));
if (alpha_changed) if (alpha_changed)
gimp_image_alpha_changed (gimage); gimp_image_alpha_changed (gimage);
@ -2609,8 +2617,8 @@ gimp_image_remove_layer (GimpImage *gimage,
gimp_item_removed (GIMP_ITEM (layer)); gimp_item_removed (GIMP_ITEM (layer));
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x, &y); gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x, &y);
w = gimp_drawable_width (GIMP_DRAWABLE (layer)); w = gimp_item_width (GIMP_ITEM (layer));
h = gimp_drawable_height (GIMP_DRAWABLE (layer)); h = gimp_item_height (GIMP_ITEM (layer));
g_object_unref (layer); g_object_unref (layer);
@ -2782,8 +2790,8 @@ gimp_image_position_layer (GimpImage *gimage,
gimp_image_update (gimage, gimp_image_update (gimage,
off_x, off_y, off_x, off_y,
gimp_drawable_width (GIMP_DRAWABLE (layer)), gimp_item_width (GIMP_ITEM (layer)),
gimp_drawable_height (GIMP_DRAWABLE (layer))); gimp_item_height (GIMP_ITEM (layer)));
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimage)); gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimage));
@ -2849,8 +2857,8 @@ gimp_image_add_channel (GimpImage *gimage,
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel))) if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
gimp_drawable_update (GIMP_DRAWABLE (channel), gimp_drawable_update (GIMP_DRAWABLE (channel),
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)), gimp_item_width (GIMP_ITEM (channel)),
gimp_drawable_height (GIMP_DRAWABLE (channel))); gimp_item_height (GIMP_ITEM (channel)));
return TRUE; return TRUE;
} }
@ -2975,8 +2983,8 @@ gimp_image_position_channel (GimpImage *gimage,
gimp_drawable_update (GIMP_DRAWABLE (channel), gimp_drawable_update (GIMP_DRAWABLE (channel),
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)), gimp_item_width (GIMP_ITEM (channel)),
gimp_drawable_height (GIMP_DRAWABLE (channel))); gimp_item_height (GIMP_ITEM (channel)));
return TRUE; return TRUE;
} }

View File

@ -435,8 +435,8 @@ gimp_image_map_get_color_at (GimpImageMap *image_map,
g_return_val_if_fail (GIMP_IS_IMAGE_MAP (image_map), NULL); g_return_val_if_fail (GIMP_IS_IMAGE_MAP (image_map), NULL);
if (x >= 0 && x < gimp_drawable_width (image_map->drawable) && if (x >= 0 && x < gimp_item_width (GIMP_ITEM (image_map->drawable)) &&
y >= 0 && y < gimp_drawable_height (image_map->drawable)) y >= 0 && y < gimp_item_height (GIMP_ITEM (image_map->drawable)))
{ {
/* Check if done damage to original image */ /* Check if done damage to original image */
if (! image_map->undo_tiles) if (! image_map->undo_tiles)

View File

@ -328,6 +328,22 @@ gimp_item_rename (GimpItem *item,
item_class->rename (item, new_name, item_class->rename_desc); item_class->rename (item, new_name, item_class->rename_desc);
} }
gint
gimp_item_width (const GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), -1);
return item->width;
}
gint
gimp_item_height (const GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), -1);
return item->height;
}
void void
gimp_item_scale (GimpItem *item, gimp_item_scale (GimpItem *item,
gint new_width, gint new_width,

View File

@ -94,6 +94,9 @@ GimpItem * gimp_item_duplicate (GimpItem *item,
void gimp_item_rename (GimpItem *item, void gimp_item_rename (GimpItem *item,
const gchar *new_name); const gchar *new_name);
gint gimp_item_width (const GimpItem *item);
gint gimp_item_height (const GimpItem *item);
void gimp_item_scale (GimpItem *item, void gimp_item_scale (GimpItem *item,
gint new_width, gint new_width,
gint new_height, gint new_height,

View File

@ -211,8 +211,8 @@ floating_sel_to_layer (GimpLayer *layer)
/* determine whether the resulting layer needs an update */ /* determine whether the resulting layer needs an update */
gimp_drawable_offsets (layer->fs.drawable, &off_x, &off_y); gimp_drawable_offsets (layer->fs.drawable, &off_x, &off_y);
width = gimp_drawable_width (layer->fs.drawable); width = gimp_item_width (GIMP_ITEM (layer->fs.drawable));
height = gimp_drawable_height (layer->fs.drawable); height = gimp_item_height (GIMP_ITEM (layer->fs.drawable));
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_FS_TO_LAYER, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_FS_TO_LAYER,
_("Floating Selection to Layer")); _("Floating Selection to Layer"));
@ -250,9 +250,12 @@ floating_sel_store (GimpLayer *layer,
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
/* Check the backing store & make sure it has the correct dimensions */ /* Check the backing store & make sure it has the correct dimensions */
if ((tile_manager_width (layer->fs.backing_store) != gimp_drawable_width (GIMP_DRAWABLE(layer))) || if ((tile_manager_width (layer->fs.backing_store) !=
(tile_manager_height (layer->fs.backing_store) != gimp_drawable_height (GIMP_DRAWABLE(layer))) || gimp_item_width (GIMP_ITEM(layer))) ||
(tile_manager_bpp (layer->fs.backing_store) != gimp_drawable_bytes (layer->fs.drawable))) (tile_manager_height (layer->fs.backing_store) !=
gimp_item_height (GIMP_ITEM(layer))) ||
(tile_manager_bpp (layer->fs.backing_store) !=
gimp_drawable_bytes (layer->fs.drawable)))
{ {
/* free the backing store and allocate anew */ /* free the backing store and allocate anew */
tile_manager_destroy (layer->fs.backing_store); tile_manager_destroy (layer->fs.backing_store);
@ -273,9 +276,9 @@ floating_sel_store (GimpLayer *layer,
x1 = MAX (GIMP_ITEM (layer)->offset_x, offx); x1 = MAX (GIMP_ITEM (layer)->offset_x, offx);
y1 = MAX (GIMP_ITEM (layer)->offset_y, offy); y1 = MAX (GIMP_ITEM (layer)->offset_y, offy);
x2 = MIN (GIMP_ITEM (layer)->offset_x + GIMP_ITEM (layer)->width, x2 = MIN (GIMP_ITEM (layer)->offset_x + GIMP_ITEM (layer)->width,
offx + gimp_drawable_width (layer->fs.drawable)); offx + gimp_item_width (GIMP_ITEM (layer->fs.drawable)));
y2 = MIN (GIMP_ITEM (layer)->offset_y + GIMP_ITEM (layer)->height, y2 = MIN (GIMP_ITEM (layer)->offset_y + GIMP_ITEM (layer)->height,
offy + gimp_drawable_height (layer->fs.drawable)); offy + gimp_item_height (GIMP_ITEM (layer->fs.drawable)));
x1 = CLAMP (x, x1, x2); x1 = CLAMP (x, x1, x2);
y1 = CLAMP (y, y1, y2); y1 = CLAMP (y, y1, y2);
@ -318,9 +321,9 @@ floating_sel_restore (GimpLayer *layer,
x1 = MAX (GIMP_ITEM (layer)->offset_x, offx); x1 = MAX (GIMP_ITEM (layer)->offset_x, offx);
y1 = MAX (GIMP_ITEM (layer)->offset_y, offy); y1 = MAX (GIMP_ITEM (layer)->offset_y, offy);
x2 = MIN (GIMP_ITEM (layer)->offset_x + GIMP_ITEM (layer)->width, x2 = MIN (GIMP_ITEM (layer)->offset_x + GIMP_ITEM (layer)->width,
offx + gimp_drawable_width (layer->fs.drawable)); offx + gimp_item_width (GIMP_ITEM (layer->fs.drawable)));
y2 = MIN (GIMP_ITEM(layer)->offset_y + GIMP_ITEM (layer)->height, y2 = MIN (GIMP_ITEM(layer)->offset_y + GIMP_ITEM (layer)->height,
offy + gimp_drawable_height (layer->fs.drawable)); offy + gimp_item_height (GIMP_ITEM (layer->fs.drawable)));
x1 = CLAMP (x, x1, x2); x1 = CLAMP (x, x1, x2);
y1 = CLAMP (y, y1, y2); y1 = CLAMP (y, y1, y2);
@ -424,10 +427,10 @@ floating_sel_composite (GimpLayer *layer,
y1 = MAX (GIMP_ITEM (layer)->offset_y, offy); y1 = MAX (GIMP_ITEM (layer)->offset_y, offy);
x2 = MIN (GIMP_ITEM (layer)->offset_x + x2 = MIN (GIMP_ITEM (layer)->offset_x +
GIMP_ITEM (layer)->width, GIMP_ITEM (layer)->width,
offx + gimp_drawable_width (layer->fs.drawable)); offx + gimp_item_width (GIMP_ITEM (layer->fs.drawable)));
y2 = MIN (GIMP_ITEM (layer)->offset_y + y2 = MIN (GIMP_ITEM (layer)->offset_y +
GIMP_ITEM (layer)->height, GIMP_ITEM (layer)->height,
offy + gimp_drawable_height (layer->fs.drawable)); offy + gimp_item_height (GIMP_ITEM (layer->fs.drawable)));
x1 = CLAMP (x, x1, x2); x1 = CLAMP (x, x1, x2);
y1 = CLAMP (y, y1, y2); y1 = CLAMP (y, y1, y2);

View File

@ -588,6 +588,7 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
{ {
GimpImageBaseType src_base_type; GimpImageBaseType src_base_type;
GimpDrawable *new_drawable; GimpDrawable *new_drawable;
GimpItem *new_item;
GimpImageBaseType new_base_type; GimpImageBaseType new_base_type;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -596,9 +597,11 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
src_base_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)); src_base_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));
new_base_type = gimp_image_base_type (dest_image); new_base_type = gimp_image_base_type (dest_image);
new_drawable = GIMP_DRAWABLE (gimp_item_duplicate (GIMP_ITEM (drawable), new_item = gimp_item_duplicate (GIMP_ITEM (drawable),
GIMP_TYPE_LAYER, GIMP_TYPE_LAYER,
TRUE)); TRUE);
new_drawable = GIMP_DRAWABLE (new_item);
if (src_base_type != new_base_type) if (src_base_type != new_base_type)
{ {
@ -610,8 +613,8 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
if (gimp_drawable_has_alpha (new_drawable)) if (gimp_drawable_has_alpha (new_drawable))
new_type = GIMP_IMAGE_TYPE_WITH_ALPHA (new_type); new_type = GIMP_IMAGE_TYPE_WITH_ALPHA (new_type);
new_tiles = tile_manager_new (gimp_drawable_width (new_drawable), new_tiles = tile_manager_new (gimp_item_width (new_item),
gimp_drawable_height (new_drawable), gimp_item_height (new_item),
GIMP_IMAGE_TYPE_BYTES (new_type)); GIMP_IMAGE_TYPE_BYTES (new_type));
switch (new_base_type) switch (new_base_type)
@ -635,13 +638,13 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
pixel_region_init (&layerPR, new_drawable->tiles, pixel_region_init (&layerPR, new_drawable->tiles,
0, 0, 0, 0,
gimp_drawable_width (new_drawable), gimp_item_width (new_item),
gimp_drawable_height (new_drawable), gimp_item_height (new_item),
FALSE); FALSE);
pixel_region_init (&newPR, new_tiles, pixel_region_init (&newPR, new_tiles,
0, 0, 0, 0,
gimp_drawable_width (new_drawable), gimp_item_width (new_item),
gimp_drawable_height (new_drawable), gimp_item_height (new_item),
TRUE); TRUE);
gimp_layer_transform_color (dest_image, gimp_layer_transform_color (dest_image,
@ -660,7 +663,7 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
new_drawable->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (new_type); new_drawable->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (new_type);
} }
gimp_item_set_image (GIMP_ITEM (new_drawable), dest_image); gimp_item_set_image (new_item, dest_image);
return GIMP_LAYER (new_drawable); return GIMP_LAYER (new_drawable);
} }
@ -698,10 +701,10 @@ gimp_layer_add_mask (GimpLayer *layer,
return NULL; return NULL;
} }
if ((gimp_drawable_width (GIMP_DRAWABLE (layer)) != if ((gimp_item_width (GIMP_ITEM (layer)) !=
gimp_drawable_width (GIMP_DRAWABLE (mask))) || gimp_item_width (GIMP_ITEM (mask))) ||
(gimp_drawable_height (GIMP_DRAWABLE (layer)) != (gimp_item_height (GIMP_ITEM (layer)) !=
gimp_drawable_height (GIMP_DRAWABLE (mask)))) gimp_item_height (GIMP_ITEM (mask))))
{ {
g_message(_("Cannot add layer mask of different " g_message(_("Cannot add layer mask of different "
"dimensions than specified layer.")); "dimensions than specified layer."));

View File

@ -223,8 +223,8 @@ gimp_layer_mask_set_apply (GimpLayerMask *layer_mask,
gimp_drawable_update (drawable, gimp_drawable_update (drawable,
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (GIMP_ITEM (drawable)),
gimp_drawable_height (drawable)); gimp_item_height (GIMP_ITEM (drawable)));
} }
g_signal_emit (layer_mask, layer_mask_signals[APPLY_CHANGED], 0); g_signal_emit (layer_mask, layer_mask_signals[APPLY_CHANGED], 0);
@ -279,8 +279,8 @@ gimp_layer_mask_set_show (GimpLayerMask *layer_mask,
gimp_drawable_update (drawable, gimp_drawable_update (drawable,
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (GIMP_ITEM (drawable)),
gimp_drawable_height (drawable)); gimp_item_height (GIMP_ITEM (drawable)));
} }
g_signal_emit (layer_mask, layer_mask_signals[SHOW_CHANGED], 0); g_signal_emit (layer_mask, layer_mask_signals[SHOW_CHANGED], 0);

View File

@ -394,10 +394,8 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w); x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h); y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), x, x + w);
x, x + w); y2 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), y, y + h);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */ /* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage), pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -545,8 +543,8 @@ gimp_image_initialize_projection (GimpImage *gimage,
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) && ! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) &&
(off_x <= x) && (off_x <= x) &&
(off_y <= y) && (off_y <= y) &&
(off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)) >= x + w) && (off_x + gimp_item_width (GIMP_ITEM (layer)) >= x + w) &&
(off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)) >= y + h)) (off_y + gimp_item_height (GIMP_ITEM (layer)) >= y + h))
{ {
coverage = 1; coverage = 1;
break; break;
@ -591,9 +589,9 @@ gimp_image_construct (GimpImage *gimage,
/* It's !flat. */ /* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) && (gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */ /* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) == (gimp_item_width (GIMP_ITEM (gimage->layers->data)) ==
gimage->width) && gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) == (gimp_item_height (GIMP_ITEM (gimage->layers->data)) ==
gimage->height) && /* Covers all. */ gimage->height) && /* Covers all. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) && (!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
/* Not indexed. */ /* Not indexed. */

View File

@ -406,11 +406,11 @@ gimp_display_coords_in_active_drawable (GimpDisplay *gdisp,
gimp_drawable_offsets (drawable, &x, &y); gimp_drawable_offsets (drawable, &x, &y);
x = ROUND (coords->x) - x; x = ROUND (coords->x) - x;
if (x < 0 || x > gimp_drawable_width (drawable)) if (x < 0 || x > gimp_item_width (GIMP_ITEM (drawable)))
return FALSE; return FALSE;
y = ROUND (coords->y) - y; y = ROUND (coords->y) - y;
if (y < 0 || y > gimp_drawable_height (drawable)) if (y < 0 || y > gimp_item_height (GIMP_ITEM (drawable)))
return FALSE; return FALSE;
return TRUE; return TRUE;

View File

@ -176,9 +176,11 @@ gimp_scan_convert_to_channel (GimpScanConvert *sc,
svp2 = art_svp_uncross (svp); svp2 = art_svp_uncross (svp);
svp3 = art_svp_rewind_uncrossed (svp2, ART_WIND_RULE_ODDEVEN); svp3 = art_svp_rewind_uncrossed (svp2, ART_WIND_RULE_ODDEVEN);
pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)), 0, 0, pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)),
gimp_drawable_width (GIMP_DRAWABLE (mask)), 0, 0,
gimp_drawable_height (GIMP_DRAWABLE (mask)), TRUE); gimp_item_width (GIMP_ITEM (mask)),
gimp_item_height (GIMP_ITEM (mask)),
TRUE);
g_return_val_if_fail (maskPR.bytes == 1, NULL); g_return_val_if_fail (maskPR.bytes == 1, NULL);

View File

@ -406,11 +406,11 @@ gimp_display_coords_in_active_drawable (GimpDisplay *gdisp,
gimp_drawable_offsets (drawable, &x, &y); gimp_drawable_offsets (drawable, &x, &y);
x = ROUND (coords->x) - x; x = ROUND (coords->x) - x;
if (x < 0 || x > gimp_drawable_width (drawable)) if (x < 0 || x > gimp_item_width (GIMP_ITEM (drawable)))
return FALSE; return FALSE;
y = ROUND (coords->y) - y; y = ROUND (coords->y) - y;
if (y < 0 || y > gimp_drawable_height (drawable)) if (y < 0 || y > gimp_item_height (GIMP_ITEM (drawable)))
return FALSE; return FALSE;
return TRUE; return TRUE;

View File

@ -64,8 +64,8 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
new_layer = gimp_layer_new_from_drawable (drawable, gdisp->gimage); new_layer = gimp_layer_new_from_drawable (drawable, gdisp->gimage);
off_x = (gdisp->gimage->width - gimp_drawable_width (drawable)) / 2; off_x = (gdisp->gimage->width - gimp_item_width (GIMP_ITEM (drawable))) / 2;
off_y = (gdisp->gimage->height - gimp_drawable_height (drawable)) / 2; off_y = (gdisp->gimage->height - gimp_item_height (GIMP_ITEM (drawable))) / 2;
gimp_layer_translate (new_layer, off_x, off_y, FALSE); gimp_layer_translate (new_layer, off_x, off_y, FALSE);

View File

@ -1020,15 +1020,15 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
{ {
*x1 = off_x; *x1 = off_x;
*y1 = off_y; *y1 = off_y;
*x2 = off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)); *x2 = off_x + gimp_item_width (GIMP_ITEM (layer));
*y2 = off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)); *y2 = off_y + gimp_item_height (GIMP_ITEM (layer));
} }
else else
{ {
*x1 = MIN (off_x, *x1); *x1 = MIN (off_x, *x1);
*y1 = MIN (off_y, *y1); *y1 = MIN (off_y, *y1);
*x2 = MAX (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), *x2); *x2 = MAX (off_x + gimp_item_width (GIMP_ITEM (layer)), *x2);
*y2 = MAX (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), *y2); *y2 = MAX (off_y + gimp_item_height (GIMP_ITEM (layer)), *y2);
} }
} }
else if (! gimp_channel_bounds (gimp_image_get_mask (shell->gdisp->gimage), else if (! gimp_channel_bounds (gimp_image_get_mask (shell->gdisp->gimage),

View File

@ -1020,15 +1020,15 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
{ {
*x1 = off_x; *x1 = off_x;
*y1 = off_y; *y1 = off_y;
*x2 = off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)); *x2 = off_x + gimp_item_width (GIMP_ITEM (layer));
*y2 = off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)); *y2 = off_y + gimp_item_height (GIMP_ITEM (layer));
} }
else else
{ {
*x1 = MIN (off_x, *x1); *x1 = MIN (off_x, *x1);
*y1 = MIN (off_y, *y1); *y1 = MIN (off_y, *y1);
*x2 = MAX (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), *x2); *x2 = MAX (off_x + gimp_item_width (GIMP_ITEM (layer)), *x2);
*y2 = MAX (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), *y2); *y2 = MAX (off_y + gimp_item_height (GIMP_ITEM (layer)), *y2);
} }
} }
else if (! gimp_channel_bounds (gimp_image_get_mask (shell->gdisp->gimage), else if (! gimp_channel_bounds (gimp_image_get_mask (shell->gdisp->gimage),

View File

@ -326,8 +326,8 @@ channels_new_channel_query (GimpImage *gimage,
if (template) if (template)
{ {
width = gimp_drawable_width (GIMP_DRAWABLE (template)); width = gimp_item_width (GIMP_ITEM (template));
height = gimp_drawable_height (GIMP_DRAWABLE (template)); height = gimp_item_height (GIMP_ITEM (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y); gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
color = template->color; color = template->color;
} }

View File

@ -525,8 +525,8 @@ layers_new_layer_query (GimpImage *gimage,
if (template) if (template)
{ {
width = gimp_drawable_width (GIMP_DRAWABLE (template)); width = gimp_item_width (GIMP_ITEM (template));
height = gimp_drawable_height (GIMP_DRAWABLE (template)); height = gimp_item_height (GIMP_ITEM (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y); gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
opacity = template->opacity; opacity = template->opacity;
mode = template->mode; mode = template->mode;
@ -981,8 +981,8 @@ layers_scale_layer_query (GimpImage *gimage,
options->resize = options->resize =
resize_widget_new (GIMP_VIEWABLE (layer), resize_widget_new (GIMP_VIEWABLE (layer),
ScaleWidget, ScaleWidget,
gimp_drawable_width (GIMP_DRAWABLE (layer)), gimp_item_width (GIMP_ITEM (layer)),
gimp_drawable_height (GIMP_DRAWABLE (layer)), gimp_item_height (GIMP_ITEM (layer)),
gimage->xresolution, gimage->xresolution,
gimage->yresolution, gimage->yresolution,
gimage->unit, gimage->unit,
@ -1075,8 +1075,8 @@ layers_resize_layer_query (GimpImage *gimage,
options->resize = options->resize =
resize_widget_new (GIMP_VIEWABLE (layer), resize_widget_new (GIMP_VIEWABLE (layer),
ResizeWidget, ResizeWidget,
gimp_drawable_width (GIMP_DRAWABLE (layer)), gimp_item_width (GIMP_ITEM (layer)),
gimp_drawable_height (GIMP_DRAWABLE (layer)), gimp_item_height (GIMP_ITEM (layer)),
gimage->xresolution, gimage->xresolution,
gimage->yresolution, gimage->yresolution,
gimage->unit, gimage->unit,

View File

@ -335,13 +335,13 @@ gimp_clone_motion (GimpPaintCore *paint_core,
temp_buf_data_clear (area); temp_buf_data_clear (area);
x1 = CLAMP (area->x + offset_x, x1 = CLAMP (area->x + offset_x,
0, gimp_drawable_width (clone->src_drawable)); 0, gimp_item_width (GIMP_ITEM (clone->src_drawable)));
y1 = CLAMP (area->y + offset_y, y1 = CLAMP (area->y + offset_y,
0, gimp_drawable_height (clone->src_drawable)); 0, gimp_item_height (GIMP_ITEM (clone->src_drawable)));
x2 = CLAMP (area->x + offset_x + area->width, x2 = CLAMP (area->x + offset_x + area->width,
0, gimp_drawable_width (clone->src_drawable)); 0, gimp_item_width (GIMP_ITEM (clone->src_drawable)));
y2 = CLAMP (area->y + offset_y + area->height, y2 = CLAMP (area->y + offset_y + area->height,
0, gimp_drawable_height (clone->src_drawable)); 0, gimp_item_height (GIMP_ITEM (clone->src_drawable)));
if (!(x2 - x1) || !(y2 - y1)) if (!(x2 - x1) || !(y2 - y1))
return; return;

View File

@ -333,9 +333,9 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
fillcolor = gimp_drawable_get_color_at fillcolor = gimp_drawable_get_color_at
(drawable, (drawable,
CLAMP ((gint) paint_core->cur_coords.x, CLAMP ((gint) paint_core->cur_coords.x,
0, gimp_drawable_width (drawable) - 1), 0, gimp_item_width (GIMP_ITEM (drawable)) - 1),
CLAMP ((gint) paint_core->cur_coords.y, CLAMP ((gint) paint_core->cur_coords.y,
0, gimp_drawable_height (drawable) - 1)); 0, gimp_item_height (GIMP_ITEM (drawable)) - 1));
marginx *= (marginx < 0) ? -1 : 0; marginx *= (marginx < 0) ? -1 : 0;
marginy *= (marginy < 0) ? -1 : 0; marginy *= (marginy < 0) ? -1 : 0;

View File

@ -241,12 +241,15 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
* paint from this stroke yet) * paint from this stroke yet)
*/ */
{ {
gint x1, y1, x2, y2; GimpItem *item;
gint x1, y1, x2, y2;
x1 = CLAMP (area->x, 0, gimp_drawable_width (drawable)); item = GIMP_ITEM (drawable);
y1 = CLAMP (area->y, 0, gimp_drawable_height (drawable));
x2 = CLAMP (area->x + area->width, 0, gimp_drawable_width (drawable)); x1 = CLAMP (area->x, 0, gimp_item_width (item));
y2 = CLAMP (area->y + area->height, 0, gimp_drawable_height (drawable)); y1 = CLAMP (area->y, 0, gimp_item_height (item));
x2 = CLAMP (area->x + area->width, 0, gimp_item_width (item));
y2 = CLAMP (area->y + area->height, 0, gimp_item_height (item));
if (!(x2 - x1) || !(y2 - y1)) if (!(x2 - x1) || !(y2 - y1))
return; return;

View File

@ -475,8 +475,8 @@ gimp_ink_tool_cursor_update (GimpTool *tool,
if (coords->x >= off_x && if (coords->x >= off_x &&
coords->y >= off_y && coords->y >= off_y &&
coords->x < (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) && coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)))) coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
{ {
/* One more test--is there a selected region? /* One more test--is there a selected region?
* if so, is cursor inside? * if so, is cursor inside?
@ -691,6 +691,8 @@ ink_init (GimpInkTool *ink_tool,
gdouble x, gdouble x,
gdouble y) gdouble y)
{ {
GimpItem *item = GIMP_ITEM (drawable);
/* free the block structures */ /* free the block structures */
if (undo_tiles) if (undo_tiles)
tile_manager_destroy (undo_tiles); tile_manager_destroy (undo_tiles);
@ -698,13 +700,13 @@ ink_init (GimpInkTool *ink_tool,
tile_manager_destroy (canvas_tiles); tile_manager_destroy (canvas_tiles);
/* Allocate the undo structure */ /* Allocate the undo structure */
undo_tiles = tile_manager_new (gimp_drawable_width (drawable), undo_tiles = tile_manager_new (gimp_item_width (item),
gimp_drawable_height (drawable), gimp_item_height (item),
gimp_drawable_bytes (drawable)); gimp_drawable_bytes (drawable));
/* Allocate the canvas blocks structure */ /* Allocate the canvas blocks structure */
canvas_tiles = tile_manager_new (gimp_drawable_width (drawable), canvas_tiles = tile_manager_new (gimp_item_width (item),
gimp_drawable_height (drawable), 1); gimp_item_height (item), 1);
/* Get the initial undo extents */ /* Get the initial undo extents */
ink_tool->x1 = ink_tool->x2 = x; ink_tool->x1 = ink_tool->x2 = x;
@ -770,19 +772,20 @@ ink_set_paint_area (GimpInkTool *ink_tool,
GimpDrawable *drawable, GimpDrawable *drawable,
Blob *blob) Blob *blob)
{ {
gint x, y, width, height; GimpItem *item = GIMP_ITEM (drawable);
gint x1, y1, x2, y2; gint x, y, width, height;
gint bytes; gint x1, y1, x2, y2;
gint bytes;
blob_bounds (blob, &x, &y, &width, &height); blob_bounds (blob, &x, &y, &width, &height);
bytes = gimp_drawable_has_alpha (drawable) ? bytes = gimp_drawable_has_alpha (drawable) ?
gimp_drawable_bytes (drawable) : gimp_drawable_bytes (drawable) + 1; gimp_drawable_bytes (drawable) : gimp_drawable_bytes (drawable) + 1;
x1 = CLAMP (x/SUBSAMPLE - 1, 0, gimp_drawable_width (drawable)); x1 = CLAMP (x/SUBSAMPLE - 1, 0, gimp_item_width (item));
y1 = CLAMP (y/SUBSAMPLE - 1, 0, gimp_drawable_height (drawable)); y1 = CLAMP (y/SUBSAMPLE - 1, 0, gimp_item_height (item));
x2 = CLAMP ((x + width)/SUBSAMPLE + 2, 0, gimp_drawable_width (drawable)); x2 = CLAMP ((x + width)/SUBSAMPLE + 2, 0, gimp_item_width (item));
y2 = CLAMP ((y + height)/SUBSAMPLE + 2, 0, gimp_drawable_height (drawable)); y2 = CLAMP ((y + height)/SUBSAMPLE + 2, 0, gimp_item_height (item));
/* configure the canvas buffer */ /* configure the canvas buffer */
if ((x2 - x1) && (y2 - y1)) if ((x2 - x1) && (y2 - y1))

View File

@ -345,6 +345,7 @@ gimp_paint_core_start (GimpPaintCore *core,
GimpPaintOptions *paint_options, GimpPaintOptions *paint_options,
GimpCoords *coords) GimpCoords *coords)
{ {
GimpItem *item;
GimpImage *gimage; GimpImage *gimage;
g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), FALSE); g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), FALSE);
@ -352,7 +353,8 @@ gimp_paint_core_start (GimpPaintCore *core,
g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), FALSE); g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), FALSE);
g_return_val_if_fail (coords != NULL, FALSE); g_return_val_if_fail (coords != NULL, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable)); item = GIMP_ITEM (drawable);
gimage = gimp_item_get_image (item);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
@ -392,16 +394,16 @@ gimp_paint_core_start (GimpPaintCore *core,
if (core->undo_tiles) if (core->undo_tiles)
tile_manager_destroy (core->undo_tiles); tile_manager_destroy (core->undo_tiles);
core->undo_tiles = tile_manager_new (gimp_drawable_width (drawable), core->undo_tiles = tile_manager_new (gimp_item_width (item),
gimp_drawable_height (drawable), gimp_item_height (item),
gimp_drawable_bytes (drawable)); gimp_drawable_bytes (drawable));
/* Allocate the canvas blocks structure */ /* Allocate the canvas blocks structure */
if (core->canvas_tiles) if (core->canvas_tiles)
tile_manager_destroy (core->canvas_tiles); tile_manager_destroy (core->canvas_tiles);
core->canvas_tiles = tile_manager_new (gimp_drawable_width (drawable), core->canvas_tiles = tile_manager_new (gimp_item_width (item),
gimp_drawable_height (drawable), gimp_item_height (item),
1); 1);
/* Get the initial undo extents */ /* Get the initial undo extents */
@ -844,8 +846,8 @@ gimp_paint_core_get_paint_area (GimpPaintCore *core,
x = (gint) floor (core->cur_coords.x) - (bwidth >> 1); x = (gint) floor (core->cur_coords.x) - (bwidth >> 1);
y = (gint) floor (core->cur_coords.y) - (bheight >> 1); y = (gint) floor (core->cur_coords.y) - (bheight >> 1);
dwidth = gimp_drawable_width (drawable); dwidth = gimp_item_width (GIMP_ITEM (drawable));
dheight = gimp_drawable_height (drawable); dheight = gimp_item_height (GIMP_ITEM (drawable));
x1 = CLAMP (x - 1, 0, dwidth); x1 = CLAMP (x - 1, 0, dwidth);
y1 = CLAMP (y - 1, 0, dheight); y1 = CLAMP (y - 1, 0, dheight);
@ -888,8 +890,8 @@ gimp_paint_core_get_orig_image (GimpPaintCore *core,
x1, y1, x1, y1,
(x2 - x1), (y2 - y1)); (x2 - x1), (y2 - y1));
dwidth = gimp_drawable_width (drawable); dwidth = gimp_item_width (GIMP_ITEM (drawable));
dheight = gimp_drawable_height (drawable); dheight = gimp_item_height (GIMP_ITEM (drawable));
x1 = CLAMP (x1, 0, dwidth); x1 = CLAMP (x1, 0, dwidth);
y1 = CLAMP (y1, 0, dheight); y1 = CLAMP (y1, 0, dheight);

View File

@ -233,11 +233,12 @@ gimp_smudge_start (GimpPaintCore *paint_core,
that may enter into the blend */ that may enter into the blend */
if (was_clipped) if (was_clipped)
do_fill = gimp_drawable_get_color_at (drawable, do_fill = gimp_drawable_get_color_at
CLAMP ((gint) paint_core->cur_coords.x, (drawable,
0, gimp_drawable_width (drawable) - 1), CLAMP ((gint) paint_core->cur_coords.x,
CLAMP ((gint) paint_core->cur_coords.y, 0, gimp_item_width (GIMP_ITEM (drawable)) - 1),
0, gimp_drawable_height (drawable) - 1)); CLAMP ((gint) paint_core->cur_coords.y,
0, gimp_item_height (GIMP_ITEM (drawable)) - 1));
gimp_smudge_allocate_accum_buffer (smudge, gimp_smudge_allocate_accum_buffer (smudge,
w, h, w, h,

View File

@ -335,13 +335,13 @@ gimp_clone_motion (GimpPaintCore *paint_core,
temp_buf_data_clear (area); temp_buf_data_clear (area);
x1 = CLAMP (area->x + offset_x, x1 = CLAMP (area->x + offset_x,
0, gimp_drawable_width (clone->src_drawable)); 0, gimp_item_width (GIMP_ITEM (clone->src_drawable)));
y1 = CLAMP (area->y + offset_y, y1 = CLAMP (area->y + offset_y,
0, gimp_drawable_height (clone->src_drawable)); 0, gimp_item_height (GIMP_ITEM (clone->src_drawable)));
x2 = CLAMP (area->x + offset_x + area->width, x2 = CLAMP (area->x + offset_x + area->width,
0, gimp_drawable_width (clone->src_drawable)); 0, gimp_item_width (GIMP_ITEM (clone->src_drawable)));
y2 = CLAMP (area->y + offset_y + area->height, y2 = CLAMP (area->y + offset_y + area->height,
0, gimp_drawable_height (clone->src_drawable)); 0, gimp_item_height (GIMP_ITEM (clone->src_drawable)));
if (!(x2 - x1) || !(y2 - y1)) if (!(x2 - x1) || !(y2 - y1))
return; return;

View File

@ -821,7 +821,7 @@ drawable_width_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&drawable_width_proc, success); return_args = procedural_db_return_args (&drawable_width_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_width (drawable); return_args[1].value.pdb_int = gimp_item_width (GIMP_ITEM (drawable));
return return_args; return return_args;
} }
@ -875,7 +875,7 @@ drawable_height_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&drawable_height_proc, success); return_args = procedural_db_return_args (&drawable_height_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_height (drawable); return_args[1].value.pdb_int = gimp_item_height (GIMP_ITEM (drawable));
return return_args; return return_args;
} }
@ -1172,7 +1172,8 @@ drawable_get_pixel_invoker (Gimp *gimp,
if (success) if (success)
{ {
if (x < gimp_drawable_width (drawable) && y < gimp_drawable_height (drawable)) if (x < gimp_item_width (GIMP_ITEM (drawable)) &&
y < gimp_item_height (GIMP_ITEM (drawable)))
{ {
num_channels = gimp_drawable_bytes (drawable); num_channels = gimp_drawable_bytes (drawable);
pixel = g_new (guint8, num_channels); pixel = g_new (guint8, num_channels);
@ -1285,8 +1286,8 @@ drawable_set_pixel_invoker (Gimp *gimp,
if (success) if (success)
{ {
if (x < gimp_drawable_width (drawable) && if (x < gimp_item_width (GIMP_ITEM (drawable)) &&
y < gimp_drawable_height (drawable) && y < gimp_item_height (GIMP_ITEM (drawable)) &&
num_channels == gimp_drawable_bytes (drawable)) num_channels == gimp_drawable_bytes (drawable))
{ {
tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y, tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y,
@ -1440,8 +1441,8 @@ drawable_thumbnail_invoker (Gimp *gimp,
if (req_width <= 128 && req_height <= 128) if (req_width <= 128 && req_height <= 128)
{ {
/* Adjust the width/height ratio */ /* Adjust the width/height ratio */
dwidth = gimp_drawable_width (GIMP_DRAWABLE (drawable)); dwidth = gimp_item_width (GIMP_ITEM (drawable));
dheight = gimp_drawable_height (GIMP_DRAWABLE (drawable)); dheight = gimp_item_height (GIMP_ITEM (drawable));
if (dwidth > dheight) if (dwidth > dheight)
req_height = MAX (1, (req_width * dheight) / dwidth); req_height = MAX (1, (req_width * dheight) / dwidth);

View File

@ -905,9 +905,9 @@ selection_load_invoker (Gimp *gimp,
if (success) if (success)
{ {
gimage = gimp_item_get_image (GIMP_ITEM (channel)); gimage = gimp_item_get_image (GIMP_ITEM (channel));
if (gimp_drawable_width (GIMP_DRAWABLE (channel)) == gimage->width && if (gimp_item_width (GIMP_ITEM (channel)) == gimage->width &&
gimp_drawable_height (GIMP_DRAWABLE (channel)) == gimage->height) gimp_item_height (GIMP_ITEM (channel)) == gimage->height)
gimp_image_mask_load (gimage, channel); gimp_image_mask_load (gimage, channel);
else else
success = FALSE; success = FALSE;
@ -1020,9 +1020,9 @@ selection_combine_invoker (Gimp *gimp,
if (success) if (success)
{ {
gimage = gimp_item_get_image (GIMP_ITEM (channel)); gimage = gimp_item_get_image (GIMP_ITEM (channel));
if (gimp_drawable_width (GIMP_DRAWABLE (channel)) == gimage->width && if (gimp_item_width (GIMP_ITEM (channel)) == gimage->width &&
gimp_drawable_height (GIMP_DRAWABLE (channel)) == gimage->height) gimp_item_height (GIMP_ITEM (channel)) == gimage->height)
{ {
new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (gimp_image_get_mask (gimage)), new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (gimp_image_get_mask (gimage)),
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)), G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),

View File

@ -288,26 +288,28 @@ gimp_text_layer_idle_render (GimpTextLayer *layer)
static gboolean static gboolean
gimp_text_layer_render (GimpTextLayer *layer) gimp_text_layer_render (GimpTextLayer *layer)
{ {
GimpImage *image;
GimpDrawable *drawable; GimpDrawable *drawable;
GimpItem *item;
GimpImage *image;
GimpTextLayout *layout; GimpTextLayout *layout;
gint width; gint width;
gint height; gint height;
image = gimp_item_get_image (GIMP_ITEM (layer));
drawable = GIMP_DRAWABLE (layer); drawable = GIMP_DRAWABLE (layer);
item = GIMP_ITEM (layer);
image = gimp_item_get_image (item);
layout = gimp_text_layout_new (layer->text, image); layout = gimp_text_layout_new (layer->text, image);
if (gimp_text_layout_get_size (layout, &width, &height)) if (gimp_text_layout_get_size (layout, &width, &height))
{ {
if (width != gimp_drawable_width (drawable) || if (width != gimp_item_width (item) ||
height != gimp_drawable_height (drawable)) height != gimp_item_height (item))
{ {
gimp_drawable_update (drawable, gimp_drawable_update (drawable,
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (item),
gimp_drawable_height (drawable)); gimp_item_height (item));
GIMP_ITEM (drawable)->width = width; GIMP_ITEM (drawable)->width = width;
GIMP_ITEM (drawable)->height = height; GIMP_ITEM (drawable)->height = height;
@ -338,17 +340,21 @@ static void
gimp_text_layer_render_layout (GimpTextLayer *layer, gimp_text_layer_render_layout (GimpTextLayer *layer,
GimpTextLayout *layout) GimpTextLayout *layout)
{ {
GimpDrawable *drawable = GIMP_DRAWABLE (layer); GimpDrawable *drawable;
GimpItem *item;
TileManager *mask; TileManager *mask;
PixelRegion textPR; PixelRegion textPR;
PixelRegion maskPR; PixelRegion maskPR;
gint width; gint width;
gint height; gint height;
drawable = GIMP_DRAWABLE (layer);
item = GIMP_ITEM (layer);
gimp_drawable_fill (drawable, &layer->text->color); gimp_drawable_fill (drawable, &layer->text->color);
width = gimp_drawable_width (drawable); width = gimp_item_width (item);
height = gimp_drawable_height (drawable); height = gimp_item_height (item);
mask = gimp_text_layout_render (layout, width, height); mask = gimp_text_layout_render (layout, width, height);

View File

@ -2535,8 +2535,8 @@ bezier_convert (GimpBezierSelectTool *bezier_sel,
pixel_region_init (&maskPR, pixel_region_init (&maskPR,
gimp_drawable_data (GIMP_DRAWABLE (bezier_sel->mask)), gimp_drawable_data (GIMP_DRAWABLE (bezier_sel->mask)),
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (bezier_sel->mask)), gimp_item_width (GIMP_ITEM (bezier_sel->mask)),
gimp_drawable_height (GIMP_DRAWABLE (bezier_sel->mask)), gimp_item_height (GIMP_ITEM (bezier_sel->mask)),
TRUE); TRUE);
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
@ -2588,7 +2588,7 @@ bezier_convert (GimpBezierSelectTool *bezier_sel,
} }
pixel_region_set_row (&maskPR, 0, (i / SUPERSAMPLE), pixel_region_set_row (&maskPR, 0, (i / SUPERSAMPLE),
gimp_drawable_width (GIMP_DRAWABLE (bezier_sel->mask)), buf); gimp_item_width (GIMP_ITEM (bezier_sel->mask)), buf);
} }
g_slist_free (bezier_sel->scanlines[i]); g_slist_free (bezier_sel->scanlines[i]);

View File

@ -263,8 +263,8 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
if (coords->x >= off_x && if (coords->x >= off_x &&
coords->y >= off_y && coords->y >= off_y &&
coords->x < (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) && coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)))) coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
{ {
/* One more test--is there a selected region? /* One more test--is there a selected region?
* if so, is cursor inside? * if so, is cursor inside?

View File

@ -205,8 +205,8 @@ gimp_by_color_select_tool_button_release (GimpTool *tool,
{ {
if (by_color_sel->x >= 0 && if (by_color_sel->x >= 0 &&
by_color_sel->y >= 0 && by_color_sel->y >= 0 &&
by_color_sel->x < gimp_drawable_width (drawable) && by_color_sel->x < gimp_item_width (GIMP_ITEM (drawable)) &&
by_color_sel->y < gimp_drawable_height (drawable)) by_color_sel->y < gimp_item_height (GIMP_ITEM (drawable)))
{ {
/* Get the start color */ /* Get the start color */
if (options->sample_merged) if (options->sample_merged)

View File

@ -247,8 +247,8 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
if (coords->x >= off_x && if (coords->x >= off_x &&
coords->y >= off_y && coords->y >= off_y &&
coords->x < (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) && coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)))) coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
{ {
/* One more test--is there a selected region? /* One more test--is there a selected region?
* if so, is cursor inside? * if so, is cursor inside?

View File

@ -481,8 +481,8 @@ gimp_crop_tool_motion (GimpTool *tool,
{ {
layer = gimp_image_get_active_layer (gdisp->gimage); layer = gimp_image_get_active_layer (gdisp->gimage);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &min_x, &min_y); gimp_drawable_offsets (GIMP_DRAWABLE (layer), &min_x, &min_y);
max_x = gimp_drawable_width (GIMP_DRAWABLE (layer)) + min_x; max_x = gimp_item_width (GIMP_ITEM (layer)) + min_x;
max_y = gimp_drawable_height (GIMP_DRAWABLE (layer)) + min_y; max_y = gimp_item_height (GIMP_ITEM (layer)) + min_y;
} }
else else
{ {
@ -642,8 +642,8 @@ gimp_crop_tool_arrow_key (GimpTool *tool,
{ {
layer = gimp_image_get_active_layer (gdisp->gimage); layer = gimp_image_get_active_layer (gdisp->gimage);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &min_x, &min_y); gimp_drawable_offsets (GIMP_DRAWABLE (layer), &min_x, &min_y);
max_x = gimp_drawable_width (GIMP_DRAWABLE (layer)) + min_x; max_x = gimp_item_width (GIMP_ITEM (layer)) + min_x;
max_y = gimp_drawable_height (GIMP_DRAWABLE (layer)) + min_y; max_y = gimp_item_height (GIMP_ITEM (layer)) + min_y;
} }
else else
{ {
@ -1172,8 +1172,8 @@ crop_selection_callback (GtkWidget *widget,
layer = gimp_image_get_active_layer (gdisp->gimage); layer = gimp_image_get_active_layer (gdisp->gimage);
gimp_drawable_offsets (GIMP_DRAWABLE (layer), gimp_drawable_offsets (GIMP_DRAWABLE (layer),
&crop->x1, &crop->y1); &crop->x1, &crop->y1);
crop->x2 = gimp_drawable_width (GIMP_DRAWABLE (layer)) + crop->x1; crop->x2 = gimp_item_width (GIMP_ITEM (layer)) + crop->x1;
crop->y2 = gimp_drawable_height (GIMP_DRAWABLE (layer)) + crop->y1; crop->y2 = gimp_item_height (GIMP_ITEM (layer)) + crop->y1;
} }
else else
{ {
@ -1214,8 +1214,8 @@ crop_automatic_callback (GtkWidget *widget,
if (! active_drawable) if (! active_drawable)
return; return;
width = gimp_drawable_width (GIMP_DRAWABLE (active_drawable)); width = gimp_item_width (GIMP_ITEM (active_drawable));
height = gimp_drawable_height (GIMP_DRAWABLE (active_drawable)); height = gimp_item_height (GIMP_ITEM (active_drawable));
gimp_drawable_offsets (GIMP_DRAWABLE (active_drawable), gimp_drawable_offsets (GIMP_DRAWABLE (active_drawable),
&offset_x, &offset_y); &offset_x, &offset_y);
} }

View File

@ -318,8 +318,8 @@ init_edit_selection (GimpTool *tool,
x1 = off_x; x1 = off_x;
y1 = off_y; y1 = off_y;
x2 = x1 + gimp_drawable_width (active_drawable); x2 = x1 + gimp_item_width (GIMP_ITEM (active_drawable));
y2 = y1 + gimp_drawable_height (active_drawable); y2 = y1 + gimp_item_height (GIMP_ITEM (active_drawable));
/* Now, expand the rectangle to include all linked layers as well */ /* Now, expand the rectangle to include all linked layers as well */
for (layer_list = GIMP_LIST (gdisp->gimage->layers)->list; for (layer_list = GIMP_LIST (gdisp->gimage->layers)->list;
@ -335,8 +335,8 @@ init_edit_selection (GimpTool *tool,
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x3, &y3); gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x3, &y3);
x4 = x3 + gimp_drawable_width (GIMP_DRAWABLE (layer)); x4 = x3 + gimp_item_width (GIMP_ITEM (layer));
y4 = y3 + gimp_drawable_height (GIMP_DRAWABLE (layer)); y4 = y3 + gimp_item_height (GIMP_ITEM (layer));
if (x3 < x1) if (x3 < x1)
x1 = x3; x1 = x3;
@ -727,8 +727,8 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
gimp_drawable_offsets (GIMP_DRAWABLE (gdisp->gimage->active_layer), gimp_drawable_offsets (GIMP_DRAWABLE (gdisp->gimage->active_layer),
&x1, &y1); &x1, &y1);
x2 = x1 + gimp_drawable_width (GIMP_DRAWABLE (gdisp->gimage->active_layer)); x2 = x1 + gimp_item_width (GIMP_ITEM (gdisp->gimage->active_layer));
y2 = y1 + gimp_drawable_height (GIMP_DRAWABLE (gdisp->gimage->active_layer)); y2 = y1 + gimp_item_height (GIMP_ITEM (gdisp->gimage->active_layer));
/* Now, expand the rectangle to include all linked layers as well */ /* Now, expand the rectangle to include all linked layers as well */
for (layer_list = GIMP_LIST (gdisp->gimage->layers)->list; for (layer_list = GIMP_LIST (gdisp->gimage->layers)->list;
@ -742,8 +742,8 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
{ {
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x3, &y3); gimp_drawable_offsets (GIMP_DRAWABLE (layer), &x3, &y3);
x4 = x3 + gimp_drawable_width (GIMP_DRAWABLE (layer)); x4 = x3 + gimp_item_width (GIMP_ITEM (layer));
y4 = y3 + gimp_drawable_height (GIMP_DRAWABLE (layer)); y4 = y3 + gimp_item_height (GIMP_ITEM (layer));
if (x3 < x1) if (x3 < x1)
x1 = x3; x1 = x3;

View File

@ -210,8 +210,8 @@ gimp_flip_tool_cursor_update (GimpTool *tool,
if (coords->x >= off_x && if (coords->x >= off_x &&
coords->y >= off_y && coords->y >= off_y &&
coords->x < (off_x + gimp_drawable_width (drawable)) && coords->x < (off_x + gimp_item_width (GIMP_ITEM (drawable))) &&
coords->y < (off_y + gimp_drawable_height (drawable))) coords->y < (off_y + gimp_item_height (GIMP_ITEM (drawable))))
{ {
/* Is there a selected region? If so, is cursor inside? */ /* Is there a selected region? If so, is cursor inside? */
if (gimp_image_mask_is_empty (gdisp->gimage) || if (gimp_image_mask_is_empty (gdisp->gimage) ||

View File

@ -437,13 +437,15 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel,
pixel_region_init (&maskPR, pixel_region_init (&maskPR,
gimp_drawable_data (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)), gimp_drawable_data (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)),
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)), gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
gimp_drawable_height (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)), gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
FALSE); FALSE);
bsegs = find_mask_boundary (&maskPR, num_segs, WithinBounds,
0, 0, bsegs =
gimp_drawable_width (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)), find_mask_boundary (&maskPR, num_segs, WithinBounds,
gimp_drawable_height (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask))); 0, 0,
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)));
segs = g_new (GdkSegment, *num_segs); segs = g_new (GdkSegment, *num_segs);

View File

@ -212,8 +212,8 @@ gimp_histogram_tool_initialize (GimpTool *tool,
/* calculate the histogram */ /* calculate the histogram */
pixel_region_init (&PR, gimp_drawable_data (drawable), pixel_region_init (&PR, gimp_drawable_data (drawable),
0, 0, 0, 0,
gimp_drawable_width (drawable), gimp_item_width (GIMP_ITEM (drawable)),
gimp_drawable_height (drawable), gimp_item_height (GIMP_ITEM (drawable)),
FALSE); FALSE);
gimp_histogram_calculate (histogram_dialog->hist, &PR, NULL); gimp_histogram_calculate (histogram_dialog->hist, &PR, NULL);

View File

@ -475,8 +475,8 @@ gimp_ink_tool_cursor_update (GimpTool *tool,
if (coords->x >= off_x && if (coords->x >= off_x &&
coords->y >= off_y && coords->y >= off_y &&
coords->x < (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) && coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)))) coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
{ {
/* One more test--is there a selected region? /* One more test--is there a selected region?
* if so, is cursor inside? * if so, is cursor inside?
@ -691,6 +691,8 @@ ink_init (GimpInkTool *ink_tool,
gdouble x, gdouble x,
gdouble y) gdouble y)
{ {
GimpItem *item = GIMP_ITEM (drawable);
/* free the block structures */ /* free the block structures */
if (undo_tiles) if (undo_tiles)
tile_manager_destroy (undo_tiles); tile_manager_destroy (undo_tiles);
@ -698,13 +700,13 @@ ink_init (GimpInkTool *ink_tool,
tile_manager_destroy (canvas_tiles); tile_manager_destroy (canvas_tiles);
/* Allocate the undo structure */ /* Allocate the undo structure */
undo_tiles = tile_manager_new (gimp_drawable_width (drawable), undo_tiles = tile_manager_new (gimp_item_width (item),
gimp_drawable_height (drawable), gimp_item_height (item),
gimp_drawable_bytes (drawable)); gimp_drawable_bytes (drawable));
/* Allocate the canvas blocks structure */ /* Allocate the canvas blocks structure */
canvas_tiles = tile_manager_new (gimp_drawable_width (drawable), canvas_tiles = tile_manager_new (gimp_item_width (item),
gimp_drawable_height (drawable), 1); gimp_item_height (item), 1);
/* Get the initial undo extents */ /* Get the initial undo extents */
ink_tool->x1 = ink_tool->x2 = x; ink_tool->x1 = ink_tool->x2 = x;
@ -770,19 +772,20 @@ ink_set_paint_area (GimpInkTool *ink_tool,
GimpDrawable *drawable, GimpDrawable *drawable,
Blob *blob) Blob *blob)
{ {
gint x, y, width, height; GimpItem *item = GIMP_ITEM (drawable);
gint x1, y1, x2, y2; gint x, y, width, height;
gint bytes; gint x1, y1, x2, y2;
gint bytes;
blob_bounds (blob, &x, &y, &width, &height); blob_bounds (blob, &x, &y, &width, &height);
bytes = gimp_drawable_has_alpha (drawable) ? bytes = gimp_drawable_has_alpha (drawable) ?
gimp_drawable_bytes (drawable) : gimp_drawable_bytes (drawable) + 1; gimp_drawable_bytes (drawable) : gimp_drawable_bytes (drawable) + 1;
x1 = CLAMP (x/SUBSAMPLE - 1, 0, gimp_drawable_width (drawable)); x1 = CLAMP (x/SUBSAMPLE - 1, 0, gimp_item_width (item));
y1 = CLAMP (y/SUBSAMPLE - 1, 0, gimp_drawable_height (drawable)); y1 = CLAMP (y/SUBSAMPLE - 1, 0, gimp_item_height (item));
x2 = CLAMP ((x + width)/SUBSAMPLE + 2, 0, gimp_drawable_width (drawable)); x2 = CLAMP ((x + width)/SUBSAMPLE + 2, 0, gimp_item_width (item));
y2 = CLAMP ((y + height)/SUBSAMPLE + 2, 0, gimp_drawable_height (drawable)); y2 = CLAMP ((y + height)/SUBSAMPLE + 2, 0, gimp_item_height (item));
/* configure the canvas buffer */ /* configure the canvas buffer */
if ((x2 - x1) && (y2 - y1)) if ((x2 - x1) && (y2 - y1))

View File

@ -536,13 +536,16 @@ gimp_rect_select_tool_rect_select (GimpRectSelectTool *rect_tool,
if (! options->shrink_merged) if (! options->shrink_merged)
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
GimpItem *item;
gint off_x, off_y; gint off_x, off_y;
gint width, height; gint width, height;
drawable = gimp_image_active_drawable (tool->gdisp->gimage); drawable = gimp_image_active_drawable (tool->gdisp->gimage);
item = GIMP_ITEM (drawable);
gimp_drawable_offsets (drawable, &off_x, &off_y); gimp_drawable_offsets (drawable, &off_x, &off_y);
width = gimp_drawable_width (drawable); width = gimp_item_width (item);
height = gimp_drawable_height (drawable); height = gimp_item_height (item);
x = CLAMP (x, off_x, off_x + width); x = CLAMP (x, off_x, off_x + width);
y = CLAMP (y, off_y, off_y + height); y = CLAMP (y, off_y, off_y + height);

View File

@ -437,13 +437,15 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel,
pixel_region_init (&maskPR, pixel_region_init (&maskPR,
gimp_drawable_data (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)), gimp_drawable_data (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)),
0, 0, 0, 0,
gimp_drawable_width (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)), gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
gimp_drawable_height (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)), gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
FALSE); FALSE);
bsegs = find_mask_boundary (&maskPR, num_segs, WithinBounds,
0, 0, bsegs =
gimp_drawable_width (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)), find_mask_boundary (&maskPR, num_segs, WithinBounds,
gimp_drawable_height (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask))); 0, 0,
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)));
segs = g_new (GdkSegment, *num_segs); segs = g_new (GdkSegment, *num_segs);

View File

@ -247,8 +247,8 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
if (coords->x >= off_x && if (coords->x >= off_x &&
coords->y >= off_y && coords->y >= off_y &&
coords->x < (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) && coords->x < (off_x + gimp_item_width (GIMP_ITEM (layer))) &&
coords->y < (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)))) coords->y < (off_y + gimp_item_height (GIMP_ITEM (layer))))
{ {
/* One more test--is there a selected region? /* One more test--is there a selected region?
* if so, is cursor inside? * if so, is cursor inside?

View File

@ -353,8 +353,8 @@ gimp_transform_tool_button_press (GimpTool *tool,
if (coords->x >= off_x && if (coords->x >= off_x &&
coords->y >= off_y && coords->y >= off_y &&
coords->x < (off_x + gimp_drawable_width (drawable)) && coords->x < (off_x + gimp_item_width (GIMP_ITEM (drawable))) &&
coords->y < (off_y + gimp_drawable_height (drawable)) && coords->y < (off_y + gimp_item_height (GIMP_ITEM (drawable))) &&
(gimp_image_mask_is_empty (gdisp->gimage) || (gimp_image_mask_is_empty (gdisp->gimage) ||
gimp_image_mask_value (gdisp->gimage, coords->x, coords->y))) gimp_image_mask_value (gdisp->gimage, coords->x, coords->y)))

View File

@ -352,16 +352,19 @@ gimp_selection_preview_button_press (GtkWidget *widget,
} }
else else
{ {
gint off_x, off_y; GimpItem *item;
gint off_x, off_y;
item = GIMP_ITEM (drawable);
gimp_drawable_offsets (drawable, &off_x, &off_y); gimp_drawable_offsets (drawable, &off_x, &off_y);
x -= off_x; x -= off_x;
y -= off_y; y -= off_y;
if (x < 0 || y < 0 || if (x < 0 || y < 0 ||
x >= gimp_drawable_width (drawable) || x >= gimp_item_width (item) ||
y >= gimp_drawable_height (drawable)) y >= gimp_item_height (item))
return TRUE; return TRUE;
col = gimp_drawable_get_color_at (drawable, x, y); col = gimp_drawable_get_color_at (drawable, x, y);

View File

@ -838,6 +838,7 @@ toolbox_drop_drawable (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
GimpItem *item;
GimpImage *gimage; GimpImage *gimage;
GimpImage *new_gimage; GimpImage *new_gimage;
GimpLayer *new_layer; GimpLayer *new_layer;
@ -847,10 +848,11 @@ toolbox_drop_drawable (GtkWidget *widget,
GimpImageBaseType type; GimpImageBaseType type;
drawable = GIMP_DRAWABLE (viewable); drawable = GIMP_DRAWABLE (viewable);
item = GIMP_ITEM (viewable);
gimage = gimp_item_get_image (item);
gimage = gimp_item_get_image (GIMP_ITEM (drawable)); width = gimp_item_width (item);
width = gimp_drawable_width (drawable); height = gimp_item_height (item);
height = gimp_drawable_height (drawable);
bytes = gimp_drawable_bytes (drawable); bytes = gimp_drawable_bytes (drawable);
type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)); type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));

View File

@ -42,7 +42,10 @@ sub pixel_arg () {{
}} }}
sub drawable_prop_proc { sub drawable_prop_proc {
my ($return, $name, $type, $func, $desc) = @_; my ($return, $name, $type, $func, $desc, $core_type, $core_var) = @_;
$core_type = 'drawable' unless $core_type;
$core_var = 'drawable' unless $core_var;
$blurb = "Returns $return."; $blurb = "Returns $return.";
@ -52,7 +55,7 @@ sub drawable_prop_proc {
@outargs = ( @outargs = (
{ name => $name, type => $type, desc => $desc, { name => $name, type => $type, desc => $desc,
alias => "gimp_drawable_$func (drawable)", no_declare => 1 } alias => "gimp_${core_type}_$func (${core_var})", no_declare => 1 }
); );
} }
@ -292,14 +295,16 @@ sub drawable_width {
$help = "This procedure returns the specified drawable's width in pixels."; $help = "This procedure returns the specified drawable's width in pixels.";
&drawable_prop_proc('the width of the drawable', 'width', 'int32', &drawable_prop_proc('the width of the drawable', 'width', 'int32',
'width', 'Width of drawable'); 'width', 'Width of drawable',
'item', 'GIMP_ITEM (drawable)');
} }
sub drawable_height { sub drawable_height {
$help = "This procedure returns the specified drawable's height in pixels."; $help = "This procedure returns the specified drawable's height in pixels.";
&drawable_prop_proc('the height of the drawable', 'height', 'int32', &drawable_prop_proc('the height of the drawable', 'height', 'int32',
'height', 'Height of drawable'); 'height', 'Height of drawable',
'item', 'GIMP_ITEM (drawable)');
} }
sub drawable_offsets { sub drawable_offsets {
@ -356,7 +361,8 @@ HELP
vars => [ 'guint8 *p', 'gint b', 'Tile *tile' ], vars => [ 'guint8 *p', 'gint b', 'Tile *tile' ],
code => <<'CODE' code => <<'CODE'
{ {
if (x < gimp_drawable_width (drawable) && y < gimp_drawable_height (drawable)) if (x < gimp_item_width (GIMP_ITEM (drawable)) &&
y < gimp_item_height (GIMP_ITEM (drawable)))
{ {
num_channels = gimp_drawable_bytes (drawable); num_channels = gimp_drawable_bytes (drawable);
pixel = g_new (guint8, num_channels); pixel = g_new (guint8, num_channels);
@ -399,8 +405,8 @@ HELP
vars => [ 'guint8 *p', 'gint b', 'Tile *tile' ], vars => [ 'guint8 *p', 'gint b', 'Tile *tile' ],
code => <<'CODE' code => <<'CODE'
{ {
if (x < gimp_drawable_width (drawable) && if (x < gimp_item_width (GIMP_ITEM (drawable)) &&
y < gimp_drawable_height (drawable) && y < gimp_item_height (GIMP_ITEM (drawable)) &&
num_channels == gimp_drawable_bytes (drawable)) num_channels == gimp_drawable_bytes (drawable))
{ {
tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y, tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y,
@ -492,8 +498,8 @@ HELP
if (req_width <= 128 && req_height <= 128) if (req_width <= 128 && req_height <= 128)
{ {
/* Adjust the width/height ratio */ /* Adjust the width/height ratio */
dwidth = gimp_drawable_width (GIMP_DRAWABLE (drawable)); dwidth = gimp_item_width (GIMP_ITEM (drawable));
dheight = gimp_drawable_height (GIMP_DRAWABLE (drawable)); dheight = gimp_item_height (GIMP_ITEM (drawable));
if (dwidth > dheight) if (dwidth > dheight)
req_height = MAX (1, (req_width * dheight) / dwidth); req_height = MAX (1, (req_width * dheight) / dwidth);

View File

@ -344,9 +344,9 @@ HELP
code => <<'CODE' code => <<'CODE'
{ {
gimage = gimp_item_get_image (GIMP_ITEM (channel)); gimage = gimp_item_get_image (GIMP_ITEM (channel));
if (gimp_drawable_width (GIMP_DRAWABLE (channel)) == gimage->width && if (gimp_item_width (GIMP_ITEM (channel)) == gimage->width &&
gimp_drawable_height (GIMP_DRAWABLE (channel)) == gimage->height) gimp_item_height (GIMP_ITEM (channel)) == gimage->height)
gimp_image_mask_load (gimage, channel); gimp_image_mask_load (gimage, channel);
else else
success = FALSE; success = FALSE;
@ -374,9 +374,9 @@ HELP
code => <<'CODE' code => <<'CODE'
{ {
gimage = gimp_item_get_image (GIMP_ITEM (channel)); gimage = gimp_item_get_image (GIMP_ITEM (channel));
if (gimp_drawable_width (GIMP_DRAWABLE (channel)) == gimage->width && if (gimp_item_width (GIMP_ITEM (channel)) == gimage->width &&
gimp_drawable_height (GIMP_DRAWABLE (channel)) == gimage->height) gimp_item_height (GIMP_ITEM (channel)) == gimage->height)
{ {
new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (gimp_image_get_mask (gimage)), new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (gimp_image_get_mask (gimage)),
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)), G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),