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> 2002-08-04 Dave Neary <bolsh@gimp.org>
* plug-ins/common/decompose.c: Add RGBA as a decompose * plug-ins/common/decompose.c: Add RGBA as a decompose target.
target.
2002-08-03 Manish Singh <yosh@gimp.org> 2002-08-03 Manish Singh <yosh@gimp.org>

View File

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

View File

@ -568,7 +568,7 @@ gauss_rle (GimpDrawable *drawable,
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
gint i, row, col, b; gint i, row, col, b;
gint start, end; gint start, end;
gint progress, max_progress; gdouble progress, max_progress;
gint *curve; gint *curve;
gint *sum = NULL; gint *sum = NULL;
gint val; gint val;
@ -583,6 +583,10 @@ gauss_rle (GimpDrawable *drawable,
width = (x2 - x1); width = (x2 - x1);
height = (y2 - y1); height = (y2 - y1);
if (width < 1 || height < 1)
return;
bytes = drawable->bpp; bytes = drawable->bpp;
has_alpha = gimp_drawable_has_alpha(drawable->drawable_id); has_alpha = gimp_drawable_has_alpha(drawable->drawable_id);
@ -592,10 +596,14 @@ gauss_rle (GimpDrawable *drawable,
src = g_new (guchar, MAX (width, height) * bytes); src = g_new (guchar, MAX (width, height) * bytes);
dest = 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 (&src_rgn,
gimp_pixel_rgn_init (&dest_rgn, drawable, 0, 0, drawable->width, drawable->height, TRUE, TRUE); 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; progress = 0.0;
max_progress = (horz < 1.0 ) ? 0 : width * height * horz; max_progress = (horz < 1.0 ) ? 0 : width * height * horz;
max_progress += (vert < 1.0 ) ? 0 : width * height * vert; max_progress += (vert < 1.0 ) ? 0 : width * height * vert;
@ -667,11 +675,13 @@ gauss_rle (GimpDrawable *drawable,
gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1)); gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1));
progress += height * vert; progress += height * vert;
if ((col % 5) == 0) if ((col % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress); gimp_progress_update (progress / max_progress);
} }
/* prepare for the horizontal pass */ /* 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 */ /* 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)); gimp_pixel_rgn_set_row (&dest_rgn, dest, x1, row + y1, (x2 - x1));
progress += width * horz; progress += width * horz;
if ((row % 5) == 0) if ((row % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress); gimp_progress_update (progress / max_progress);
} }
} }