Bug 639920: Gaussian blur can't work on specified selection

In presence of a selection extend the area processed
This commit is contained in:
Massimo Valentini 2013-01-27 17:04:04 +01:00
parent 79be7de82e
commit 94a404ed24
2 changed files with 23 additions and 3 deletions

View File

@ -736,7 +736,7 @@ sel_gauss (GimpDrawable *drawable,
gboolean has_alpha;
guchar *dest;
guchar *src;
gint x, y;
gint x, y, x2, y2;
gint width, height;
gdouble *mat;
gint numrad;
@ -752,6 +752,14 @@ sel_gauss (GimpDrawable *drawable,
mat = g_new (gdouble, numrad);
init_matrix (radius, mat, numrad);
x2 = MIN (x + width - 1 + numrad, drawable->width);
y2 = MIN (y + height - 1 + numrad, drawable->height);
x = MAX (x - numrad + 1, 0);
y = MAX (y - numrad + 1, 0);
width = x2 - x;
height = y2 - y;
/* allocate with extra padding because MMX instructions may read
more than strictly necessary */
src = g_new (guchar, width * height * bytes + 16);

View File

@ -1442,8 +1442,20 @@ gauss (GimpDrawable *drawable,
preview_buffer = g_new (guchar, width * height * drawable->bpp);
}
else if (! gimp_drawable_mask_intersect (drawable->drawable_id,
else if (gimp_drawable_mask_intersect (drawable->drawable_id,
&x, &y, &width, &height))
{ /* With a selection, extend the input area of the amount required */
gint hor_extra = method == BLUR_IIR ? 4 : 1 + ceil (horz);
gint ver_extra = method == BLUR_IIR ? 4 : 1 + ceil (vert);
gint x2 = x + width;
gint y2 = y + height;
x = MAX (x - hor_extra, 0);
y = MAX (y - ver_extra, 0);
width = MIN (x2 + hor_extra, drawable->width) - x;
height = MIN (y2 + ver_extra, drawable->height) - y;
}
else
{
return;
}