summaryrefslogtreecommitdiff
path: root/www/Mosaic/patches/patch-ao
blob: a1d8f8691f8aaf6af6bef0805c010c87a5603b5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-ao,v 1.1 1999/06/07 20:47:25 tron Exp $

--- src/pixmaps.c.orig	Tue Jun 25 23:53:50 1996
+++ src/pixmaps.c	Mon Jun  7 22:34:53 1999
@@ -685,6 +685,12 @@
 		bshift = highbit(theVisual->blue_mask) - 7;
 		bmap_order = BitmapBitOrder(XtDisplay(wid));
 
+		newimage = XCreateImage(XtDisplay(wid),
+			DefaultVisual(XtDisplay(wid),
+				DefaultScreen(XtDisplay(wid))),
+			depth, ZPixmap, 0, (char *)bit_data,
+			width, height, 8, 0);
+
 		bitp = bit_data;
 		datap = data;
 		for (w = size; w > 0; w--)
@@ -698,7 +704,10 @@
 
 			if (bmap_order == MSBFirst)
 			{
-				*bitp++ = (unsigned char)((c >> 24) & 0xff);
+				if (newimage->bits_per_pixel == 32)
+				{
+					*bitp++ = (unsigned char)((c >> 24) & 0xff);
+				}
 				*bitp++ = (unsigned char)((c >> 16) & 0xff);
 				*bitp++ = (unsigned char)((c >> 8) & 0xff);
 				*bitp++ = (unsigned char)(c & 0xff);
@@ -708,15 +717,13 @@
 				*bitp++ = (unsigned char)(c & 0xff);
 				*bitp++ = (unsigned char)((c >> 8) & 0xff);
 				*bitp++ = (unsigned char)((c >> 16) & 0xff);
-				*bitp++ = (unsigned char)((c >> 24) & 0xff);
+				if (newimage->bits_per_pixel == 32)
+				{
+					*bitp++ = (unsigned char)((c >> 24) & 0xff);
+				}
 			}
 		}
 
-		newimage = XCreateImage(XtDisplay(wid),
-			DefaultVisual(XtDisplay(wid),
-				DefaultScreen(XtDisplay(wid))),
-			depth, ZPixmap, 0, (char *)bit_data,
-			width, height, 32, 0);
 		break;
 	    default:
 		newimage = NULL;