Subject: pkg/7627: mosaic loses 24-bit frame buffers
To: None <gnats-bugs@gnats.netbsd.org>
From: Wolfgang Rupprecht <wolfgang@wsrcc.com>
List: netbsd-bugs
Date: 05/22/1999 14:50:57
>Number: 7627
>Category: pkg
>Synopsis: mosaic loses on a 24bit depth frame buffer
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager (NetBSD software packages system bug manager)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 22 14:50:01 1999
>Last-Modified:
>Originator: Wolfgang Rupprecht
>Organization:
W S Rupprecht Computer Consulting, Fremont CA
>Release: current 5/12/99
>Environment:
System: NetBSD capsicum.wsrcc.com 1.4 NetBSD 1.4 (WSRCC) #0: Wed May 12 11:24:36 PDT 1999 root@capsicum.wsrcc.com:/v/src/netbsd/NetBSD-current/usr/src/sys/arch/i386/compile/WSRCC i386
>Description:
mosaic loses on a 24-bit depth visual
>How-To-Repeat:
mosaic &
>Fix:
--- /v/obj/www/Mosaic/work/Mosaic-src/libhtmlw/HTMLimages.c Wed Jun 26 16:37:01 1996
+++ Mosaic-src/libhtmlw/HTMLimages.c Sat Mar 22 19:04:44 1997
@@ -500,9 +500,47 @@
width, height, 16, 0);
break;
case 24:
-#ifdef NEW
+
+ bit_data = (unsigned char *)malloc(width * height * 3);
+
+ theVisual = DefaultVisual(dsp, DefaultScreen(dsp));
+ rshift = highbit(theVisual->red_mask) - 7;
+ gshift = highbit(theVisual->green_mask) - 7;
+ bshift = highbit(theVisual->blue_mask) - 7;
+ bmap_order = BitmapBitOrder(dsp);
+
+ bitp = bit_data;
+ datap = data;
+ for (w = (width * height); w > 0; w--)
+ {
+ c =
+ (((img_info->reds[(int)*datap] >> 8) & 0xff) << rshift) |
+ (((img_info->greens[(int)*datap] >> 8) & 0xff) << gshift) |
+ (((img_info->blues[(int)*datap] >> 8) & 0xff) << bshift);
+
+ datap++;
+
+ if (bmap_order == MSBFirst)
+ {
+ *bitp++ = (unsigned char)((c >> 16) & 0xff);
+ *bitp++ = (unsigned char)((c >> 8) & 0xff);
+ *bitp++ = (unsigned char)(c & 0xff);
+ }
+ else
+ {
+ *bitp++ = (unsigned char)(c & 0xff);
+ *bitp++ = (unsigned char)((c >> 8) & 0xff);
+ *bitp++ = (unsigned char)((c >> 16) & 0xff);
+ }
+ }
+
+ newimage = XCreateImage(dsp,
+ DefaultVisual(dsp, DefaultScreen(dsp)),
+ depth, ZPixmap, 0, (char *)bit_data,
+ width, height, 8, 0);
+ break;
+
case 32:
-#endif
bit_data = (unsigned char *)malloc(width * height * 4);
theVisual = DefaultVisual(dsp, DefaultScreen(dsp));
@@ -541,8 +579,9 @@
newimage = XCreateImage(dsp,
DefaultVisual(dsp, DefaultScreen(dsp)),
depth, ZPixmap, 0, (char *)bit_data,
- width, height, 32, 0);
+ width, height, 8, 0);
break;
+
default:
#ifndef DISABLE_TRACE
if (htmlwTrace) {
--- /v/obj/www/Mosaic/work/Mosaic-src/src/pixmaps.c Tue Jun 25 14:53:50 1996
+++ Mosaic-src/src/pixmaps.c Sat Mar 22 19:09:47 1997
@@ -675,8 +675,9 @@
depth, ZPixmap, 0, (char *)bit_data,
width, height, 16, 0);
break;
+
case 24:
- bit_data = (unsigned char *)malloc(size * 4);
+ bit_data = (unsigned char *)malloc(size * 3);
theVisual = DefaultVisual(XtDisplay(wid),
DefaultScreen(XtDisplay(wid)));
@@ -698,7 +699,6 @@
if (bmap_order == MSBFirst)
{
- *bitp++ = (unsigned char)((c >> 24) & 0xff);
*bitp++ = (unsigned char)((c >> 16) & 0xff);
*bitp++ = (unsigned char)((c >> 8) & 0xff);
*bitp++ = (unsigned char)(c & 0xff);
@@ -708,7 +708,6 @@
*bitp++ = (unsigned char)(c & 0xff);
*bitp++ = (unsigned char)((c >> 8) & 0xff);
*bitp++ = (unsigned char)((c >> 16) & 0xff);
- *bitp++ = (unsigned char)((c >> 24) & 0xff);
}
}
@@ -716,7 +715,7 @@
DefaultVisual(XtDisplay(wid),
DefaultScreen(XtDisplay(wid))),
depth, ZPixmap, 0, (char *)bit_data,
- width, height, 32, 0);
+ width, height, 8, 0);
break;
default:
newimage = NULL;
# eof
>Audit-Trail:
>Unformatted: