Correct rounding in divide-by-255 code. Obtained from xserver.
This commit is contained in:
parent
b9c0ae867e
commit
b6b88d2f62
|
@ -1,3 +1,8 @@
|
|||
2006-01-03 Eric Anholt <anholt@FreeBSD.org>
|
||||
|
||||
* render/picture.c: (premultiply):
|
||||
Correct rounding in divide-by-255 code. Obtained from xserver.
|
||||
|
||||
2006-01-03 Eric Anholt <anholt@FreeBSD.org>
|
||||
|
||||
* hw/xgl/xglpict.c: (xglPictureInit):
|
||||
|
|
|
@ -863,12 +863,12 @@ static CARD32 xRenderColorToCard32(xRenderColor c)
|
|||
static unsigned int premultiply(unsigned int x)
|
||||
{
|
||||
unsigned int a = x >> 24;
|
||||
unsigned int t = (x & 0xff00ff) * a;
|
||||
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
|
||||
unsigned int t = (x & 0xff00ff) * a + 0x800080;
|
||||
t = (t + ((t >> 8) & 0xff00ff)) >> 8;
|
||||
t &= 0xff00ff;
|
||||
|
||||
x = ((x >> 8) & 0xff) * a;
|
||||
x = (x + ((x >> 8) & 0xff) + 0x80);
|
||||
x = ((x >> 8) & 0xff) * a + 0x80;
|
||||
x = (x + ((x >> 8) & 0xff));
|
||||
x &= 0xff00;
|
||||
x |= t | (a << 24);
|
||||
return x;
|
||||
|
|
Loading…
Reference in New Issue