plug-ins/common/gauss_iir.c merged fix for bug #89825 from stable branch.

2002-08-04  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/gauss_iir.c
	* plug-ins/common/gauss_rle.c: merged fix for bug #89825 from
	stable branch.
This commit is contained in:
Sven Neumann 2002-08-04 15:27:05 +00:00 committed by Sven Neumann
parent 2c11b461f1
commit 24e35fde91
3 changed files with 66 additions and 41 deletions

View File

@ -1,7 +1,12 @@
2002-08-04 Sven Neumann <sven@gimp.org>
* plug-ins/common/gauss_iir.c
* plug-ins/common/gauss_rle.c: merged fix for bug #89825 from
stable branch.
2002-08-04 Dave Neary <bolsh@gimp.org>
* plug-ins/common/decompose.c: Add RGBA as a decompose
target.
* plug-ins/common/decompose.c: Add RGBA as a decompose target.
2002-08-03 Manish Singh <yosh@gimp.org>

View File

@ -576,20 +576,24 @@ gauss_iir (GimpDrawable *drawable,
gint i, j;
gint row, col, b;
gint terms;
gint progress, max_progress;
gdouble progress, max_progress;
gint initial_p[4];
gint initial_m[4];
guchar *guc_tmp1, *guc_tmp2;
gint *gi_tmp1, *gi_tmp2;
gdouble std_dev;
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
if (horz < 1.0 && vert < 1.0)
return;
width = (x2 - x1);
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
width = (x2 - x1);
height = (y2 - y1);
if (width < 1 || height < 1)
return;
bytes = drawable->bpp;
has_alpha = gimp_drawable_has_alpha(drawable->drawable_id);
@ -599,11 +603,15 @@ gauss_iir (GimpDrawable *drawable,
src = g_new (guchar, MAX (width, height) * bytes);
dest = g_new (guchar, MAX (width, height) * bytes);
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn, drawable, 0, 0, drawable->width, drawable->height, TRUE, TRUE);
gimp_pixel_rgn_init (&src_rgn,
drawable, 0, 0, drawable->width, drawable->height,
FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn,
drawable, 0, 0, drawable->width, drawable->height,
TRUE, TRUE);
progress = 0;
max_progress = (horz < 1.0 ) ? 0 : width * height * horz;
progress = 0.0;
max_progress = (horz < 1.0 ) ? 0 : width * height * horz;
max_progress += (vert < 1.0 ) ? 0 : width * height * vert;
if (has_alpha)
@ -611,7 +619,7 @@ gauss_iir (GimpDrawable *drawable,
/* First the vertical pass */
if (vert >= 1.0)
{
{
vert = fabs (vert) + 1.0;
std_dev = sqrt (-(vert * vert) / (2 * log (1.0 / 255.0)));
@ -681,15 +689,17 @@ gauss_iir (GimpDrawable *drawable,
progress += height * vert;
if ((col % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
gimp_progress_update (progress / max_progress);
}
/* prepare for the horizontal pass */
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, TRUE);
gimp_pixel_rgn_init (&src_rgn,
drawable, 0, 0, drawable->width, drawable->height,
FALSE, TRUE);
}
/* Now the horizontal pass */
if (horz >= 1.0)
if (horz >= 1.0)
{
horz = fabs (horz) + 1.0;
@ -764,7 +774,7 @@ gauss_iir (GimpDrawable *drawable,
progress += width * horz;
if ((row % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
gimp_progress_update (progress / max_progress);
}
}

View File

@ -557,32 +557,36 @@ gauss_rle (GimpDrawable *drawable,
gdouble vert)
{
GimpPixelRgn src_rgn, dest_rgn;
gint width, height;
gint bytes;
gint has_alpha;
guchar *dest, *dp;
guchar *src, *sp;
gint *buf, *bb;
gint pixels;
gint total = 1;
gint x1, y1, x2, y2;
gint i, row, col, b;
gint start, end;
gint progress, max_progress;
gint *curve;
gint *sum = NULL;
gint val;
gint length;
gint initial_p, initial_m;
gdouble std_dev;
gint width, height;
gint bytes;
gint has_alpha;
guchar *dest, *dp;
guchar *src, *sp;
gint *buf, *bb;
gint pixels;
gint total = 1;
gint x1, y1, x2, y2;
gint i, row, col, b;
gint start, end;
gdouble progress, max_progress;
gint *curve;
gint *sum = NULL;
gint val;
gint length;
gint initial_p, initial_m;
gdouble std_dev;
if (horz < 1.0 && vert < 1.0)
return;
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
width = (x2 - x1);
width = (x2 - x1);
height = (y2 - y1);
if (width < 1 || height < 1)
return;
bytes = drawable->bpp;
has_alpha = gimp_drawable_has_alpha(drawable->drawable_id);
@ -592,11 +596,15 @@ gauss_rle (GimpDrawable *drawable,
src = g_new (guchar, MAX (width, height) * bytes);
dest = g_new (guchar, MAX (width, height) * bytes);
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn, drawable, 0, 0, drawable->width, drawable->height, TRUE, TRUE);
gimp_pixel_rgn_init (&src_rgn,
drawable, 0, 0, drawable->width, drawable->height,
FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn,
drawable, 0, 0, drawable->width, drawable->height,
TRUE, TRUE);
progress = 0;
max_progress = (horz < 1.0 ) ? 0 : width * height * horz;
progress = 0.0;
max_progress = (horz < 1.0 ) ? 0 : width * height * horz;
max_progress += (vert < 1.0 ) ? 0 : width * height * vert;
if (has_alpha)
@ -667,11 +675,13 @@ gauss_rle (GimpDrawable *drawable,
gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1));
progress += height * vert;
if ((col % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
gimp_progress_update (progress / max_progress);
}
/* prepare for the horizontal pass */
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, TRUE);
gimp_pixel_rgn_init (&src_rgn,
drawable, 0, 0, drawable->width, drawable->height,
FALSE, TRUE);
}
/* Now the horizontal pass */
@ -743,7 +753,7 @@ gauss_rle (GimpDrawable *drawable,
gimp_pixel_rgn_set_row (&dest_rgn, dest, x1, row + y1, (x2 - x1));
progress += width * horz;
if ((row % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
gimp_progress_update (progress / max_progress);
}
}