On Sun, Jul 05, 1998 at 11:01:34PM -0700, SL Baur wrote:
[1] Doesn't work means the colors came out psychedelic. The
image
didn't appear to be rotated and/or reversed, but all the colors were
wrong.
Sounds like a little/big endianness fuckup for the pixel values when
building the local XImage....
...yup, it's that.
glyphs.c conditionalizes the byte order of pixel bytes in the image on
WORDS_BIGENDIAN for TrueColor visuals. The problem is that it must
follow the _server_ endianness, not the client's one.
Untested (I don't have the required configuration) patch follows.
OG.
1998-07-06 Olivier Galibert <galibert(a)pobox.com>
* glyphs-x.c (convert_EImage_to_XImage): Fix pixel writing problem
when the X server endianness is different than the client's one.
Index: src/glyphs-x.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/src/glyphs-x.c,v
retrieving revision 1.48
diff -u -r1.48 glyphs-x.c
--- glyphs-x.c 1998/06/13 04:28:50 1.48
+++ glyphs-x.c 1998/07/06 15:15:06
@@ -198,11 +198,10 @@
gr = *ip++;
bl = *ip++;
conv.val = pixarray[QUANT_GET_COLOR(qtable,rd,gr,bl)];
-#ifdef WORDS_BIGENDIAN
- for (q = 4-byte_cnt; q < 4; q++) *dp++ = conv.cp[q];
-#else
- for (q = 0; q < byte_cnt; q++) *dp++ = conv.cp[q];
-#endif
+ if (outimg->byte_order == MSBFirst)
+ for (q = 4-byte_cnt; q < 4; q++) *dp++ = conv.cp[q];
+ else
+ for (q = 0; q < byte_cnt; q++) *dp++ = conv.cp[q];
}
}
xfree(qtable);
@@ -267,11 +266,10 @@
bl = *ip++ >> (8 - bbits);
conv.val = (rd << rshift) | (gr << gshift) | (bl << bshift);
-#ifdef WORDS_BIGENDIAN
- for (q = 4-byte_cnt; q < 4; q++) *dp++ = conv.cp[q];
-#else
- for (q = 0; q < byte_cnt; q++) *dp++ = conv.cp[q];
-#endif
+ if (outimg->byte_order == MSBFirst)
+ for (q = 4-byte_cnt; q < 4; q++) *dp++ = conv.cp[q];
+ else
+ for (q = 0; q < byte_cnt; q++) *dp++ = conv.cp[q];
}
}
}