]> Pileus Git - ~andy/gtk/commitdiff
Bug 568305 - gdk-pixbuf mishandles BI_BITFIELDS bmps
authorTor Lillqvist <tml@iki.fi>
Thu, 22 Jan 2009 09:45:58 +0000 (09:45 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 22 Jan 2009 09:45:58 +0000 (09:45 +0000)
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

gdk-pixbuf/ChangeLog
gdk-pixbuf/io-bmp.c

index ffeeb1892e2503355c5211009396de7d5882b6d0..34968425dda1c5d3a86a5dc577285c19d14bfbf1 100644 (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
index bdb856eea1dfcdce3488f4c7c586d0f67d5f3e89..21300e45d85d03e18c53b555f5c45b20e340c509 100644 (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;