summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2009-01-22 09:45:58 +0000
committerTor Lillqvist <tml@src.gnome.org>2009-01-22 09:45:58 +0000
commit834b19f46d8ec62d95fb78a69de93532fa299069 (patch)
tree629efb4f75a93fdd9860f490904db440c249893c /gdk-pixbuf
parent95b80b21ead6e37edee4dbf06cb34887fa91ff9d (diff)
downloadgtk+-834b19f46d8ec62d95fb78a69de93532fa299069.tar.gz
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
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/ChangeLog8
-rw-r--r--gdk-pixbuf/io-bmp.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index ffeeb1892e..34968425dd 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -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
diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c
index bdb856eea1..21300e45d8 100644
--- a/gdk-pixbuf/io-bmp.c
+++ b/gdk-pixbuf/io-bmp.c
@@ -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;