--- rxvt-unicode/src/rxvtimg.C 2012/06/07 20:22:40 1.53 +++ rxvt-unicode/src/rxvtimg.C 2012/06/07 20:26:21 1.55 @@ -73,15 +73,17 @@ // that both 24 and 32 bpp MUST be supported by any screen that supports xrender int depth = gdk_pixbuf_get_has_alpha (pb) ? 32 : 24; + int byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; + XImage xi; xi.width = width; xi.height = height; xi.xoffset = 0; xi.format = ZPixmap; - xi.byte_order = LSBFirst; // maybe go for host byte order, because servers are usually local? - xi.bitmap_unit = 32; //XY only, unused - xi.bitmap_bit_order = LSBFirst; //XY only, unused + xi.byte_order = ImageByteOrder (dpy); + xi.bitmap_unit = 0; //XY only, unused + xi.bitmap_bit_order = 0; //XY only, unused xi.bitmap_pad = BitmapPad (dpy); xi.depth = depth; xi.bytes_per_line = 0; @@ -91,6 +93,8 @@ xi.blue_mask = 0x00000000; //Z only, unused xi.obdata = 0; // probably unused + bool byte_order_mismatch = byte_order != xi.byte_order; + if (!XInitImage (&xi)) rxvt_fatal ("unable to initialise ximage, please report.\n"); @@ -122,6 +126,9 @@ if (ecb_big_endian ()) v = ecb_bswap32 (v); + if (byte_order_mismatch) + v = ecb_bswap32 (v); + *dst++ = v; } else @@ -134,6 +141,9 @@ v = ecb_rotr32 (v, 8); + if (byte_order_mismatch) + v = ecb_bswap32 (v); + *dst++ = v; }