use gimp_progress_set_text() instead of gimp_progress_init() to change the

2006-04-26  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/unsharp.c: use gimp_progress_set_text() instead
	of gimp_progress_init() to change the progress text.
This commit is contained in:
Sven Neumann 2006-04-26 13:13:38 +00:00 committed by Sven Neumann
parent 0884dfeacc
commit 97e6e61f58
2 changed files with 39 additions and 23 deletions

View File

@ -1,3 +1,8 @@
2006-04-26 Sven Neumann <sven@gimp.org>
* plug-ins/common/unsharp.c: use gimp_progress_set_text() instead
of gimp_progress_init() to change the progress text.
2006-04-26 Sven Neumann <sven@gimp.org> 2006-04-26 Sven Neumann <sven@gimp.org>
* app/actions/vectors-commands.c * app/actions/vectors-commands.c

View File

@ -247,23 +247,19 @@ run (const gchar *name,
static void static void
blur_line (const gdouble *ctable, blur_line (const gdouble *ctable,
const gdouble *cmatrix, const gdouble *cmatrix,
gint cmatrix_length, const gint cmatrix_length,
const guchar *src, const guchar *src,
guchar *dest, guchar *dest,
gint len, const gint len,
glong bytes) const glong bytes)
{ {
gdouble scale;
gdouble sum;
gint i = 0;
gint j = 0;
gint row;
gint cmatrix_middle = cmatrix_length / 2;
const gdouble *cmatrix_p; const gdouble *cmatrix_p;
const gdouble *ctable_p; const gdouble *ctable_p;
const guchar *src_p; const guchar *src_p;
const guchar *src_p1; const guchar *src_p1;
const gint cmatrix_middle = cmatrix_length / 2;
gint row;
gint i, j;
/* This first block is the same as the optimized version -- /* This first block is the same as the optimized version --
* it is only used for very small pictures, so speed isn't a * it is only used for very small pictures, so speed isn't a
@ -274,7 +270,8 @@ blur_line (const gdouble *ctable,
for (row = 0; row < len; row++) for (row = 0; row < len; row++)
{ {
/* find the scale factor */ /* find the scale factor */
scale = 0; gdouble scale = 0;
for (j = 0; j < len; j++) for (j = 0; j < len; j++)
{ {
/* if the index is in bounds, add it to the scale counter */ /* if the index is in bounds, add it to the scale counter */
@ -284,10 +281,13 @@ blur_line (const gdouble *ctable,
} }
src_p = src; src_p = src;
for (i = 0; i < bytes; i++) for (i = 0; i < bytes; i++)
{ {
gdouble sum = 0;
src_p1 = src_p++; src_p1 = src_p++;
sum = 0;
for (j = 0; j < len; j++) for (j = 0; j < len; j++)
{ {
if (j + cmatrix_middle - row >= 0 && if (j + cmatrix_middle - row >= 0 &&
@ -307,22 +307,26 @@ blur_line (const gdouble *ctable,
for (row = 0; row < cmatrix_middle; row++) for (row = 0; row < cmatrix_middle; row++)
{ {
/* find scale factor */ /* find scale factor */
scale = 0; gdouble scale = 0;
for (j = cmatrix_middle - row; j < cmatrix_length; j++) for (j = cmatrix_middle - row; j < cmatrix_length; j++)
scale += cmatrix[j]; scale += cmatrix[j];
src_p = src; src_p = src;
for (i = 0; i < bytes; i++) for (i = 0; i < bytes; i++)
{ {
gdouble sum = 0;
src_p1 = src_p++; src_p1 = src_p++;
sum = 0;
for (j = cmatrix_middle - row; j < cmatrix_length; j++) for (j = cmatrix_middle - row; j < cmatrix_length; j++)
{ {
sum += *src_p1 * cmatrix[j]; sum += *src_p1 * cmatrix[j];
src_p1 += bytes; src_p1 += bytes;
} }
*dest++ = ROUND (sum / scale); *dest++ = (guchar) ROUND (sum / scale);
} }
} }
@ -330,12 +334,15 @@ blur_line (const gdouble *ctable,
for (; row < len - cmatrix_middle; row++) for (; row < len - cmatrix_middle; row++)
{ {
src_p = src + (row - cmatrix_middle) * bytes; src_p = src + (row - cmatrix_middle) * bytes;
for (i = 0; i < bytes; i++) for (i = 0; i < bytes; i++)
{ {
gdouble sum = 0;
cmatrix_p = cmatrix; cmatrix_p = cmatrix;
src_p1 = src_p; src_p1 = src_p;
ctable_p = ctable; ctable_p = ctable;
sum = 0;
for (j = 0; j < cmatrix_length; j++) for (j = 0; j < cmatrix_length; j++)
{ {
sum += cmatrix[j] * *src_p1; sum += cmatrix[j] * *src_p1;
@ -344,7 +351,7 @@ blur_line (const gdouble *ctable,
} }
src_p++; src_p++;
*dest++ = ROUND (sum); *dest++ = (guchar) ROUND (sum);
} }
} }
@ -352,22 +359,26 @@ blur_line (const gdouble *ctable,
for (; row < len; row++) for (; row < len; row++)
{ {
/* find scale factor */ /* find scale factor */
scale = 0; gdouble scale = 0;
for (j = 0; j < len - row + cmatrix_middle; j++) for (j = 0; j < len - row + cmatrix_middle; j++)
scale += cmatrix[j]; scale += cmatrix[j];
src_p = src + (row - cmatrix_middle) * bytes; src_p = src + (row - cmatrix_middle) * bytes;
for (i = 0; i < bytes; i++) for (i = 0; i < bytes; i++)
{ {
sum = 0; gdouble sum = 0;
src_p1 = src_p++; src_p1 = src_p++;
for (j = 0; j < len - row + cmatrix_middle; j++) for (j = 0; j < len - row + cmatrix_middle; j++)
{ {
sum += *src_p1 * cmatrix[j]; sum += *src_p1 * cmatrix[j];
src_p1 += bytes; src_p1 += bytes;
} }
*dest++ = ROUND (sum / scale); *dest++ = (guchar) ROUND (sum / scale);
} }
} }
} }
@ -463,7 +474,7 @@ unsharp_region (GimpPixelRgn *srcPR,
} }
if (show_progress) if (show_progress)
gimp_progress_init (_("Merging")); gimp_progress_set_text (_("Merging"));
/* merge the source and destination (which currently contains /* merge the source and destination (which currently contains
the blurred version) images */ the blurred version) images */
@ -471,7 +482,6 @@ unsharp_region (GimpPixelRgn *srcPR,
{ {
const guchar *s = src; const guchar *s = src;
guchar *d = dest; guchar *d = dest;
gint value = 0;
gint u, v; gint u, v;
/* get source row */ /* get source row */
@ -485,6 +495,7 @@ unsharp_region (GimpPixelRgn *srcPR,
{ {
for (v = 0; v < bytes; v++) for (v = 0; v < bytes; v++)
{ {
gint value;
gint diff = *s - *d; gint diff = *s - *d;
/* do tresholding */ /* do tresholding */
@ -503,7 +514,7 @@ unsharp_region (GimpPixelRgn *srcPR,
} }
if (show_progress) if (show_progress)
gimp_progress_update (0.0); gimp_progress_update (1.0);
g_free (dest); g_free (dest);
g_free (src); g_free (src);