This fixes a byte-ordering problem when displaying 8-bit colormapped images on certain 12, 15, or 16-bit displays. Thanks to Mr. Ryo Shimizu for coming up with the patch, and to Yuuki Harano for sending it to me. --jhb --- xv-3.10a.old/xvimage.c +++ xv-3.10a/xvimage.c @@ -1736,10 +1736,12 @@ if (xim->byte_order == MSBFirst) { for (i=wide*high, ip=imagedata; i>0; i--,pp++) { if (((i+1)&0x1ffff) == 0) WaitCursor(); - if (dithpic) { - *ip++ = ((*pp) ? white : black) & 0xffff; - } - else *ip++ = xcolors[*pp] & 0xffff; + + if (dithpic) xcol = ((*pp) ? white : black) & 0xffff; + else xcol = xcolors[*pp] & 0xffff; + + *((unsigned char *)ip)++ = (xcol>>8) & 0xff; + *((unsigned char *)ip)++ = (xcol) & 0xff; } } else { /* LSBFirst */ @@ -1749,8 +1751,8 @@ if (dithpic) xcol = ((*pp) ? white : black) & 0xffff; else xcol = xcolors[*pp]; - /* WAS *ip++ = ((xcol>>8) & 0xff) | ((xcol&0xff) << 8); */ - *ip++ = (unsigned short) (xcol); + *((unsigned char *)ip)++ = (xcol) & 0xff; + *((unsigned char *)ip)++ = (xcol>>8) & 0xff; } } }