On some X server (for example, XFree86 SVGA I am using),
XEmacs cannot display images correctly at 24bpp and sometime
go crash because these server don't expect XImage
structure's `data' were modified directly.
This problem were solved to use XPutImage() substitute for
direct data handling.
But I'm not a X expert, please check if this patch were wrong.
Index: src/glyphs-x.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-x.c,v
retrieving revision 1.49.2.6
diff -r1.49.2.6 glyphs-x.c
128,129c128,129
< int rd,gr,bl,q;
< unsigned char *data, *ip, *dp;
---
> int rd,gr,bl;
> unsigned char *data, *ip;
131,134d130
< union {
< FOUR_BYTE_TYPE val;
< char cp[4];
< } conv;
156c152
< bitmap_pad, 0);
---
> bitmap_pad, byte_cnt * width);
200d195
< dp = data + (i * outimg->bytes_per_line);
206,217c201,202
< conv.val = pixarray[QUANT_GET_COLOR(qtable,rd,gr,bl)];
< #if WORDS_BIGENDIAN
< if (outimg->byte_order == MSBFirst)
< for (q = 4-byte_cnt; q < 4; q++) *dp++ = conv.cp[q];
< else
< for (q = 3; q >= 4-byte_cnt; q--) *dp++ = conv.cp[q];
< #else
< if (outimg->byte_order == MSBFirst)
< for (q = byte_cnt-1; q >= 0; q--) *dp++ = conv.cp[q];
< else
< for (q = 0; q < byte_cnt; q++) *dp++ = conv.cp[q];
< #endif
---
> XPutPixel(outimg, j, i,
> pixarray[QUANT_GET_COLOR(qtable,rd,gr,bl)]);
265d249
< dp = data + (i * outimg->bytes_per_line);
281,292c265,266
< conv.val = (rd << rshift) | (gr << gshift) | (bl << bshift);
< #if WORDS_BIGENDIAN
< if (outimg->byte_order == MSBFirst)
< for (q = 4-byte_cnt; q < 4; q++) *dp++ = conv.cp[q];
< else
< for (q = 3; q >= 4-byte_cnt; q--) *dp++ = conv.cp[q];
< #else
< if (outimg->byte_order == MSBFirst)
< for (q = byte_cnt-1; q >= 0; q--) *dp++ = conv.cp[q];
< else
< for (q = 0; q < byte_cnt; q++) *dp++ = conv.cp[q];
< #endif
---
> XPutPixel(outimg, j, i,
> (rd << rshift) | (gr << gshift) | (bl << bshift));
--
大石一雄 (OISHI Kazuo)