round pixel values instead if just casting the float to an integer. Fixes

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

	* app/paint-funcs/paint-funcs.c (convolve_region): round pixel values
	instead if just casting the float to an integer. Fixes bug #432978.

svn path=/trunk/; revision=22322
This commit is contained in:
Sven Neumann
2007-04-25 11:46:14 +00:00
committed by Sven Neumann
parent 8bfd436f31
commit 681764e4e8
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2007-04-25 Sven Neumann <sven@gimp.org>
* app/paint-funcs/paint-funcs.c (convolve_region): round pixel values
instead if just casting the float to an integer. Fixes bug #432978.
2007-04-25 Sven Neumann <sven@gimp.org>
* app/paint-funcs/paint-funcs.c: whitespace cleanup.

View File

@ -2389,7 +2389,7 @@ convolve_region (PixelRegion *srcR,
guchar *src, *s_row, *s;
guchar *dest, *d;
const gfloat *m;
gdouble total [4];
gdouble total[4];
gint b, bytes;
gint alpha, a_byte;
gint length;
@ -2523,7 +2523,7 @@ convolve_region (PixelRegion *srcR,
if (total [b] < 0)
*d++ = 0;
else
*d++ = (total [b] > 255.0) ? 255 : (guchar) total [b];
*d++ = (total [b] > 255.0) ? 255 : (guchar) ROUND (total [b]);
}
s_row += bytes;
@ -2564,7 +2564,7 @@ convolve_region (PixelRegion *srcR,
if (total [b] < 0.0)
*d++ = 0.0;
else
*d++ = (total [b] > 255.0) ? 255 : (guchar) total [b];
*d++ = (total [b] > 255.0) ? 255 : (guchar) ROUND (total [b]);
}
s_row += bytes;