2
* $XFree86: xc/lib/Xft/xftswap.c,v 1.1 2002/02/15 07:37:35 keithp Exp $
4
* Copyright � 2002 Keith Packard, member of The XFree86 Project, Inc.
6
* Permission to use, copy, modify, distribute, and sell this software and its
7
* documentation for any purpose is hereby granted without fee, provided that
8
* the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of Keith Packard not be used in
11
* advertising or publicity pertaining to distribution of the software without
12
* specific, written prior permission. Keith Packard makes no
13
* representations about the suitability of this software for any purpose. It
14
* is provided "as is" without express or implied warranty.
16
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
29
XftNativeByteOrder (void)
33
if (*((char *) &whichbyte))
38
/* byte swap a 32-bit value */
39
#define swapl(x, n) { \
40
n = ((char *) (x))[0];\
41
((char *) (x))[0] = ((char *) (x))[3];\
42
((char *) (x))[3] = n;\
43
n = ((char *) (x))[1];\
44
((char *) (x))[1] = ((char *) (x))[2];\
45
((char *) (x))[2] = n; }
47
/* byte swap a short */
48
#define swaps(x, n) { \
49
n = ((char *) (x))[0];\
50
((char *) (x))[0] = ((char *) (x))[1];\
51
((char *) (x))[1] = n; }
53
/* byte swap a three-byte unit */
54
#define swapt(x, n) { \
55
n = ((char *) (x))[0];\
56
((char *) (x))[0] = ((char *) (x))[2];\
57
((char *) (x))[2] = n; }
60
XftSwapCARD32 (CARD32 *data, int u)
71
XftSwapCARD24 (CARD8 *data, int width, int height)
92
XftSwapCARD16 (CARD16 *data, int u)
103
XftSwapImage (XImage *image)
105
switch (image->bits_per_pixel) {
107
XftSwapCARD32 ((CARD32 *) image->data,
108
image->height * image->bytes_per_line >> 2);
111
XftSwapCARD24 ((CARD8 *) image->data,
112
image->bytes_per_line,
116
XftSwapCARD16 ((CARD16 *) image->data,
117
image->height * image->bytes_per_line >> 1);