VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.0.1/miline.h@ 67129

最後變更 在這個檔案從67129是 51223,由 vboxsync 提交於 11 年 前

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • 屬性 svn:eol-style 設為 native
檔案大小: 5.1 KB
 
1/* $Xorg: miline.h,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */
2
3/*
4
5Copyright 1994, 1998 The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from The Open Group.
26
27*/
28/* $XFree86: xc/programs/Xserver/mi/miline.h,v 1.6 2001/08/06 20:51:19 dawes Exp $ */
29
30#ifndef MILINE_H
31
32#include "screenint.h"
33
34/*
35 * Public definitions used for configuring basic pixelization aspects
36 * of the sample implementation line-drawing routines provided in
37 * {mfb,mi,cfb*} at run-time.
38 */
39
40#define XDECREASING 4
41#define YDECREASING 2
42#define YMAJOR 1
43
44#define OCTANT1 (1 << (YDECREASING))
45#define OCTANT2 (1 << (YDECREASING|YMAJOR))
46#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR))
47#define OCTANT4 (1 << (XDECREASING|YDECREASING))
48#define OCTANT5 (1 << (XDECREASING))
49#define OCTANT6 (1 << (XDECREASING|YMAJOR))
50#define OCTANT7 (1 << (YMAJOR))
51#define OCTANT8 (1 << (0))
52
53#define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8)
54
55#define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5)
56
57/*
58 * Devices can configure the rendering of routines in mi, mfb, and cfb*
59 * by specifying a thin line bias to be applied to a particular screen
60 * using the following function. The bias parameter is an OR'ing of
61 * the appropriate OCTANT constants defined above to indicate which
62 * octants to bias a line to prefer an axial step when the Bresenham
63 * error term is exactly zero. The octants are mapped as follows:
64 *
65 * \ | /
66 * \ 3 | 2 /
67 * \ | /
68 * 4 \ | / 1
69 * \|/
70 * -----------
71 * /|\
72 * 5 / | \ 8
73 * / | \
74 * / 6 | 7 \
75 * / | \
76 *
77 * For more information, see "Ambiguities in Incremental Line Rastering,"
78 * Jack E. Bresenham, IEEE CG&A, May 1987.
79 */
80
81extern void miSetZeroLineBias(
82 ScreenPtr /* pScreen */,
83 unsigned int /* bias */
84);
85
86/*
87 * Private definitions needed for drawing thin (zero width) lines
88 * Used by the mi, mfb, and all cfb* components.
89 */
90
91#define X_AXIS 0
92#define Y_AXIS 1
93
94#define OUT_LEFT 0x08
95#define OUT_RIGHT 0x04
96#define OUT_ABOVE 0x02
97#define OUT_BELOW 0x01
98
99#define OUTCODES(_result, _x, _y, _pbox) \
100 if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \
101 else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \
102 if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
103 else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
104
105#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
106{\
107 if (x < xmin) outcode |= OUT_LEFT;\
108 if (x > xmax) outcode |= OUT_RIGHT;\
109 if (y < ymin) outcode |= OUT_ABOVE;\
110 if (y > ymax) outcode |= OUT_BELOW;\
111}
112
113#define SWAPINT(i, j) \
114{ register int _t = i; i = j; j = _t; }
115
116#define SWAPPT(i, j) \
117{ DDXPointRec _t; _t = i; i = j; j = _t; }
118
119#define SWAPINT_PAIR(x1, y1, x2, y2)\
120{ int t = x1; x1 = x2; x2 = t;\
121 t = y1; y1 = y2; y2 = t;\
122}
123
124#define miGetZeroLineBias(_pScreen) \
125 ((miZeroLineScreenIndex < 0) ? \
126 0 : ((_pScreen)->devPrivates[miZeroLineScreenIndex].uval))
127
128#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \
129 (_octant) = 0; \
130 (_sx) = (_SX); \
131 if (((_adx) = (_x2) - (_x1)) < 0) { \
132 (_adx) = -(_adx); \
133 (_sx = -(_sx)); \
134 (_octant) |= XDECREASING; \
135 } \
136 (_sy) = (_SY); \
137 if (((_ady) = (_y2) - (_y1)) < 0) { \
138 (_ady) = -(_ady); \
139 (_sy = -(_sy)); \
140 (_octant) |= YDECREASING; \
141 }
142
143#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR)
144
145#define FIXUP_ERROR(_e, _octant, _bias) \
146 (_e) -= (((_bias) >> (_octant)) & 1)
147
148#define IsXMajorOctant(_octant) (!((_octant) & YMAJOR))
149#define IsYMajorOctant(_octant) ((_octant) & YMAJOR)
150#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING)
151#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING)
152
153extern int miZeroLineScreenIndex;
154
155extern int miZeroClipLine(
156 int /*xmin*/,
157 int /*ymin*/,
158 int /*xmax*/,
159 int /*ymax*/,
160 int * /*new_x1*/,
161 int * /*new_y1*/,
162 int * /*new_x2*/,
163 int * /*new_y2*/,
164 unsigned int /*adx*/,
165 unsigned int /*ady*/,
166 int * /*pt1_clipped*/,
167 int * /*pt2_clipped*/,
168 int /*octant*/,
169 unsigned int /*bias*/,
170 int /*oc1*/,
171 int /*oc2*/
172);
173
174#endif /* MILINE_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette