Bug 568305 - gdk-pixbuf mishandles BI_BITFIELDS bmps

2009-01-19  Tor Lillqvist  <tml@iki.fi>

	Bug 568305 - gdk-pixbuf mishandles BI_BITFIELDS bmps

	* io-bmp.c (OneLine32): Use unsigned variables so that we can
	right-shift them without risk of sign extension. Don't "reverse"
	the alpha value, actually storing 0xFF-alpha, but use it as such.


svn path=/trunk/; revision=22172
This commit is contained in:
Tor Lillqvist 2009-01-22 09:45:58 +00:00 committed by Tor Lillqvist
parent 95b80b21ea
commit 834b19f46d
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2009-01-19 Tor Lillqvist <tml@iki.fi>
Bug 568305 - gdk-pixbuf mishandles BI_BITFIELDS bmps
* io-bmp.c (OneLine32): Use unsigned variables so that we can
right-shift them without risk of sign extension. Don't "reverse"
the alpha value, actually storing 0xFF-alpha, but use it as such.
2009-01-12 Tor Lillqvist <tml@iki.fi>
Bug 164002 - query scripts don't work uninstalled on windows

View File

@ -762,7 +762,7 @@ static void OneLine32(struct bmp_progressive_state *context)
a_rshift = context->a_bits - a_lshift;
for (i = 0; i < context->Header.width; i++) {
int v, r, g, b, a;
unsigned int v, r, g, b, a;
v = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
@ -775,7 +775,7 @@ static void OneLine32(struct bmp_progressive_state *context)
*pixels++ = (g << g_lshift) | (g >> g_rshift);
*pixels++ = (b << b_lshift) | (b >> b_rshift);
if (context->a_bits)
*pixels++ = 0xff - ((a << a_lshift) | (a >> a_rshift));
*pixels++ = (a << a_lshift) | (a >> a_rshift);
else
*pixels++ = 0xff;