whitespace cleanup.

2007-04-25  Sven Neumann  <sven@gimp.org>

	* app/paint-funcs/paint-funcs.c: whitespace cleanup.

svn path=/trunk/; revision=22321
This commit is contained in:
Sven Neumann
2007-04-25 11:36:39 +00:00
committed by Sven Neumann
parent 9e0e86f7bd
commit 8bfd436f31
2 changed files with 94 additions and 72 deletions

View File

@ -1,5 +1,7 @@
2007-04-25 Sven Neumann <sven@gimp.org> 2007-04-25 Sven Neumann <sven@gimp.org>
* app/paint-funcs/paint-funcs.c: whitespace cleanup.
* plug-ins/common/despeckle.c: minor cleanups. * plug-ins/common/despeckle.c: minor cleanups.
2007-04-25 Sven Neumann <sven@gimp.org> 2007-04-25 Sven Neumann <sven@gimp.org>

View File

@ -746,9 +746,8 @@ combine_inten_and_inten_pixels (const guchar *src1,
guchar new_alpha = INT_MULT (*m, opacity, tmp); guchar new_alpha = INT_MULT (*m, opacity, tmp);
for (b = 0; b < bytes; b++) for (b = 0; b < bytes; b++)
dest[b] = (affect[b]) ? dest[b] = (affect[b] ?
INT_BLEND(src2[b], src1[b], new_alpha, tmp) : INT_BLEND (src2[b], src1[b], new_alpha, tmp) : src1[b]);
src1[b];
m++; m++;
@ -763,9 +762,8 @@ combine_inten_and_inten_pixels (const guchar *src1,
{ {
for (b = 0; b < bytes; b++) for (b = 0; b < bytes; b++)
dest[b] = (affect[b]) ? dest[b] = (affect[b] ?
INT_BLEND(src2[b], src1[b], opacity, tmp) : INT_BLEND (src2[b], src1[b], opacity, tmp) : src1[b]);
src1[b];
src1 += bytes; src1 += bytes;
src2 += bytes; src2 += bytes;
@ -799,9 +797,8 @@ combine_inten_and_inten_a_pixels (const guchar *src1,
guchar new_alpha = INT_MULT3 (src2[alpha], *m, opacity, t1); guchar new_alpha = INT_MULT3 (src2[alpha], *m, opacity, t1);
for (b = 0; b < bytes; b++) for (b = 0; b < bytes; b++)
dest[b] = (affect[b]) ? dest[b] = (affect[b] ?
INT_BLEND(src2[b], src1[b], new_alpha, t1) : INT_BLEND (src2[b], src1[b], new_alpha, t1) : src1[b]);
src1[b];
m++; m++;
src1 += bytes; src1 += bytes;
@ -820,6 +817,7 @@ combine_inten_and_inten_a_pixels (const guchar *src1,
dest[0] = INT_BLEND (src2[0] , src1[0] , new_alpha, t1); dest[0] = INT_BLEND (src2[0] , src1[0] , new_alpha, t1);
dest[1] = INT_BLEND (src2[1] , src1[1] , new_alpha, t1); dest[1] = INT_BLEND (src2[1] , src1[1] , new_alpha, t1);
dest[2] = INT_BLEND (src2[2] , src1[2] , new_alpha, t1); dest[2] = INT_BLEND (src2[2] , src1[2] , new_alpha, t1);
src1 += bytes; src1 += bytes;
src2 += src2_bytes; src2 += src2_bytes;
dest += bytes; dest += bytes;
@ -832,9 +830,9 @@ combine_inten_and_inten_a_pixels (const guchar *src1,
guchar new_alpha = INT_MULT (src2[alpha],opacity,t1); guchar new_alpha = INT_MULT (src2[alpha],opacity,t1);
for (b = 0; b < bytes; b++) for (b = 0; b < bytes; b++)
dest[b] = (affect[b]) ? dest[b] = (affect[b] ?
INT_BLEND (src2[b] , src1[b] , new_alpha, t1) : INT_BLEND (src2[b] , src1[b] , new_alpha, t1) :
src1[b]; src1[b]);
src1 += bytes; src1 += bytes;
src2 += src2_bytes; src2 += src2_bytes;
@ -1176,7 +1174,8 @@ combine_inten_a_and_inten_a_pixels (const guchar *src1,
while (i--) while (i--)
{ {
/* GUTS */ /* GUTS */
guchar src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); guchar src2_alpha = INT_MULT3 (src2[alpha], *m, opacity,
tmp);
guchar new_alpha = guchar new_alpha =
src1[alpha] + src1[alpha] +
INT_MULT ((255 - src1[alpha]), src2_alpha, tmp); INT_MULT ((255 - src1[alpha]), src2_alpha, tmp);
@ -2409,7 +2408,9 @@ convolve_region (PixelRegion *srcR,
mode = GIMP_NORMAL_CONVOL; mode = GIMP_NORMAL_CONVOL;
} }
else else
{
offset = 0; offset = 0;
}
/* check for the boundary cases */ /* check for the boundary cases */
if (srcR->w < (size - 1) || srcR->h < (size - 1)) if (srcR->w < (size - 1) || srcR->h < (size - 1))
@ -2427,12 +2428,14 @@ convolve_region (PixelRegion *srcR,
{ {
m = matrix; m = matrix;
i = size; i = size;
while (i --) while (i --)
{ {
j = size; j = size;
while (j --) while (j --)
matrixsum += *m++; matrixsum += *m++;
} }
if (matrixsum == 0.0) if (matrixsum == 0.0)
matrixsum = 1.0; matrixsum = 1.0;
} }
@ -2470,7 +2473,7 @@ convolve_region (PixelRegion *srcR,
s = s_row; s = s_row;
m = matrix; m = matrix;
total [0] = total [1] = total [2] = total [3] = 0.0; total [0] = total [1] = total [2] = total [3] = 0;
weighted_divisor = 0.0; weighted_divisor = 0.0;
i = size; i = size;
@ -2488,10 +2491,13 @@ convolve_region (PixelRegion *srcR,
for (b = 0; b < a_byte; b++) for (b = 0; b < a_byte; b++)
total [b] += mult_alpha * *s++; total [b] += mult_alpha * *s++;
total [a_byte] += *m * *s++; total [a_byte] += *m * *s++;
} }
else else
{
s += bytes; s += bytes;
}
m ++; m ++;
} }
@ -2505,8 +2511,10 @@ convolve_region (PixelRegion *srcR,
for (b = 0; b < bytes; b++) for (b = 0; b < bytes; b++)
{ {
total [b] /= divisor; total [b] /= divisor;
if (b != a_byte) if (b != a_byte)
total [b] = total [b] * matrixsum / weighted_divisor; total [b] = total [b] * matrixsum / weighted_divisor;
total [b] += offset; total [b] += offset;
if (total [b] < 0.0 && mode != GIMP_NORMAL_CONVOL) if (total [b] < 0.0 && mode != GIMP_NORMAL_CONVOL)
@ -2526,7 +2534,7 @@ convolve_region (PixelRegion *srcR,
s = s_row; s = s_row;
m = matrix; m = matrix;
total [0] = total [1] = total [2] = total [3] = 0.0; total [0] = total [1] = total [2] = total [3] = 0;
i = size; i = size;
while (i --) while (i --)
@ -2539,6 +2547,7 @@ convolve_region (PixelRegion *srcR,
total [b] += *m * *s++; total [b] += *m * *s++;
else else
s += bytes; s += bytes;
m ++; m ++;
} }
@ -2564,6 +2573,7 @@ convolve_region (PixelRegion *srcR,
/* handle the last pixel... */ /* handle the last pixel... */
s = s_row + (srcR->rowstride + bytes) * margin; s = s_row + (srcR->rowstride + bytes) * margin;
b = bytes * margin; b = bytes * margin;
while (b --) while (b --)
*d++ = *s++; *d++ = *s++;
@ -2603,13 +2613,17 @@ multiply_alpha_region (PixelRegion *srcR)
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
s = src; s = src;
for (x = 0; x < width; x++) for (x = 0; x < width; x++)
{ {
alpha_val = s[bytes - 1] * (1.0 / 255.0); alpha_val = s[bytes - 1] * (1.0 / 255.0);
for (b = 0; b < bytes - 1; b++) for (b = 0; b < bytes - 1; b++)
s[b] = 0.5 + s[b] * alpha_val; s[b] = 0.5 + s[b] * alpha_val;
s += bytes; s += bytes;
} }
src += srcR->rowstride; src += srcR->rowstride;
} }
} }
@ -2635,6 +2649,7 @@ separate_alpha_region (PixelRegion *srcR)
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
s = src; s = src;
for (x = 0; x < width; x++) for (x = 0; x < width; x++)
{ {
/* predicate is equivalent to: /* predicate is equivalent to:
@ -2643,6 +2658,7 @@ separate_alpha_region (PixelRegion *srcR)
if (s[bytes - 1] != 0 && s[bytes - 1] != 255) if (s[bytes - 1] != 0 && s[bytes - 1] != 255)
{ {
alpha_recip = 255.0 / s[bytes - 1]; alpha_recip = 255.0 / s[bytes - 1];
for (b = 0; b < bytes - 1; b++) for (b = 0; b < bytes - 1; b++)
{ {
new_val = 0.5 + s[b] * alpha_recip; new_val = 0.5 + s[b] * alpha_recip;
@ -2650,8 +2666,10 @@ separate_alpha_region (PixelRegion *srcR)
s[b] = new_val; s[b] = new_val;
} }
} }
s += bytes; s += bytes;
} }
src += srcR->rowstride; src += srcR->rowstride;
} }
} }
@ -2798,6 +2816,7 @@ gaussian_blur_region (PixelRegion *srcR,
pixels = b[0]; pixels = b[0];
i += pixels; i += pixels;
if (i > end) if (i > end)
i = end; i = end;
@ -3254,6 +3273,7 @@ thin_region (PixelRegion *region,
for (x = 0; x < region->w; x++) /* set up max for top of image */ for (x = 0; x < region->w; x++) /* set up max for top of image */
{ {
max[x][0] = buf[0][x]; max[x][0] = buf[0][x];
for (j = 1; j < yradius + 1; j++) for (j = 1; j < yradius + 1; j++)
max[x][j] = MIN(buf[j][x], max[x][j-1]); max[x][j] = MIN(buf[j][x], max[x][j-1]);
} }
@ -3261,6 +3281,7 @@ thin_region (PixelRegion *region,
for (y = 0; y < region->h; y++) for (y = 0; y < region->h; y++)
{ {
rotate_pointers (buf, yradius + 1); rotate_pointers (buf, yradius + 1);
if (y < region->h - yradius) if (y < region->h - yradius)
pixel_region_get_row (region, pixel_region_get_row (region,
region->x, region->y + y + yradius, region->w, region->x, region->y + y + yradius, region->w,
@ -3273,9 +3294,8 @@ thin_region (PixelRegion *region,
for (x = 0 ; x < region->w; x++) /* update max array */ for (x = 0 ; x < region->w; x++) /* update max array */
{ {
for (i = yradius; i > 0; i--) for (i = yradius; i > 0; i--)
{
max[x][i] = MIN (MIN (max[x][i - 1], buf[i - 1][x]), buf[i][x]); max[x][i] = MIN (MIN (max[x][i - 1], buf[i - 1][x]), buf[i][x]);
}
max[x][0] = buf[0][x]; max[x][0] = buf[0][x];
} }