1 | /***********************************************************
|
---|
2 |
|
---|
3 | Copyright 1987, 1998 The Open Group
|
---|
4 |
|
---|
5 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | the above copyright notice appear in all copies and that both that
|
---|
8 | copyright notice and this permission notice appear in supporting
|
---|
9 | documentation.
|
---|
10 |
|
---|
11 | The above copyright notice and this permission notice shall be included in
|
---|
12 | all copies or substantial portions of the Software.
|
---|
13 |
|
---|
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
20 |
|
---|
21 | Except as contained in this notice, the name of The Open Group shall not be
|
---|
22 | used in advertising or otherwise to promote the sale, use or other dealings
|
---|
23 | in this Software without prior written authorization from The Open Group.
|
---|
24 |
|
---|
25 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
---|
26 |
|
---|
27 | All Rights Reserved
|
---|
28 |
|
---|
29 | Permission to use, copy, modify, and distribute this software and its
|
---|
30 | documentation for any purpose and without fee is hereby granted,
|
---|
31 | provided that the above copyright notice appear in all copies and that
|
---|
32 | both that copyright notice and this permission notice appear in
|
---|
33 | supporting documentation, and that the name of Digital not be
|
---|
34 | used in advertising or publicity pertaining to distribution of the
|
---|
35 | software without specific, written prior permission.
|
---|
36 |
|
---|
37 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
38 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
39 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
40 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
41 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
42 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
43 | SOFTWARE.
|
---|
44 |
|
---|
45 | ******************************************************************/
|
---|
46 |
|
---|
47 | #ifndef SERVERMD_H
|
---|
48 | #define SERVERMD_H 1
|
---|
49 |
|
---|
50 | #if !defined(_DIX_CONFIG_H_) && !defined(_XORG_SERVER_H_)
|
---|
51 | #error Drivers must include xorg-server.h before any other xserver headers
|
---|
52 | #error xserver code must include dix-config.h before any other headers
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | #if X_BYTE_ORDER == X_LITTLE_ENDIAN
|
---|
56 | #define IMAGE_BYTE_ORDER LSBFirst
|
---|
57 | #define BITMAP_BIT_ORDER LSBFirst
|
---|
58 | #elif X_BYTE_ORDER == X_BIG_ENDIAN
|
---|
59 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
60 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
61 | #else
|
---|
62 | #error "Too weird to live."
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | #ifndef GLYPHPADBYTES
|
---|
66 | #define GLYPHPADBYTES 4
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | /* size of buffer to use with GetImage, measured in bytes. There's obviously
|
---|
70 | * a trade-off between the amount of heap used and the number of times the
|
---|
71 | * ddx routine has to be called.
|
---|
72 | */
|
---|
73 | #ifndef IMAGE_BUFSIZE
|
---|
74 | #define IMAGE_BUFSIZE (64*1024)
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | /* pad scanline to a longword */
|
---|
78 | #ifndef BITMAP_SCANLINE_UNIT
|
---|
79 | #define BITMAP_SCANLINE_UNIT 32
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | #ifndef BITMAP_SCANLINE_PAD
|
---|
83 | #define BITMAP_SCANLINE_PAD 32
|
---|
84 | #define LOG2_BITMAP_PAD 5
|
---|
85 | #define LOG2_BYTES_PER_SCANLINE_PAD 2
|
---|
86 | #endif
|
---|
87 |
|
---|
88 | #include <X11/Xfuncproto.h>
|
---|
89 | /*
|
---|
90 | * This returns the number of padding units, for depth d and width w.
|
---|
91 | * For bitmaps this can be calculated with the macros above.
|
---|
92 | * Other depths require either grovelling over the formats field of the
|
---|
93 | * screenInfo or hardwired constants.
|
---|
94 | */
|
---|
95 |
|
---|
96 | typedef struct _PaddingInfo {
|
---|
97 | int padRoundUp; /* pixels per pad unit - 1 */
|
---|
98 | int padPixelsLog2; /* log 2 (pixels per pad unit) */
|
---|
99 | int padBytesLog2; /* log 2 (bytes per pad unit) */
|
---|
100 | int notPower2; /* bitsPerPixel not a power of 2 */
|
---|
101 | int bytesPerPixel; /* only set when notPower2 is TRUE */
|
---|
102 | int bitsPerPixel; /* bits per pixel */
|
---|
103 | } PaddingInfo;
|
---|
104 | extern _X_EXPORT PaddingInfo PixmapWidthPaddingInfo[];
|
---|
105 |
|
---|
106 | /* The only portable way to get the bpp from the depth is to look it up */
|
---|
107 | #define BitsPerPixel(d) (PixmapWidthPaddingInfo[d].bitsPerPixel)
|
---|
108 |
|
---|
109 | #define PixmapWidthInPadUnits(w, d) \
|
---|
110 | (PixmapWidthPaddingInfo[d].notPower2 ? \
|
---|
111 | (((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \
|
---|
112 | PixmapWidthPaddingInfo[d].bytesPerPixel) >> \
|
---|
113 | PixmapWidthPaddingInfo[d].padBytesLog2) : \
|
---|
114 | ((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
|
---|
115 | PixmapWidthPaddingInfo[d].padPixelsLog2))
|
---|
116 |
|
---|
117 | /*
|
---|
118 | * Return the number of bytes to which a scanline of the given
|
---|
119 | * depth and width will be padded.
|
---|
120 | */
|
---|
121 | #define PixmapBytePad(w, d) \
|
---|
122 | (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
|
---|
123 |
|
---|
124 | #define BitmapBytePad(w) \
|
---|
125 | (((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD)
|
---|
126 |
|
---|
127 | #endif /* SERVERMD_H */
|
---|