mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
more cleanups
This commit is contained in:
parent
7e209bf5b8
commit
158f504862
1 changed files with 15 additions and 20 deletions
|
@ -242,9 +242,9 @@ run (const gchar *name,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this function is written as if it is blurring a column at a time,
|
/* This function is written as if it is blurring a column at a time,
|
||||||
even though it can operate on rows, too. There is no difference
|
* even though it can operate on rows, too. There is no difference
|
||||||
in the processing of the lines, at least to the blur_line function.
|
* in the processing of the lines, at least to the blur_line function.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
blur_line (const gdouble *ctable,
|
blur_line (const gdouble *ctable,
|
||||||
|
@ -267,7 +267,7 @@ blur_line (const gdouble *ctable,
|
||||||
const guchar *src_p;
|
const guchar *src_p;
|
||||||
const guchar *src_p1;
|
const guchar *src_p1;
|
||||||
|
|
||||||
/* this first block is the same as the non-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
|
||||||
* big concern.
|
* big concern.
|
||||||
*/
|
*/
|
||||||
|
@ -383,17 +383,15 @@ unsharp_mask (GimpDrawable *drawable,
|
||||||
GimpPixelRgn srcPR, destPR;
|
GimpPixelRgn srcPR, destPR;
|
||||||
gint x1, y1, x2, y2;
|
gint x1, y1, x2, y2;
|
||||||
|
|
||||||
/* Get the input */
|
|
||||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
|
||||||
|
|
||||||
gimp_progress_init (_("Blurring..."));
|
|
||||||
|
|
||||||
/* initialize pixel regions */
|
/* initialize pixel regions */
|
||||||
gimp_pixel_rgn_init (&srcPR, drawable,
|
gimp_pixel_rgn_init (&srcPR, drawable,
|
||||||
0, 0, drawable->width, drawable->height, FALSE, FALSE);
|
0, 0, drawable->width, drawable->height, FALSE, FALSE);
|
||||||
gimp_pixel_rgn_init (&destPR, drawable,
|
gimp_pixel_rgn_init (&destPR, drawable,
|
||||||
0, 0, drawable->width, drawable->height, TRUE, TRUE);
|
0, 0, drawable->width, drawable->height, TRUE, TRUE);
|
||||||
|
|
||||||
|
/* Get the input */
|
||||||
|
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||||
|
|
||||||
unsharp_region (&srcPR, &destPR, drawable->bpp,
|
unsharp_region (&srcPR, &destPR, drawable->bpp,
|
||||||
radius, amount,
|
radius, amount,
|
||||||
x1, x2, y1, y2,
|
x1, x2, y1, y2,
|
||||||
|
@ -422,17 +420,16 @@ unsharp_region (GimpPixelRgn *srcPR,
|
||||||
{
|
{
|
||||||
guchar *src;
|
guchar *src;
|
||||||
guchar *dest;
|
guchar *dest;
|
||||||
gint width;
|
gint width = x2 - x1;
|
||||||
gint height;
|
gint height = y2 - y1;
|
||||||
gdouble *cmatrix = NULL;
|
gdouble *cmatrix = NULL;
|
||||||
gint cmatrix_length;
|
gint cmatrix_length;
|
||||||
gdouble *ctable;
|
gdouble *ctable;
|
||||||
gint row, col;
|
gint row, col;
|
||||||
gint threshold = unsharp_params.threshold;
|
gint threshold = unsharp_params.threshold;
|
||||||
|
|
||||||
/* find height and width of subregion to act on */
|
if (show_progress)
|
||||||
width = x2 - x1;
|
gimp_progress_init (_("Blurring..."));
|
||||||
height = y2 - y1;
|
|
||||||
|
|
||||||
/* generate convolution matrix
|
/* generate convolution matrix
|
||||||
and make sure it's smaller than each dimension */
|
and make sure it's smaller than each dimension */
|
||||||
|
@ -523,12 +520,11 @@ static gint
|
||||||
gen_convolve_matrix (gdouble radius,
|
gen_convolve_matrix (gdouble radius,
|
||||||
gdouble **cmatrix_p)
|
gdouble **cmatrix_p)
|
||||||
{
|
{
|
||||||
gint matrix_length;
|
|
||||||
gint matrix_midpoint;
|
|
||||||
gdouble *cmatrix;
|
gdouble *cmatrix;
|
||||||
gint i,j;
|
|
||||||
gdouble std_dev;
|
gdouble std_dev;
|
||||||
gdouble sum;
|
gdouble sum;
|
||||||
|
gint matrix_length;
|
||||||
|
gint i, j;
|
||||||
|
|
||||||
/* we want to generate a matrix that goes out a certain radius
|
/* we want to generate a matrix that goes out a certain radius
|
||||||
* from the center, so we have to go out ceil(rad-0.5) pixels,
|
* from the center, so we have to go out ceil(rad-0.5) pixels,
|
||||||
|
@ -550,8 +546,6 @@ gen_convolve_matrix (gdouble radius,
|
||||||
if (matrix_length <= 0)
|
if (matrix_length <= 0)
|
||||||
matrix_length = 1;
|
matrix_length = 1;
|
||||||
|
|
||||||
matrix_midpoint = matrix_length / 2 + 1;
|
|
||||||
|
|
||||||
*cmatrix_p = g_new (gdouble, matrix_length);
|
*cmatrix_p = g_new (gdouble, matrix_length);
|
||||||
cmatrix = *cmatrix_p;
|
cmatrix = *cmatrix_p;
|
||||||
|
|
||||||
|
@ -565,7 +559,8 @@ gen_convolve_matrix (gdouble radius,
|
||||||
/* first we do the top (right) half of matrix */
|
/* first we do the top (right) half of matrix */
|
||||||
for (i = matrix_length / 2 + 1; i < matrix_length; i++)
|
for (i = matrix_length / 2 + 1; i < matrix_length; i++)
|
||||||
{
|
{
|
||||||
double base_x = i - floor (matrix_length / 2) - 0.5;
|
gdouble base_x = i - (matrix_length / 2) - 0.5;
|
||||||
|
|
||||||
sum = 0;
|
sum = 0;
|
||||||
for (j = 1; j <= 50; j++)
|
for (j = 1; j <= 50; j++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue