Commit e0ebd94e authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/paint/gimpconvolve.c app/paint-funcs/paint-funcs.[ch] reverted last

2004-05-31  Sven Neumann  <sven@gimp.org>

	* app/paint/gimpconvolve.c
	* app/paint-funcs/paint-funcs.[ch]
	* app/tools/gimpiscissorstool.c: reverted last change and applied
	new patch instead (bug #72878).
parent 727ed840
2004-05-31 Sven Neumann <sven@gimp.org>
* app/paint/gimpconvolve.c
* app/paint-funcs/paint-funcs.[ch]
* app/tools/gimpiscissorstool.c: reverted last change and applied
new patch instead (bug #72878).
2004-05-31 Sven Neumann <sven@gimp.org>
* app/paint/gimpconvolve.c
......
......@@ -2363,7 +2363,8 @@ convolve_region (PixelRegion *srcR,
gfloat *matrix,
gint size,
gdouble divisor,
GimpConvolutionType mode)
GimpConvolutionType mode,
gboolean alpha_weighting)
{
/* Convolve the src image using the convolution matrix, writing to dest */
/* Convolve is not tile-enabled--use accordingly */
......@@ -2403,7 +2404,7 @@ convolve_region (PixelRegion *srcR,
src = srcR->data;
dest = destR->data;
if (HAS_ALPHA (bytes))
if (alpha_weighting)
{
m = matrix;
i = size;
......@@ -2444,7 +2445,7 @@ convolve_region (PixelRegion *srcR,
/* now, handle the center pixels */
x = srcR->w - margin*2;
if (HAS_ALPHA (bytes))
if (alpha_weighting)
while (x--)
{
s = s_row;
......@@ -2463,21 +2464,11 @@ convolve_region (PixelRegion *srcR,
if (alpha && *m)
{
if (alpha == 255)
{
weighted_divisor += *m;
for (b = 0; b < a_byte; b++)
total [b] += *m * *s++;
}
else
{
mult_alpha = *m * (alpha / 255.0);
weighted_divisor += mult_alpha;
for (b = 0; b < a_byte; b++)
total [b] += mult_alpha * *s++;
}
mult_alpha = *m * alpha;
weighted_divisor += mult_alpha;
for (b = 0; b < a_byte; b++)
total [b] += mult_alpha * *s++;
total [a_byte] += *m * *s++;
}
else
......
......@@ -352,7 +352,8 @@ void convolve_region (PixelRegion *srcR,
gfloat *matrix,
gint size,
gdouble divisor,
GimpConvolutionType mode);
GimpConvolutionType mode,
gboolean alpha_weighting);
void multiply_alpha_region (PixelRegion *srcR);
......
......@@ -327,7 +327,7 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
tempPR.data = temp_data;
convolve_region (&tempPR, &destPR, matrix, matrix_size,
matrix_divisor, GIMP_NORMAL_CONVOL);
matrix_divisor, GIMP_NORMAL_CONVOL, TRUE);
/* Free the allocated temp space */
g_free (temp_data);
......@@ -405,7 +405,7 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
ovrsz1PR.data = ovrsz1_data;
convolve_region (&ovrsz1PR, &ovrsz2PR, matrix, matrix_size,
matrix_divisor, GIMP_NORMAL_CONVOL);
matrix_divisor, GIMP_NORMAL_CONVOL, TRUE);
/* Crop and copy to destination */
......
......@@ -1767,7 +1767,7 @@ gradmap_tile_validate (TileManager *tm,
/* Blur the source to get rid of noise */
destPR.rowstride = TILE_WIDTH * 4;
destPR.data = maxgrad_conv0;
convolve_region (&srcPR, &destPR, blur_32, 3, 32, GIMP_NORMAL_CONVOL);
convolve_region (&srcPR, &destPR, blur_32, 3, 32, GIMP_NORMAL_CONVOL, FALSE);
/* Set the "src" temp buf up as the new source Pixel Region */
srcPR.rowstride = destPR.rowstride;
......@@ -1775,11 +1775,13 @@ gradmap_tile_validate (TileManager *tm,
/* Get the horizontal derivative */
destPR.data = maxgrad_conv1;
convolve_region (&srcPR, &destPR, horz_deriv, 3, 1, GIMP_NEGATIVE_CONVOL);
convolve_region (&srcPR, &destPR, horz_deriv, 3, 1, GIMP_NEGATIVE_CONVOL,
FALSE);
/* Get the vertical derivative */
destPR.data = maxgrad_conv2;
convolve_region (&srcPR, &destPR, vert_deriv, 3, 1, GIMP_NEGATIVE_CONVOL);
convolve_region (&srcPR, &destPR, vert_deriv, 3, 1, GIMP_NEGATIVE_CONVOL,
FALSE);
/* calculate overall gradient */
tiledata = tile_data_pointer (tile, 0, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment