$NetBSD: patch-aa,v 1.3 1999/06/07 20:47:24 tron Exp $

--- libhtmlw/HTMLimages.c.orig	Thu Jun 27 01:37:01 1996
+++ libhtmlw/HTMLimages.c	Mon Jun  7 22:27:36 1999
@@ -511,6 +511,11 @@
 		bshift = highbit(theVisual->blue_mask) - 7;
 		bmap_order = BitmapBitOrder(dsp);
 
+		newimage = XCreateImage(dsp,
+			DefaultVisual(dsp, DefaultScreen(dsp)),
+			depth, ZPixmap, 0, (char *)bit_data,
+			width, height, 8, 0);
+
 		bitp = bit_data;
 		datap = data;
 		for (w = (width * height); w > 0; w--)
@@ -524,7 +529,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);
@@ -534,14 +542,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(dsp,
-			DefaultVisual(dsp, DefaultScreen(dsp)),
-			depth, ZPixmap, 0, (char *)bit_data,
-			width, height, 32, 0);
 		break;
 	    default:
 #ifndef DISABLE_TRACE
