2 * Copyright © 2002 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
26 XftNativeByteOrder (void)
30 if (*((char *) &whichbyte))
35 /* byte swap a 32-bit value */
36 #define swapl(x, n) { \
37 n = ((char *) (x))[0];\
38 ((char *) (x))[0] = ((char *) (x))[3];\
39 ((char *) (x))[3] = n;\
40 n = ((char *) (x))[1];\
41 ((char *) (x))[1] = ((char *) (x))[2];\
42 ((char *) (x))[2] = n; }
44 /* byte swap a short */
45 #define swaps(x, n) { \
46 n = ((char *) (x))[0];\
47 ((char *) (x))[0] = ((char *) (x))[1];\
48 ((char *) (x))[1] = n; }
50 /* byte swap a three-byte unit */
51 #define swapt(x, n) { \
52 n = ((char *) (x))[0];\
53 ((char *) (x))[0] = ((char *) (x))[2];\
54 ((char *) (x))[2] = n; }
57 XftSwapCARD32 (CARD32 *data, int u)
68 XftSwapCARD24 (CARD8 *data, int width, int height)
89 XftSwapCARD16 (CARD16 *data, int u)
100 XftSwapImage (XImage *image)
102 switch (image->bits_per_pixel) {
104 XftSwapCARD32 ((CARD32 *) image->data,
105 image->height * image->bytes_per_line >> 2);
108 XftSwapCARD24 ((CARD8 *) image->data,
109 image->bytes_per_line,
113 XftSwapCARD16 ((CARD16 *) image->data,
114 image->height * image->bytes_per_line >> 1);