changeset 79528:558b3650d5dc

(xbm_load) [WINDOWSNT]: Shuffle the bits of directly specified XBMs.
author Jason Rumney <jasonr@gnu.org>
date Sun, 02 Dec 2007 16:18:09 +0000
parents fbf1ae5bfff7
children 1c48712f3aa3
files src/image.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sun Dec 02 04:09:52 2007 +0000
+++ b/src/image.c	Sun Dec 02 16:18:09 2007 +0000
@@ -3120,6 +3120,8 @@
   release_frame_dc (f, hdc);
   old_prev = SelectObject (old_img_dc, img->pixmap);
   new_prev = SelectObject (new_img_dc, new_pixmap);
+  /* Windows convention for mono bitmaps is black = background,
+     white = foreground.  */
   SetTextColor (new_img_dc, background);
   SetBkColor (new_img_dc, foreground);
 
@@ -3515,6 +3517,19 @@
 	  else
 	    bits = XBOOL_VECTOR (data)->data;
 
+#ifdef WINDOWSNT
+          {
+            char *invertedBits;
+            int nbytes, i;
+            /* Windows mono bitmaps are reversed compared with X.  */
+            invertedBits = bits;
+            nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR 
+              * img->height;
+            bits = (char *) alloca(nbytes);
+            for (i = 0; i < nbytes; i++)
+              bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]);
+          }
+#endif
 	  /* Create the pixmap.  */
 
 	  Create_Pixmap_From_Bitmap_Data (f, img, bits,