Commit 49230471 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

removed BOUNDS, MINIMUM and MAXIMUM. No need to include both <glib.h> and

2000-01-25  Michael Natterer  <mitch@gimp.org>

	* app/appenv.h: removed BOUNDS, MINIMUM and MAXIMUM. No need to
	include both <glib.h> and <gtk/gtk.h>.

	* app/*
	* tools/pdbgen/pdb/text_tool.pdb: s/BOUNDS/CLAMP/,
	same for MIN and MAX.

	* app/preferences_dialog.c: the "Check Size" widget was connected
	to the transparency_type variable.

	* plug-ins/common/sobel.c: removed definitions of MIN and ROUND.

	* libgimp/gimp.h: #include "gimplimits.h" and "gimpcolorspace.h".

	* plug-ins/*: don't include the two files.
parent 7812dcc2
2000-01-25 Michael Natterer <mitch@gimp.org>
* app/appenv.h: removed BOUNDS, MINIMUM and MAXIMUM. No need to
include both <glib.h> and <gtk/gtk.h>.
* app/*
* tools/pdbgen/pdb/text_tool.pdb: s/BOUNDS/CLAMP/,
same for MIN and MAX.
* app/preferences_dialog.c: the "Check Size" widget was connected
to the transparency_type variable.
* plug-ins/common/sobel.c: removed definitions of MIN and ROUND.
* libgimp/gimp.h: #include "gimplimits.h" and "gimpcolorspace.h".
* plug-ins/*: don't include the two files.
Tue Jan 25 21:58:49 CET 2000 Sven Neumann <sven@gimp.org>
 
* app/layer.c: applied a change suggested by Steinar H. Gunderson.
......
......@@ -136,7 +136,7 @@ find_empty_segs (PixelRegion *maskPR,
dstep = tile_bpp(tile);
}
endx = x + (TILE_WIDTH - (x%TILE_WIDTH));
endx = MINIMUM(end, endx);
endx = MIN (end, endx);
if (type == IgnoreBounds && (endx > x1 || x < x2))
for (; x < endx; x++)
{
......@@ -295,8 +295,8 @@ make_horiz_segs (int start,
process_horiz_seg (start, scanline, end, scanline, top);
else if ((e_s > start && e_s < end) ||
(e_e < end && e_e > start))
process_horiz_seg (MAXIMUM (e_s, start), scanline,
MINIMUM (e_e, end), scanline, top);
process_horiz_seg (MAX (e_s, start), scanline,
MIN (e_e, end), scanline, top);
}
}
......
......@@ -216,8 +216,8 @@ curves_colour_update (Tool *tool,
if (is_indexed)
curves_dialog->col_value [HISTOGRAM_ALPHA] = color[4];
maxval = MAXIMUM(color[RED_PIX],color[GREEN_PIX]);
curves_dialog->col_value[HISTOGRAM_VALUE] = MAXIMUM(maxval,color[BLUE_PIX]);
maxval = MAX (color[RED_PIX], color[GREEN_PIX]);
curves_dialog->col_value[HISTOGRAM_VALUE] = MAX (maxval, color[BLUE_PIX]);
g_free (color);
}
......@@ -1037,8 +1037,8 @@ curves_plot_curve (CurvesDialog *cd,
dy2 = deltas[2][1];
dy3 = deltas[3][1];
lastx = BOUNDS (x, 0, 255);
lasty = BOUNDS (y, 0, 255);
lastx = CLAMP (x, 0, 255);
lasty = CLAMP (y, 0, 255);
cd->curve[cd->channel][lastx] = lasty;
......@@ -1412,8 +1412,8 @@ curves_graph_events (GtkWidget *widget,
/* get the pointer position */
gdk_window_get_pointer (cd->graph->window, &tx, &ty, NULL);
x = BOUNDS ((tx - RADIUS), 0, 255);
y = BOUNDS ((ty - RADIUS), 0, 255);
x = CLAMP ((tx - RADIUS), 0, 255);
y = CLAMP ((ty - RADIUS), 0, 255);
distance = G_MAXINT;
for (i = 0; i < 17; i++)
......
......@@ -119,7 +119,7 @@ hue_saturation_calculate_transfers (HueSaturationDialog *hsd)
/* Lightness */
value = (hsd->lightness[0] + hsd->lightness[hue + 1]) * 127.0 / 100.0;
value = BOUNDS (value, -255, 255);
value = CLAMP (value, -255, 255);
if (value < 0)
lightness_transfer[hue][i] = (unsigned char) ((i * (255 + value)) / 255);
else
......@@ -127,7 +127,7 @@ hue_saturation_calculate_transfers (HueSaturationDialog *hsd)
/* Saturation */
value = (hsd->saturation[0] + hsd->saturation[hue + 1]) * 255.0 / 100.0;
value = BOUNDS (value, -255, 255);
value = CLAMP (value, -255, 255);
/* This change affects the way saturation is computed. With the
old code (different code for value < 0), increasing the
......@@ -137,7 +137,7 @@ hue_saturation_calculate_transfers (HueSaturationDialog *hsd)
the new behavior is exactly what you want. It's hard for me
to imagine a case in which the old behavior is better.
*/
saturation_transfer[hue][i] = BOUNDS((i * (255 + value)) / 255, 0, 255);
saturation_transfer[hue][i] = CLAMP ((i * (255 + value)) / 255, 0, 255);
}
}
......
......@@ -164,7 +164,7 @@ add_lut_new(double ammount, int nchannels)
return lut;
}
/* ---------------- intersect (MINIMUM(pixel, value)) ------------------ */
/* ---------------- intersect (MIN (pixel, value)) ------------------ */
static float
intersect_lut_func(double *min,
......@@ -174,7 +174,7 @@ intersect_lut_func(double *min,
if ((nchannels == 2 || nchannels == 4) && channel == nchannels -1)
return value;
return MIN(value, *min);
return MIN (value, *min);
}
void
......
......@@ -47,7 +47,7 @@ GimpLut *invert_lut_new (int nchannels);
void add_lut_setup (GimpLut *lut, double ammount, int nchannels);
GimpLut *add_lut_new (double ammount, int nchannels);
/* intersect (MINIMUM(pixel, value)) */
/* intersect (MIN (pixel, value)) */
void intersect_lut_setup (GimpLut *lut, double value, int nchannels);
GimpLut *intersect_lut_new (double value, int nchannels);
......
......@@ -460,7 +460,7 @@ get_portion_height (PixelRegionIterator *PRI)
if (PRH->PR->tiles)
{
height = TILE_HEIGHT - (PRH->PR->y % TILE_HEIGHT);
height = BOUNDS (height, 0, (PRI->region_height - (PRH->PR->y - PRH->starty)));
height = CLAMP (height, 0, (PRI->region_height - (PRH->PR->y - PRH->starty)));
}
else
height = (PRI->region_height - (PRH->PR->y - PRH->starty));
......@@ -502,7 +502,7 @@ get_portion_width (PixelRegionIterator *PRI)
if (PRH->PR->tiles)
{
width = TILE_WIDTH - (PRH->PR->x % TILE_WIDTH);
width = BOUNDS (width, 0, (PRI->region_width - (PRH->PR->x - PRH->startx)));
width = CLAMP (width, 0, (PRI->region_width - (PRH->PR->x - PRH->startx)));
}
else
width = (PRI->region_width - (PRH->PR->x - PRH->startx));
......
......@@ -36,7 +36,6 @@
#include "appenv.h"
#include "drawable.h"
#include "errors.h"
#include "gdisplay.h"
#include "general.h"
#include "gimprc.h"
......@@ -288,10 +287,10 @@ temp_buf_copy_area (TempBuf *src,
}
/* some bounds checking */
x1 = BOUNDS (x, 0, src->width);
y1 = BOUNDS (y, 0, src->height);
x2 = BOUNDS (x + w, 0, src->width);
y2 = BOUNDS (y + h, 0, src->height);
x1 = CLAMP (x, 0, src->width);
y1 = CLAMP (y, 0, src->height);
x2 = CLAMP (x + w, 0, src->width);
y2 = CLAMP (y + h, 0, src->height);
if (!(x2 - x1) || !(y2 - y1))
return dest;
......
......@@ -2230,8 +2230,8 @@ bezier_convert (BezierSelect *bezier_sel,
*/
{
/* bounds checking */
x = BOUNDS (x, 0, width);
x2 = BOUNDS ((long) list->data, 0, width);
x = CLAMP (x, 0, width);
x2 = CLAMP ((long) list->data, 0, width);
w = x2 - x;
......
......@@ -830,7 +830,7 @@ gradient_calc_conical_sym_factor (double dist,
rat = acos(rat) / G_PI;
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
rat = CLAMP(rat, 0.0, 1.0);
}
else
rat = 0.5;
......@@ -869,7 +869,7 @@ gradient_calc_conical_asym_factor (double dist,
rat = ang / (2.0 * G_PI);
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
rat = CLAMP(rat, 0.0, 1.0);
}
else
rat = 0.5; /* We are on middle point */
......@@ -898,7 +898,7 @@ gradient_calc_square_factor (double dist,
offset = offset / 100.0;
r = MAXIMUM(abs(x), abs(y));
r = MAX (abs (x), abs (y));
rat = r / dist;
if (rat < offset)
......@@ -1061,8 +1061,8 @@ gradient_calc_shapeburst_angular_factor (double x,
Tile *tile;
float value;
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
ix = (int) CLAMP (x, 0, distR.w);
iy = (int) CLAMP (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
tile_release (tile, FALSE);
......@@ -1079,8 +1079,8 @@ gradient_calc_shapeburst_spherical_factor (double x,
Tile *tile;
float value;
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
ix = (int) CLAMP (x, 0, distR.w);
iy = (int) CLAMP (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * G_PI * value);
......@@ -1098,8 +1098,8 @@ gradient_calc_shapeburst_dimpled_factor (double x,
Tile *tile;
float value;
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
ix = (int) CLAMP (x, 0, distR.w);
iy = (int) CLAMP (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * G_PI * value);
......@@ -1111,7 +1111,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
static double
gradient_repeat_none (double val)
{
return BOUNDS(val, 0.0, 1.0);
return CLAMP(val, 0.0, 1.0);
}
static double
......@@ -1441,7 +1441,7 @@ gradient_fill_region (GImage *gimage,
break;
case SQUARE:
rbd.dist = MAXIMUM(fabs(ex - sx), fabs(ey - sy));
rbd.dist = MAX (fabs (ex - sx), fabs (ey - sy));
break;
case CONICAL_SYMMETRIC:
......
......@@ -136,7 +136,7 @@ find_empty_segs (PixelRegion *maskPR,
dstep = tile_bpp(tile);
}
endx = x + (TILE_WIDTH - (x%TILE_WIDTH));
endx = MINIMUM(end, endx);
endx = MIN (end, endx);
if (type == IgnoreBounds && (endx > x1 || x < x2))
for (; x < endx; x++)
{
......@@ -295,8 +295,8 @@ make_horiz_segs (int start,
process_horiz_seg (start, scanline, end, scanline, top);
else if ((e_s > start && e_s < end) ||
(e_e < end && e_e > start))
process_horiz_seg (MAXIMUM (e_s, start), scanline,
MINIMUM (e_e, end), scanline, top);
process_horiz_seg (MAX (e_s, start), scanline,
MIN (e_e, end), scanline, top);
}
}
......
......@@ -97,7 +97,7 @@ brush_edit_brush_dirty_callback (GimpBrush *brush,
xo = begw->preview->requisition.width/2 - brush->mask->width/(2*scale);
ystart = begw->preview->requisition.height/2 - brush->mask->height/(2*scale);
yend = ystart + brush->mask->height/(scale);
width = BOUNDS (brush->mask->width/scale, 0, begw->preview->requisition.width);
width = CLAMP (brush->mask->width/scale, 0, begw->preview->requisition.width);
buf = g_new (gchar, width);
src = (gchar *) temp_buf_data (brush->mask);
......
......@@ -1207,8 +1207,8 @@ display_brush (BrushSelect *bsp,
offset_x = col * bsp->cell_width + ((cell_width - width) >> 1) + MARGIN_WIDTH;
offset_y = row * bsp->cell_height + ((cell_height - height) >> 1) - bsp->scroll_offset + MARGIN_HEIGHT;
ystart = BOUNDS (offset_y, 0, bsp->preview->allocation.height);
yend = BOUNDS (offset_y + height, 0, bsp->preview->allocation.height);
ystart = CLAMP (offset_y, 0, bsp->preview->allocation.height);
yend = CLAMP (offset_y + height, 0, bsp->preview->allocation.height);
mask = temp_buf_data (mask_buf) + (ystart - offset_y) * mask_buf->width;
buf = g_new (guchar, 3 * cell_width);
......@@ -1336,8 +1336,8 @@ brush_select_show_selected (BrushSelect *bsp,
offset_x = bsp->old_col * bsp->cell_width;
offset_y = bsp->old_row * bsp->cell_height - bsp->scroll_offset;
ystart = BOUNDS (offset_y , 0, bsp->preview->allocation.height);
yend = BOUNDS (offset_y + bsp->cell_height, 0, bsp->preview->allocation.height);
ystart = CLAMP (offset_y , 0, bsp->preview->allocation.height);
yend = CLAMP (offset_y + bsp->cell_height, 0, bsp->preview->allocation.height);
/* set the buf to white */
memset (buf, 255, 3 * bsp->cell_width);
......@@ -1370,8 +1370,8 @@ brush_select_show_selected (BrushSelect *bsp,
offset_x = col * bsp->cell_width;
offset_y = row * bsp->cell_height - bsp->scroll_offset;
ystart = BOUNDS (offset_y , 0, bsp->preview->allocation.height);
yend = BOUNDS (offset_y + bsp->cell_height, 0, bsp->preview->allocation.height);
ystart = CLAMP (offset_y , 0, bsp->preview->allocation.height);
yend = CLAMP (offset_y + bsp->cell_height, 0, bsp->preview->allocation.height);
/* set the buf to black */
memset (buf, 0, bsp->cell_width * 3);
......
......@@ -401,10 +401,10 @@ bucket_fill (GimpImage *gimage,
/* Limit the channel bounds to the drawable's extents */
drawable_offsets (drawable, &off_x, &off_y);
x1 = BOUNDS (x1, off_x, (off_x + drawable_width (drawable)));
y1 = BOUNDS (y1, off_y, (off_y + drawable_height (drawable)));
x2 = BOUNDS (x2, off_x, (off_x + drawable_width (drawable)));
y2 = BOUNDS (y2, off_y, (off_y + drawable_height (drawable)));
x1 = CLAMP (x1, off_x, (off_x + drawable_width (drawable)));
y1 = CLAMP (y1, off_y, (off_y + drawable_height (drawable)));
x2 = CLAMP (x2, off_x, (off_x + drawable_width (drawable)));
y2 = CLAMP (y2, off_y, (off_y + drawable_height (drawable)));
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE (mask)),
x1, y1, (x2 - x1), (y2 - y1), TRUE);
......
......@@ -388,10 +388,10 @@ channel_resize (Channel *channel,
if (!new_width || !new_height)
return;
x1 = BOUNDS (offx, 0, new_width);
y1 = BOUNDS (offy, 0, new_height);
x2 = BOUNDS ((offx + GIMP_DRAWABLE (channel)->width), 0, new_width);
y2 = BOUNDS ((offy + GIMP_DRAWABLE (channel)->height), 0, new_height);
x1 = CLAMP (offx, 0, new_width);
y1 = CLAMP (offy, 0, new_height);
x2 = CLAMP ((offx + GIMP_DRAWABLE (channel)->width), 0, new_width);
y2 = CLAMP ((offy + GIMP_DRAWABLE (channel)->height), 0, new_height);
w = x2 - x1;
h = y2 - y1;
......@@ -643,10 +643,10 @@ channel_boundary (Channel *mask,
IgnoreBounds,
x1, y1,
x2, y2);
x1 = MAXIMUM (x1, x3);
y1 = MAXIMUM (y1, y3);
x2 = MINIMUM (x2, x4);
y2 = MINIMUM (y2, y4);
x1 = MAX (x1, x3);
y1 = MAX (y1, y3);
x2 = MIN (x2, x4);
y2 = MIN (y2, y4);
if (x2 > x1 && y2 > y1)
{
......@@ -798,8 +798,8 @@ channel_bounds (Channel *mask,
}
}
tx2 = BOUNDS (tx2 + 1, 0, GIMP_DRAWABLE (mask)->width);
ty2 = BOUNDS (ty2 + 1, 0, GIMP_DRAWABLE (mask)->height);
tx2 = CLAMP (tx2 + 1, 0, GIMP_DRAWABLE (mask)->width);
ty2 = CLAMP (ty2 + 1, 0, GIMP_DRAWABLE (mask)->height);
if (tx1 == GIMP_DRAWABLE (mask)->width && ty1 == GIMP_DRAWABLE (mask)->height)
{
......@@ -978,10 +978,10 @@ channel_combine_rect (Channel *mask,
y2 = y + h;
x2 = x + w;
x = BOUNDS (x, 0, GIMP_DRAWABLE (mask)->width);
y = BOUNDS (y, 0, GIMP_DRAWABLE (mask)->height);
x2 = BOUNDS (x2, 0, GIMP_DRAWABLE (mask)->width);
y2 = BOUNDS (y2, 0, GIMP_DRAWABLE (mask)->height);
x = CLAMP (x, 0, GIMP_DRAWABLE (mask)->width);
y = CLAMP (y, 0, GIMP_DRAWABLE (mask)->height);
x2 = CLAMP (x2, 0, GIMP_DRAWABLE (mask)->width);
y2 = CLAMP (y2, 0, GIMP_DRAWABLE (mask)->height);
if (x2 - x <= 0 || y2 - y <= 0)
return;
......@@ -1017,10 +1017,10 @@ channel_combine_rect (Channel *mask,
else
mask->bounds_known = FALSE;
mask->x1 = BOUNDS (mask->x1, 0, GIMP_DRAWABLE (mask)->width);
mask->y1 = BOUNDS (mask->y1, 0, GIMP_DRAWABLE (mask)->height);
mask->x2 = BOUNDS (mask->x2, 0, GIMP_DRAWABLE (mask)->width);
mask->y2 = BOUNDS (mask->y2, 0, GIMP_DRAWABLE (mask)->height);
mask->x1 = CLAMP (mask->x1, 0, GIMP_DRAWABLE (mask)->width);
mask->y1 = CLAMP (mask->y1, 0, GIMP_DRAWABLE (mask)->height);
mask->x2 = CLAMP (mask->x2, 0, GIMP_DRAWABLE (mask)->width);
mask->y2 = CLAMP (mask->y2, 0, GIMP_DRAWABLE (mask)->height);
}
void
......@@ -1171,10 +1171,10 @@ channel_combine_ellipse (Channel *mask,
else
mask->bounds_known = FALSE;
mask->x1 = BOUNDS (mask->x1, 0, GIMP_DRAWABLE (mask)->width);
mask->y1 = BOUNDS (mask->y1, 0, GIMP_DRAWABLE (mask)->height);
mask->x2 = BOUNDS (mask->x2, 0, GIMP_DRAWABLE (mask)->width);
mask->y2 = BOUNDS (mask->y2, 0, GIMP_DRAWABLE (mask)->height);
mask->x1 = CLAMP (mask->x1, 0, GIMP_DRAWABLE (mask)->width);
mask->y1 = CLAMP (mask->y1, 0, GIMP_DRAWABLE (mask)->height);
mask->x2 = CLAMP (mask->x2, 0, GIMP_DRAWABLE (mask)->width);
mask->y2 = CLAMP (mask->y2, 0, GIMP_DRAWABLE (mask)->height);
}
static void
......@@ -1243,7 +1243,7 @@ channel_combine_sub_region_intersect (void *unused,
{
for (x = 0; x < srcPR->w; x++)
{
dest[x] = MINIMUM (dest[x], src[x]);
dest[x] = MIN (dest[x], src[x]);
}
src += srcPR->rowstride;
dest += destPR->rowstride;
......@@ -1261,12 +1261,12 @@ channel_combine_mask (Channel *mask,
gint x1, y1, x2, y2;
gint w, h;
x1 = BOUNDS (off_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = BOUNDS (off_y, 0, GIMP_DRAWABLE (mask)->height);
x2 = BOUNDS (off_x + GIMP_DRAWABLE (add_on)->width, 0,
GIMP_DRAWABLE (mask)->width);
y2 = BOUNDS (off_y + GIMP_DRAWABLE (add_on)->height, 0,
GIMP_DRAWABLE (mask)->height);
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (mask)->height);
x2 = CLAMP (off_x + GIMP_DRAWABLE (add_on)->width, 0,
GIMP_DRAWABLE (mask)->width);
y2 = CLAMP (off_y + GIMP_DRAWABLE (add_on)->height, 0,
GIMP_DRAWABLE (mask)->height);
w = (x2 - x1);
h = (y2 - y1);
......@@ -1309,12 +1309,12 @@ channel_feather (Channel *input,
gint x1, y1, x2, y2;
PixelRegion srcPR;
x1 = BOUNDS (off_x, 0, GIMP_DRAWABLE (output)->width);
y1 = BOUNDS (off_y, 0, GIMP_DRAWABLE (output)->height);
x2 = BOUNDS (off_x + GIMP_DRAWABLE (input)->width, 0,
GIMP_DRAWABLE (output)->width);
y2 = BOUNDS (off_y + GIMP_DRAWABLE (input)->height, 0,
GIMP_DRAWABLE (output)->height);
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (output)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (output)->height);
x2 = CLAMP (off_x + GIMP_DRAWABLE (input)->width, 0,
GIMP_DRAWABLE (output)->width);
y2 = CLAMP (off_y + GIMP_DRAWABLE (input)->height, 0,
GIMP_DRAWABLE (output)->height);
pixel_region_init (&srcPR, GIMP_DRAWABLE (input)->tiles,
(x1 - off_x), (y1 - off_y), (x2 - x1), (y2 - y1), FALSE);
......@@ -1623,10 +1623,10 @@ channel_translate (Channel *mask,
channel_push_undo (mask);
channel_bounds (mask, &x1, &y1, &x2, &y2);
x1 = BOUNDS ((x1 + off_x), 0, GIMP_DRAWABLE (mask)->width);
y1 = BOUNDS ((y1 + off_y), 0, GIMP_DRAWABLE (mask)->height);
x2 = BOUNDS ((x2 + off_x), 0, GIMP_DRAWABLE (mask)->width);
y2 = BOUNDS ((y2 + off_y), 0, GIMP_DRAWABLE (mask)->height);
x1 = CLAMP ((x1 + off_x), 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP ((y1 + off_y), 0, GIMP_DRAWABLE (mask)->height);
x2 = CLAMP ((x2 + off_x), 0, GIMP_DRAWABLE (mask)->width);
y2 = CLAMP ((y2 + off_y), 0, GIMP_DRAWABLE (mask)->height);
width = x2 - x1;
height = y2 - y1;
......@@ -1701,12 +1701,12 @@ channel_layer_alpha (Channel *mask,
GIMP_DRAWABLE (mask)->height, TRUE);
color_region (&destPR, &empty);
x1 = BOUNDS (GIMP_DRAWABLE (layer)->offset_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = BOUNDS (GIMP_DRAWABLE (layer)->offset_y, 0, GIMP_DRAWABLE (mask)->height);
x2 = BOUNDS (GIMP_DRAWABLE (layer)->offset_x + GIMP_DRAWABLE (layer)->width,
0, GIMP_DRAWABLE (mask)->width);
y2 = BOUNDS (GIMP_DRAWABLE( layer)->offset_y + GIMP_DRAWABLE (layer)->height,
0, GIMP_DRAWABLE (mask)->height);
x1 = CLAMP (GIMP_DRAWABLE (layer)->offset_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP (GIMP_DRAWABLE (layer)->offset_y, 0, GIMP_DRAWABLE (mask)->height);
x2 = CLAMP (GIMP_DRAWABLE (layer)->offset_x + GIMP_DRAWABLE (layer)->width,
0, GIMP_DRAWABLE (mask)->width);
y2 = CLAMP (GIMP_DRAWABLE( layer)->offset_y + GIMP_DRAWABLE (layer)->height,
0, GIMP_DRAWABLE (mask)->height);
pixel_region_init (&srcPR, GIMP_DRAWABLE (layer)->tiles,
(x1 - GIMP_DRAWABLE (layer)->offset_x),
......
......@@ -230,8 +230,8 @@ offset (GimpImage *gimage,
}
else
{
offset_x = BOUNDS (offset_x, -width, width);
offset_y = BOUNDS (offset_y, -height, height);
offset_x = CLAMP (offset_x, -width, width);
offset_y = CLAMP (offset_y, -height, height);
}
if (offset_x == 0 && offset_y == 0)
......@@ -242,26 +242,26 @@ offset (GimpImage *gimage,
{
src_x = 0;
dest_x = offset_x;
width = BOUNDS ((width - offset_x), 0, width);
width = CLAMP ((width - offset_x), 0, width);
}
else
{
src_x = -offset_x;
dest_x = 0;
width = BOUNDS ((width + offset_x), 0, width);
width = CLAMP ((width + offset_x), 0, width);
}
if (offset_y >= 0)
{
src_y = 0;
dest_y = offset_y;
height = BOUNDS ((height - offset_y), 0, height);
height = CLAMP ((height - offset_y), 0, height);
}
else
{
src_y = -offset_y;
dest_y = 0;
height = BOUNDS ((height + offset_y), 0, height);
height = CLAMP ((height + offset_y), 0, height);
}
/* Copy the center region */
......
......@@ -470,12 +470,12 @@ clone_motion (PaintCore *paint_core,
*/
if (src_drawable != drawable)
{
x1 = BOUNDS (area->x + offset_x, 0, drawable_width (src_drawable));
y1 = BOUNDS (area->y + offset_y, 0, drawable_height (src_drawable));
x2 = BOUNDS (area->x + offset_x + area->width,
0, drawable_width (src_drawable));
y2 = BOUNDS (area->y + offset_y + area->height,
0, drawable_height (src_drawable));
x1 = CLAMP (area->x + offset_x, 0, drawable_width (src_drawable));
y1 = CLAMP (area->y + offset_y, 0, drawable_height (src_drawable));
x2 = CLAMP (area->x + offset_x + area->width,
0, drawable_width (src_drawable));
y2 = CLAMP (area->y + offset_y + area->height,
0, drawable_height (src_drawable));
if (!(x2 - x1) || !(y2 - y1))
return;
......@@ -484,12 +484,12 @@ clone_motion (PaintCore *paint_core,
}
else
{
x1 = BOUNDS (area->x + offset_x, 0, drawable_width (drawable));
y1 = BOUNDS (area->y + offset_y, 0, drawable_height (drawable));
x2 = BOUNDS (area->x + offset_x + area->width,
0, drawable_width (drawable));
y2 = BOUNDS (area->y + offset_y + area->height,
0, drawable_height (drawable));
x1 = CLAMP (area->x + offset_x, 0, drawable_width (drawable));
y1 = CLAMP (area->y + offset_y, 0, drawable_height (drawable));
x2 = CLAMP (area->x + offset_x + area->width,
0, drawable_width (drawable));
y2 = CLAMP (area->y + offset_y + area->height,
0, drawable_height (drawable));
if (!(x2 - x1) || !(y2 - y1))
return;
......
......@@ -126,8 +126,8 @@ crop_buffer (TileManager *tiles,
}
}
x2 = BOUNDS (x2 + 1, 0, tiles->width);
y2 = BOUNDS (y2 + 1, 0, tiles->height);
x2 = CLAMP (x2 + 1, 0, tiles->width);