Applied slightly reformatted patch by Jakub Friedl and Daniel Hornung

2007-09-03  Michael Natterer  <mitch@gimp.org>

	* app/core/gimp-transform-region.c: Applied slightly reformatted
	patch by Jakub Friedl and Daniel Hornung which ROUND()s the
	floating point result values before assigning them to integers to
	avoid reducing the output space to [0..254] (thus darkening the
	image). Fixes bug #472806.


svn path=/trunk/; revision=23451
This commit is contained in:
Michael Natterer 2007-09-03 14:17:53 +00:00 committed by Michael Natterer
parent 5622fa28ff
commit c85b228e4d
2 changed files with 32 additions and 24 deletions

View file

@ -1,3 +1,11 @@
2007-09-03 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-region.c: Applied slightly reformatted
patch by Jakub Friedl and Daniel Hornung which ROUND()s the
floating point result values before assigning them to integers to
avoid reducing the output space to [0..254] (thus darkening the
image). Fixes bug #472806.
2007-09-03 Michael Natterer <mitch@gimp.org>
* data/tips/Makefile.am

View file

@ -811,14 +811,13 @@ sample_linear (PixelSurround *surround,
*/
for (i = 0; i < alpha; i++)
{
gint newval;
newval = (a_recip *
gint newval =
ROUND ((a_recip *
BILINEAR (alphachan[0] * data[i],
alphachan[bytes] * data[bytes + i],
alphachan[rowstride] * data[rowstride + i],
alphachan[rowstride + bytes] * data[rowstride + bytes + i],
du, dv));
du, dv)));
color[i] = CLAMP (newval, 0, 255);
}
@ -1187,25 +1186,26 @@ sample_cubic (PixelSurround *surround,
*/
for (i = 0; i < alpha; i++)
{
gint newval = (a_recip *
gimp_drawable_transform_cubic
(dv,
CUBIC_SCALED_ROW (du,
i + data + rowstride * 0,
data + alpha + rowstride * 0,
bytes),
CUBIC_SCALED_ROW (du,
i + data + rowstride * 1,
data + alpha + rowstride * 1,
bytes),
CUBIC_SCALED_ROW (du,
i + data + rowstride * 2,
data + alpha + rowstride * 2,
bytes),
CUBIC_SCALED_ROW (du,
i + data + rowstride * 3,
data + alpha + rowstride * 3,
bytes)));
gint newval =
ROUND ((a_recip *
gimp_drawable_transform_cubic
(dv,
CUBIC_SCALED_ROW (du,
i + data + rowstride * 0,
data + alpha + rowstride * 0,
bytes),
CUBIC_SCALED_ROW (du,
i + data + rowstride * 1,
data + alpha + rowstride * 1,
bytes),
CUBIC_SCALED_ROW (du,
i + data + rowstride * 2,
data + alpha + rowstride * 2,
bytes),
CUBIC_SCALED_ROW (du,
i + data + rowstride * 3,
data + alpha + rowstride * 3,
bytes))));
color[i] = CLAMP (newval, 0, 255);
}
@ -1306,7 +1306,7 @@ sample_lanczos (PixelSurround *surround,
}
newval *= arecip;
color[b] = CLAMP (newval, 0, 255);
color[b] = CLAMP (ROUND (newval), 0, 255);
}
color[alpha] = RINT (aval);