diff src/glyphs-x.c @ 304:c6de09ad3017 r21-0b50

Import from CVS: tag r21-0b50
author cvs
date Mon, 13 Aug 2007 10:41:12 +0200
parents 70ad99077275
children 33bdb3d4b97f
line wrap: on
line diff
--- a/src/glyphs-x.c	Mon Aug 13 10:40:50 2007 +0200
+++ b/src/glyphs-x.c	Mon Aug 13 10:41:12 2007 +0200
@@ -198,10 +198,17 @@
 	      gr = *ip++;
 	      bl = *ip++;
 	      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
 	    }
 	}
       xfree(qtable);
@@ -266,10 +273,17 @@
 		bl = *ip++ >> (8 - bbits);
 
 	      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
 	    }
 	}
     }