corrected formula for demultiplying the alpha value.

2007-12-13  Sven Neumann  <sven@gimp.org>

	* app/base/temp-buf.c (temp_buf_demultiply): corrected formula 
for
	demultiplying the alpha value.


svn path=/trunk/; revision=24356
This commit is contained in:
Sven Neumann
2007-12-13 20:30:29 +00:00
committed by Sven Neumann
parent 453f54584d
commit 0a7e4f0745
2 changed files with 9 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2007-12-13 Sven Neumann <sven@gimp.org>
* app/base/temp-buf.c (temp_buf_demultiply): corrected formula for
demultiplying the alpha value.
2007-12-13 Martin Nordholts <martinn@svn.gnome.org>
* app/tools/gimprectangletool.c

View File

@ -355,7 +355,6 @@ temp_buf_demultiply (TempBuf *buf)
{
guchar *data;
gint pixels;
gint x, y;
g_return_if_fail (buf != NULL);
@ -369,8 +368,7 @@ temp_buf_demultiply (TempBuf *buf)
pixels = buf->width * buf->height;
while (pixels--)
{
if (data[1])
data[0] = (data[0] << 8) / data[1];
data[0] = (data[0] << 8) / (data[1] + 1);
data += 2;
}
@ -384,12 +382,9 @@ temp_buf_demultiply (TempBuf *buf)
pixels = buf->width * buf->height;
while (pixels--)
{
if (data[3])
{
data[0] = (data[0] << 8) / data[3];
data[1] = (data[1] << 8) / data[3];
data[2] = (data[2] << 8) / data[3];
}
data[0] = (data[0] << 8) / (data[3] + 1);
data[1] = (data[1] << 8) / (data[3] + 1);
data[2] = (data[2] << 8) / (data[3] + 1);
data += 4;
}