Bug 155733 - need to check return values of gimp_drawable_mask_bounds()

Remove gimp_drawable_mask_bounds() from border-average.c
This commit is contained in:
Andrew Worsley 2015-08-30 11:22:27 +10:00 committed by Michael Natterer
parent 494398e3b8
commit a3f2b1ab68
1 changed files with 6 additions and 16 deletions

View File

@ -208,7 +208,6 @@ borderaverage (GeglBuffer *buffer,
gint32 drawable_id,
GimpRGB *result)
{
gint x1, x2, y1, y2;
gint x, y, width, height;
gint max;
guchar r, g, b;
@ -217,6 +216,12 @@ borderaverage (GeglBuffer *buffer,
gint i, j, k;
GeglRectangle border[4];
if (! gimp_drawable_mask_intersect (drawable_id, &x, &y, &width, &height))
{
gimp_rgba_set_uchar (result, 0, 0, 0, 255);
return;
}
/* allocate and clear the cube before */
bucket_expo = borderaverage_bucket_exponent;
bucket_rexpo = 8 - bucket_expo;
@ -234,14 +239,6 @@ borderaverage (GeglBuffer *buffer,
}
}
gimp_drawable_mask_bounds (drawable_id, &x1, &y1, &x2, &y2);
x = x1;
y = y1;
width = x2 - x1;
height = y2 - y1;
/* Top */
border[0].x = x;
border[0].y = y;
@ -408,13 +405,6 @@ borderaverage_dialog (gint32 image_ID,
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_entry), GIMP_UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_entry), 0, xres, TRUE);
{
gint x1, x2, y1, y2;
gimp_drawable_mask_bounds (drawable_id, &x1, &y1, &x2, &y2);
width = x2 - x1;
height = y2 - y1;
}
/* set the size (in pixels) that will be treated as 0% and 100% */
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_entry), 0, 0.0,
MIN (width, height));