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:

committed by
Sven Neumann

parent
453f54584d
commit
0a7e4f0745
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user