gtk+ r22171 - branches/gtk-2-14/gdk-pixbuf



Author: tml
Date: Thu Jan 22 09:44:22 2009
New Revision: 22171
URL: http://svn.gnome.org/viewvc/gtk+?rev=22171&view=rev

Log:
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.



Modified:
   branches/gtk-2-14/gdk-pixbuf/ChangeLog
   branches/gtk-2-14/gdk-pixbuf/io-bmp.c

Modified: branches/gtk-2-14/gdk-pixbuf/io-bmp.c
==============================================================================
--- branches/gtk-2-14/gdk-pixbuf/io-bmp.c	(original)
+++ branches/gtk-2-14/gdk-pixbuf/io-bmp.c	Thu Jan 22 09:44:22 2009
@@ -762,7 +762,7 @@
 		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 @@
 			*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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]