VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.3.0.0/fb.h@ 37801

最後變更 在這個檔案從37801是 25078,由 vboxsync 提交於 15 年 前

Additions/x11/x11include: exported and set eol-style on new headers

  • 屬性 svn:eol-style 設為 native
檔案大小: 44.0 KB
 
1/*
2 *
3 * Copyright © 1998 Keith Packard
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, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Keith Packard makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
14 *
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
22 */
23
24
25#ifndef _FB_H_
26#define _FB_H_
27
28#include <X11/X.h>
29#include "scrnintstr.h"
30#include "pixmap.h"
31#include "pixmapstr.h"
32#include "region.h"
33#include "gcstruct.h"
34#include "colormap.h"
35#include "miscstruct.h"
36#include "servermd.h"
37#include "windowstr.h"
38#include "mi.h"
39#include "migc.h"
40#include "mibstore.h"
41#ifdef RENDER
42#include "picturestr.h"
43#else
44#include "picture.h"
45#endif
46
47/*
48 * This single define controls the basic size of data manipulated
49 * by this software; it must be log2(sizeof (FbBits) * 8)
50 */
51
52#ifndef FB_SHIFT
53#define FB_SHIFT LOG2_BITMAP_PAD
54#endif
55
56#if FB_SHIFT < LOG2_BITMAP_PAD
57 error FB_SHIFT must be >= LOG2_BITMAP_PAD
58#endif
59
60#define FB_UNIT (1 << FB_SHIFT)
61#define FB_HALFUNIT (1 << (FB_SHIFT-1))
62#define FB_MASK (FB_UNIT - 1)
63#define FB_ALLONES ((FbBits) -1)
64
65#if GLYPHPADBYTES != 4
66#error "GLYPHPADBYTES must be 4"
67#endif
68#if GETLEFTBITS_ALIGNMENT != 1
69#error "GETLEFTBITS_ALIGNMENT must be 1"
70#endif
71/* whether to bother to include 24bpp support */
72#ifndef FBNO24BIT
73#define FB_24BIT
74#endif
75
76/*
77 * Unless otherwise instructed, fb includes code to advertise 24bpp
78 * windows with 32bpp image format for application compatibility
79 */
80
81#ifdef FB_24BIT
82#ifndef FBNO24_32
83#define FB_24_32BIT
84#endif
85#endif
86
87#define FB_STIP_SHIFT LOG2_BITMAP_PAD
88#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
89#define FB_STIP_MASK (FB_STIP_UNIT - 1)
90#define FB_STIP_ALLONES ((FbStip) -1)
91
92#define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0)
93#define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0)
94
95#define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT)))
96#define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT)))
97
98#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1))
99
100#if FB_SHIFT == 6
101# ifdef WIN32
102typedef unsigned __int64 FbBits;
103# else
104# if defined(__alpha__) || defined(__alpha) || \
105 defined(ia64) || defined(__ia64__) || \
106 defined(__sparc64__) || defined(_LP64) || \
107 defined(__s390x__) || \
108 defined(amd64) || defined (__amd64__) || \
109 defined (__powerpc64__) || \
110 (defined(sgi) && (_MIPS_SZLONG == 64))
111typedef unsigned long FbBits;
112# else
113typedef unsigned long long FbBits;
114# endif
115# endif
116#endif
117
118#if FB_SHIFT == 5
119typedef CARD32 FbBits;
120#endif
121
122#if FB_SHIFT == 4
123typedef CARD16 FbBits;
124#endif
125
126#if LOG2_BITMAP_PAD == FB_SHIFT
127typedef FbBits FbStip;
128#else
129# if LOG2_BITMAP_PAD == 5
130typedef CARD32 FbStip;
131# endif
132#endif
133
134typedef int FbStride;
135
136
137#ifdef FB_DEBUG
138extern void fbValidateDrawable(DrawablePtr d);
139extern void fbInitializeDrawable(DrawablePtr d);
140extern void fbSetBits (FbStip *bits, int stride, FbStip data);
141#define FB_HEAD_BITS (FbStip) (0xbaadf00d)
142#define FB_TAIL_BITS (FbStip) (0xbaddf0ad)
143#else
144#define fbValidateDrawable(d)
145#define fdInitializeDrawable(d)
146#endif
147
148#include "fbrop.h"
149
150#if BITMAP_BIT_ORDER == LSBFirst
151#define FbScrLeft(x,n) ((x) >> (n))
152#define FbScrRight(x,n) ((x) << (n))
153/* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */
154#define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1))
155#define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n)))
156#define FbPatternOffsetBits 0
157#else
158#define FbScrLeft(x,n) ((x) << (n))
159#define FbScrRight(x,n) ((x) >> (n))
160/* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */
161#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
162#define FbStipMoveLsb(x,s,n) (x)
163#define FbPatternOffsetBits (sizeof (FbBits) - 1)
164#endif
165
166#include "micoord.h"
167
168#define FbStipLeft(x,n) FbScrLeft(x,n)
169#define FbStipRight(x,n) FbScrRight(x,n)
170
171#define FbRotLeft(x,n) FbScrLeft(x,n) | (n ? FbScrRight(x,FB_UNIT-n) : 0)
172#define FbRotRight(x,n) FbScrRight(x,n) | (n ? FbScrLeft(x,FB_UNIT-n) : 0)
173
174#define FbRotStipLeft(x,n) FbStipLeft(x,n) | (n ? FbStipRight(x,FB_STIP_UNIT-n) : 0)
175#define FbRotStipRight(x,n) FbStipRight(x,n) | (n ? FbStipLeft(x,FB_STIP_UNIT-n) : 0)
176
177#define FbLeftMask(x) ( ((x) & FB_MASK) ? \
178 FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
179#define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
180 FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
181
182#define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \
183 FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0)
184#define FbRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \
185 FbScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0)
186
187#define FbBitsMask(x,w) (FbScrRight(FB_ALLONES,(x) & FB_MASK) & \
188 FbScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK))
189
190#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
191 FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
192
193
194#define FbMaskBits(x,w,l,n,r) { \
195 n = (w); \
196 r = FbRightMask((x)+n); \
197 l = FbLeftMask(x); \
198 if (l) { \
199 n -= FB_UNIT - ((x) & FB_MASK); \
200 if (n < 0) { \
201 n = 0; \
202 l &= r; \
203 r = 0; \
204 } \
205 } \
206 n >>= FB_SHIFT; \
207}
208
209#ifdef FBNOPIXADDR
210#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) FbMaskBits(x,w,l,n,r)
211#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \
212 *dst = FbDoMaskRRop(*dst,and,xor,l); \
213}
214#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
215 *dst = FbDoMaskRRop(*dst,and,xor,r); \
216}
217#else
218
219#define FbByteMaskInvalid 0x10
220
221#define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1)))
222
223#define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o)))
224#define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3))
225#define FbStorePart(dst,off,t,xor) (*FbPtrOffset(dst,off,t) = \
226 FbSelectPart(xor,off,t))
227#ifndef FbSelectPart
228#define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t)
229#endif
230
231#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \
232 n = (w); \
233 lb = 0; \
234 rb = 0; \
235 r = FbRightMask((x)+n); \
236 if (r) { \
237 /* compute right byte length */ \
238 if ((copy) && (((x) + n) & 7) == 0) { \
239 rb = (((x) + n) & FB_MASK) >> 3; \
240 } else { \
241 rb = FbByteMaskInvalid; \
242 } \
243 } \
244 l = FbLeftMask(x); \
245 if (l) { \
246 /* compute left byte length */ \
247 if ((copy) && ((x) & 7) == 0) { \
248 lb = ((x) & FB_MASK) >> 3; \
249 } else { \
250 lb = FbByteMaskInvalid; \
251 } \
252 /* subtract out the portion painted by leftMask */ \
253 n -= FB_UNIT - ((x) & FB_MASK); \
254 if (n < 0) { \
255 if (lb != FbByteMaskInvalid) { \
256 if (rb == FbByteMaskInvalid) { \
257 lb = FbByteMaskInvalid; \
258 } else if (rb) { \
259 lb |= (rb - lb) << (FB_SHIFT - 3); \
260 rb = 0; \
261 } \
262 } \
263 n = 0; \
264 l &= r; \
265 r = 0; \
266 }\
267 } \
268 n >>= FB_SHIFT; \
269}
270
271#if FB_SHIFT == 6
272#define FbDoLeftMaskByteRRop6Cases(dst,xor) \
273 case (sizeof (FbBits) - 7) | (1 << (FB_SHIFT - 3)): \
274 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
275 break; \
276 case (sizeof (FbBits) - 7) | (2 << (FB_SHIFT - 3)): \
277 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
278 FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
279 break; \
280 case (sizeof (FbBits) - 7) | (3 << (FB_SHIFT - 3)): \
281 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
282 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
283 break; \
284 case (sizeof (FbBits) - 7) | (4 << (FB_SHIFT - 3)): \
285 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
286 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
287 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
288 break; \
289 case (sizeof (FbBits) - 7) | (5 << (FB_SHIFT - 3)): \
290 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
291 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
292 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
293 break; \
294 case (sizeof (FbBits) - 7) | (6 << (FB_SHIFT - 3)): \
295 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
296 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
297 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
298 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
299 break; \
300 case (sizeof (FbBits) - 7): \
301 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
302 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
303 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
304 break; \
305 case (sizeof (FbBits) - 6) | (1 << (FB_SHIFT - 3)): \
306 FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
307 break; \
308 case (sizeof (FbBits) - 6) | (2 << (FB_SHIFT - 3)): \
309 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
310 break; \
311 case (sizeof (FbBits) - 6) | (3 << (FB_SHIFT - 3)): \
312 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
313 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
314 break; \
315 case (sizeof (FbBits) - 6) | (4 << (FB_SHIFT - 3)): \
316 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
317 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
318 break; \
319 case (sizeof (FbBits) - 6) | (5 << (FB_SHIFT - 3)): \
320 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
321 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
322 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
323 break; \
324 case (sizeof (FbBits) - 6): \
325 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
326 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
327 break; \
328 case (sizeof (FbBits) - 5) | (1 << (FB_SHIFT - 3)): \
329 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
330 break; \
331 case (sizeof (FbBits) - 5) | (2 << (FB_SHIFT - 3)): \
332 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
333 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
334 break; \
335 case (sizeof (FbBits) - 5) | (3 << (FB_SHIFT - 3)): \
336 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
337 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
338 break; \
339 case (sizeof (FbBits) - 5) | (4 << (FB_SHIFT - 3)): \
340 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
341 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
342 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
343 break; \
344 case (sizeof (FbBits) - 5): \
345 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
346 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
347 break; \
348 case (sizeof (FbBits) - 4) | (1 << (FB_SHIFT - 3)): \
349 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
350 break; \
351 case (sizeof (FbBits) - 4) | (2 << (FB_SHIFT - 3)): \
352 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
353 break; \
354 case (sizeof (FbBits) - 4) | (3 << (FB_SHIFT - 3)): \
355 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
356 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
357 break; \
358 case (sizeof (FbBits) - 4): \
359 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
360 break;
361
362#define FbDoRightMaskByteRRop6Cases(dst,xor) \
363 case 4: \
364 FbStorePart(dst,0,CARD32,xor); \
365 break; \
366 case 5: \
367 FbStorePart(dst,0,CARD32,xor); \
368 FbStorePart(dst,4,CARD8,xor); \
369 break; \
370 case 6: \
371 FbStorePart(dst,0,CARD32,xor); \
372 FbStorePart(dst,4,CARD16,xor); \
373 break; \
374 case 7: \
375 FbStorePart(dst,0,CARD32,xor); \
376 FbStorePart(dst,4,CARD16,xor); \
377 FbStorePart(dst,6,CARD8,xor); \
378 break;
379#else
380#define FbDoLeftMaskByteRRop6Cases(dst,xor)
381#define FbDoRightMaskByteRRop6Cases(dst,xor)
382#endif
383
384#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \
385 switch (lb) { \
386 FbDoLeftMaskByteRRop6Cases(dst,xor) \
387 case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \
388 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
389 break; \
390 case (sizeof (FbBits) - 3) | (2 << (FB_SHIFT - 3)): \
391 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
392 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
393 break; \
394 case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \
395 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
396 break; \
397 case sizeof (FbBits) - 3: \
398 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
399 case sizeof (FbBits) - 2: \
400 FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \
401 break; \
402 case sizeof (FbBits) - 1: \
403 FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \
404 break; \
405 default: \
406 *dst = FbDoMaskRRop(*dst, and, xor, l); \
407 break; \
408 } \
409}
410
411
412#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
413 switch (rb) { \
414 case 1: \
415 FbStorePart(dst,0,CARD8,xor); \
416 break; \
417 case 2: \
418 FbStorePart(dst,0,CARD16,xor); \
419 break; \
420 case 3: \
421 FbStorePart(dst,0,CARD16,xor); \
422 FbStorePart(dst,2,CARD8,xor); \
423 break; \
424 FbDoRightMaskByteRRop6Cases(dst,xor) \
425 default: \
426 *dst = FbDoMaskRRop (*dst, and, xor, r); \
427 } \
428}
429#endif
430
431#define FbMaskStip(x,w,l,n,r) { \
432 n = (w); \
433 r = FbRightStipMask((x)+n); \
434 l = FbLeftStipMask(x); \
435 if (l) { \
436 n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \
437 if (n < 0) { \
438 n = 0; \
439 l &= r; \
440 r = 0; \
441 } \
442 } \
443 n >>= FB_STIP_SHIFT; \
444}
445
446/*
447 * These macros are used to transparently stipple
448 * in copy mode; the expected usage is with 'n' constant
449 * so all of the conditional parts collapse into a minimal
450 * sequence of partial word writes
451 *
452 * 'n' is the bytemask of which bytes to store, 'a' is the address
453 * of the FbBits base unit, 'o' is the offset within that unit
454 *
455 * The term "lane" comes from the hardware term "byte-lane" which
456 */
457
458#define FbLaneCase1(n,a,o) ((n) == 0x01 ? \
459 (*(CARD8 *) ((a)+FbPatternOffset(o,CARD8)) = \
460 fgxor) : 0)
461#define FbLaneCase2(n,a,o) ((n) == 0x03 ? \
462 (*(CARD16 *) ((a)+FbPatternOffset(o,CARD16)) = \
463 fgxor) : \
464 ((void)FbLaneCase1((n)&1,a,o), \
465 FbLaneCase1((n)>>1,a,(o)+1)))
466#define FbLaneCase4(n,a,o) ((n) == 0x0f ? \
467 (*(CARD32 *) ((a)+FbPatternOffset(o,CARD32)) = \
468 fgxor) : \
469 ((void)FbLaneCase2((n)&3,a,o), \
470 FbLaneCase2((n)>>2,a,(o)+2)))
471#define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (*(FbBits *) ((a)+(o)) = fgxor) : \
472 ((void)FbLaneCase4((n)&15,a,o), \
473 FbLaneCase4((n)>>4,a,(o)+4)))
474
475#if FB_SHIFT == 6
476#define FbLaneCase(n,a) FbLaneCase8(n,(CARD8 *) (a),0)
477#endif
478
479#if FB_SHIFT == 5
480#define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0)
481#endif
482
483/* Rotate a filled pixel value to the specified alignement */
484#define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b)))
485#define FbRot24Stip(p,b) (FbStipRight(p,b) | FbStipLeft(p,24-(b)))
486
487/* step a filled pixel value to the next/previous FB_UNIT alignment */
488#define FbNext24Pix(p) (FbRot24(p,(24-FB_UNIT%24)))
489#define FbPrev24Pix(p) (FbRot24(p,FB_UNIT%24))
490#define FbNext24Stip(p) (FbRot24(p,(24-FB_STIP_UNIT%24)))
491#define FbPrev24Stip(p) (FbRot24(p,FB_STIP_UNIT%24))
492
493/* step a rotation value to the next/previous rotation value */
494#if FB_UNIT == 64
495#define FbNext24Rot(r) ((r) == 16 ? 0 : (r) + 8)
496#define FbPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8)
497
498#if IMAGE_BYTE_ORDER == MSBFirst
499#define FbFirst24Rot(x) (((x) + 8) % 24)
500#else
501#define FbFirst24Rot(x) ((x) % 24)
502#endif
503
504#endif
505
506#if FB_UNIT == 32
507#define FbNext24Rot(r) ((r) == 0 ? 16 : (r) - 8)
508#define FbPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8)
509
510#if IMAGE_BYTE_ORDER == MSBFirst
511#define FbFirst24Rot(x) (((x) + 16) % 24)
512#else
513#define FbFirst24Rot(x) ((x) % 24)
514#endif
515#endif
516
517#define FbNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8)
518#define FbPrev24RotStip(r) ((r) == 16 ? 0 : (r) + 8)
519
520/* Whether 24-bit specific code is needed for this filled pixel value */
521#define FbCheck24Pix(p) ((p) == FbNext24Pix(p))
522
523/* Macros for dealing with dashing */
524
525#define FbDashDeclare \
526 unsigned char *__dash, *__firstDash, *__lastDash
527
528#define FbDashInit(pGC,pPriv,dashOffset,dashlen,even) { \
529 (even) = TRUE; \
530 __firstDash = (pGC)->dash; \
531 __lastDash = __firstDash + (pGC)->numInDashList; \
532 (dashOffset) %= (pPriv)->dashLength; \
533 \
534 __dash = __firstDash; \
535 while ((dashOffset) >= ((dashlen) = *__dash)) \
536 { \
537 (dashOffset) -= (dashlen); \
538 (even) = 1-(even); \
539 if (++__dash == __lastDash) \
540 __dash = __firstDash; \
541 } \
542 (dashlen) -= (dashOffset); \
543}
544
545#define FbDashNext(dashlen) { \
546 if (++__dash == __lastDash) \
547 __dash = __firstDash; \
548 (dashlen) = *__dash; \
549}
550
551/* as numInDashList is always even, this case can skip a test */
552
553#define FbDashNextEven(dashlen) { \
554 (dashlen) = *++__dash; \
555}
556
557#define FbDashNextOdd(dashlen) FbDashNext(dashlen)
558
559#define FbDashStep(dashlen,even) { \
560 if (!--(dashlen)) { \
561 FbDashNext(dashlen); \
562 (even) = 1-(even); \
563 } \
564}
565
566/* XXX fb*PrivateIndex should be static, but it breaks the ABI */
567
568extern int fbGCPrivateIndex;
569extern int fbGetGCPrivateIndex(void);
570#ifndef FB_NO_WINDOW_PIXMAPS
571extern int fbWinPrivateIndex;
572extern int fbGetWinPrivateIndex(void);
573#endif
574extern const GCOps fbGCOps;
575extern const GCFuncs fbGCFuncs;
576
577#ifdef TEKX11
578#define FB_OLD_GC
579#define FB_OLD_SCREEN
580#endif
581
582#ifdef FB_OLD_SCREEN
583# define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */
584extern WindowPtr *WindowTable;
585#endif
586
587#ifdef FB_24_32BIT
588#define FB_SCREEN_PRIVATE
589#endif
590
591#ifdef FB_SCREEN_PRIVATE
592extern int fbScreenPrivateIndex;
593extern int fbGetScreenPrivateIndex(void);
594
595/* private field of a screen */
596typedef struct {
597 unsigned char win32bpp; /* window bpp for 32-bpp images */
598 unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
599} FbScreenPrivRec, *FbScreenPrivPtr;
600
601#define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
602 (pScreen)->devPrivates[fbGetScreenPrivateIndex()].ptr)
603#endif
604
605/* private field of GC */
606typedef struct {
607#ifdef FB_OLD_GC
608 unsigned char pad1;
609 unsigned char pad2;
610 unsigned char pad3;
611 unsigned fExpose:1;
612 unsigned freeCompClip:1;
613 PixmapPtr pRotatedPixmap;
614 RegionPtr pCompositeClip;
615#endif
616 FbBits and, xor; /* reduced rop values */
617 FbBits bgand, bgxor; /* for stipples */
618 FbBits fg, bg, pm; /* expanded and filled */
619 unsigned int dashLength; /* total of all dash elements */
620 unsigned char oneRect; /* clip list is single rectangle */
621 unsigned char evenStipple; /* stipple is even */
622 unsigned char bpp; /* current drawable bpp */
623} FbGCPrivRec, *FbGCPrivPtr;
624
625#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
626 (pGC)->devPrivates[fbGetGCPrivateIndex()].ptr)
627
628#ifdef FB_OLD_GC
629#define fbGetCompositeClip(pGC) (fbGetGCPrivate(pGC)->pCompositeClip)
630#define fbGetExpose(pGC) (fbGetGCPrivate(pGC)->fExpose)
631#define fbGetFreeCompClip(pGC) (fbGetGCPrivate(pGC)->freeCompClip)
632#define fbGetRotatedPixmap(pGC) (fbGetGCPrivate(pGC)->pRotatedPixmap)
633#else
634#define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
635#define fbGetExpose(pGC) ((pGC)->fExpose)
636#define fbGetFreeCompClip(pGC) ((pGC)->freeCompClip)
637#define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap)
638#endif
639
640#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
641#ifdef FB_NO_WINDOW_PIXMAPS
642#define fbGetWindowPixmap(d) fbGetScreenPixmap(((DrawablePtr) (d))->pScreen)
643#else
644#define fbGetWindowPixmap(pWin) ((PixmapPtr)\
645 ((WindowPtr) (pWin))->devPrivates[fbGetWinPrivateIndex()].ptr)
646#endif
647
648#ifdef ROOTLESS
649#define __fbPixDrawableX(pPix) ((pPix)->drawable.x)
650#define __fbPixDrawableY(pPix) ((pPix)->drawable.y)
651#else
652#define __fbPixDrawableX(pPix) 0
653#define __fbPixDrawableY(pPix) 0
654#endif
655
656#ifdef COMPOSITE
657#define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix) - (pPix)->screen_x)
658#define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix) - (pPix)->screen_y)
659#else
660#define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix))
661#define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix))
662#endif
663#define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix))
664#define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix))
665
666#define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
667 PixmapPtr _pPix; \
668 if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
669 _pPix = fbGetWindowPixmap(pDrawable); \
670 (xoff) = __fbPixOffXWin(_pPix); \
671 (yoff) = __fbPixOffYWin(_pPix); \
672 } else { \
673 _pPix = (PixmapPtr) (pDrawable); \
674 (xoff) = __fbPixOffXPix(_pPix); \
675 (yoff) = __fbPixOffYPix(_pPix); \
676 } \
677 (pointer) = (FbBits *) _pPix->devPrivate.ptr; \
678 (stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \
679 (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
680}
681
682#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
683 PixmapPtr _pPix; \
684 if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
685 _pPix = fbGetWindowPixmap(pDrawable); \
686 (xoff) = __fbPixOffXWin(_pPix); \
687 (yoff) = __fbPixOffYWin(_pPix); \
688 } else { \
689 _pPix = (PixmapPtr) (pDrawable); \
690 (xoff) = __fbPixOffXPix(_pPix); \
691 (yoff) = __fbPixOffYPix(_pPix); \
692 } \
693 (pointer) = (FbStip *) _pPix->devPrivate.ptr; \
694 (stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \
695 (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
696}
697
698/*
699 * XFree86 empties the root BorderClip when the VT is inactive,
700 * here's a macro which uses that to disable GetImage and GetSpans
701 */
702
703#define fbWindowEnabled(pWin) \
704 REGION_NOTEMPTY((pWin)->drawable.pScreen, \
705 &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip)
706
707#define fbDrawableEnabled(pDrawable) \
708 ((pDrawable)->type == DRAWABLE_PIXMAP ? \
709 TRUE : fbWindowEnabled((WindowPtr) pDrawable))
710
711#ifdef FB_OLD_SCREEN
712#define BitsPerPixel(d) (\
713 ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
714 (PixmapWidthPaddingInfo[d].padRoundUp+1)))
715#endif
716
717#define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0)
718/*
719 * Accelerated tiles are power of 2 width <= FB_UNIT
720 */
721#define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w))
722/*
723 * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp
724 * with dstBpp a power of 2 as well
725 */
726#define FbEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp))
727
728/*
729 * fb24_32.c
730 */
731void
732fb24_32GetSpans(DrawablePtr pDrawable,
733 int wMax,
734 DDXPointPtr ppt,
735 int *pwidth,
736 int nspans,
737 char *pchardstStart);
738
739void
740fb24_32SetSpans (DrawablePtr pDrawable,
741 GCPtr pGC,
742 char *src,
743 DDXPointPtr ppt,
744 int *pwidth,
745 int nspans,
746 int fSorted);
747
748void
749fb24_32PutZImage (DrawablePtr pDrawable,
750 RegionPtr pClip,
751 int alu,
752 FbBits pm,
753 int x,
754 int y,
755 int width,
756 int height,
757 CARD8 *src,
758 FbStride srcStride);
759
760void
761fb24_32GetImage (DrawablePtr pDrawable,
762 int x,
763 int y,
764 int w,
765 int h,
766 unsigned int format,
767 unsigned long planeMask,
768 char *d);
769
770void
771fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
772 DrawablePtr pDstDrawable,
773 GCPtr pGC,
774 BoxPtr pbox,
775 int nbox,
776 int dx,
777 int dy,
778 Bool reverse,
779 Bool upsidedown,
780 Pixel bitplane,
781 void *closure);
782
783PixmapPtr
784fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
785
786Bool
787fb24_32CreateScreenResources(ScreenPtr pScreen);
788
789Bool
790fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
791 int width,
792 int height,
793 int depth,
794 int bitsPerPixel,
795 int devKind,
796 pointer pPixData);
797
798/*
799 * fballpriv.c
800 */
801Bool
802fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex);
803
804/*
805 * fbarc.c
806 */
807
808void
809fbPolyArc (DrawablePtr pDrawable,
810 GCPtr pGC,
811 int narcs,
812 xArc *parcs);
813
814/*
815 * fbbits.c
816 */
817
818void
819fbBresSolid8(DrawablePtr pDrawable,
820 GCPtr pGC,
821 int dashOffset,
822 int signdx,
823 int signdy,
824 int axis,
825 int x,
826 int y,
827 int e,
828 int e1,
829 int e3,
830 int len);
831
832void
833fbBresDash8 (DrawablePtr pDrawable,
834 GCPtr pGC,
835 int dashOffset,
836 int signdx,
837 int signdy,
838 int axis,
839 int x,
840 int y,
841 int e,
842 int e1,
843 int e3,
844 int len);
845
846void
847fbDots8 (FbBits *dst,
848 FbStride dstStride,
849 int dstBpp,
850 BoxPtr pBox,
851 xPoint *pts,
852 int npt,
853 int xorg,
854 int yorg,
855 int xoff,
856 int yoff,
857 FbBits and,
858 FbBits xor);
859
860void
861fbArc8 (FbBits *dst,
862 FbStride dstStride,
863 int dstBpp,
864 xArc *arc,
865 int dx,
866 int dy,
867 FbBits and,
868 FbBits xor);
869
870void
871fbGlyph8 (FbBits *dstLine,
872 FbStride dstStride,
873 int dstBpp,
874 FbStip *stipple,
875 FbBits fg,
876 int height,
877 int shift);
878
879void
880fbPolyline8 (DrawablePtr pDrawable,
881 GCPtr pGC,
882 int mode,
883 int npt,
884 DDXPointPtr ptsOrig);
885
886void
887fbPolySegment8 (DrawablePtr pDrawable,
888 GCPtr pGC,
889 int nseg,
890 xSegment *pseg);
891
892void
893fbBresSolid16(DrawablePtr pDrawable,
894 GCPtr pGC,
895 int dashOffset,
896 int signdx,
897 int signdy,
898 int axis,
899 int x,
900 int y,
901 int e,
902 int e1,
903 int e3,
904 int len);
905
906void
907fbBresDash16(DrawablePtr pDrawable,
908 GCPtr pGC,
909 int dashOffset,
910 int signdx,
911 int signdy,
912 int axis,
913 int x,
914 int y,
915 int e,
916 int e1,
917 int e3,
918 int len);
919
920void
921fbDots16(FbBits *dst,
922 FbStride dstStride,
923 int dstBpp,
924 BoxPtr pBox,
925 xPoint *pts,
926 int npt,
927 int xorg,
928 int yorg,
929 int xoff,
930 int yoff,
931 FbBits and,
932 FbBits xor);
933
934void
935fbArc16(FbBits *dst,
936 FbStride dstStride,
937 int dstBpp,
938 xArc *arc,
939 int dx,
940 int dy,
941 FbBits and,
942 FbBits xor);
943
944void
945fbGlyph16(FbBits *dstLine,
946 FbStride dstStride,
947 int dstBpp,
948 FbStip *stipple,
949 FbBits fg,
950 int height,
951 int shift);
952
953void
954fbPolyline16 (DrawablePtr pDrawable,
955 GCPtr pGC,
956 int mode,
957 int npt,
958 DDXPointPtr ptsOrig);
959
960void
961fbPolySegment16 (DrawablePtr pDrawable,
962 GCPtr pGC,
963 int nseg,
964 xSegment *pseg);
965
966
967void
968fbBresSolid24(DrawablePtr pDrawable,
969 GCPtr pGC,
970 int dashOffset,
971 int signdx,
972 int signdy,
973 int axis,
974 int x,
975 int y,
976 int e,
977 int e1,
978 int e3,
979 int len);
980
981void
982fbBresDash24(DrawablePtr pDrawable,
983 GCPtr pGC,
984 int dashOffset,
985 int signdx,
986 int signdy,
987 int axis,
988 int x,
989 int y,
990 int e,
991 int e1,
992 int e3,
993 int len);
994
995void
996fbDots24(FbBits *dst,
997 FbStride dstStride,
998 int dstBpp,
999 BoxPtr pBox,
1000 xPoint *pts,
1001 int npt,
1002 int xorg,
1003 int yorg,
1004 int xoff,
1005 int yoff,
1006 FbBits and,
1007 FbBits xor);
1008
1009void
1010fbArc24(FbBits *dst,
1011 FbStride dstStride,
1012 int dstBpp,
1013 xArc *arc,
1014 int dx,
1015 int dy,
1016 FbBits and,
1017 FbBits xor);
1018
1019void
1020fbGlyph24(FbBits *dstLine,
1021 FbStride dstStride,
1022 int dstBpp,
1023 FbStip *stipple,
1024 FbBits fg,
1025 int height,
1026 int shift);
1027
1028void
1029fbPolyline24 (DrawablePtr pDrawable,
1030 GCPtr pGC,
1031 int mode,
1032 int npt,
1033 DDXPointPtr ptsOrig);
1034
1035void
1036fbPolySegment24 (DrawablePtr pDrawable,
1037 GCPtr pGC,
1038 int nseg,
1039 xSegment *pseg);
1040
1041
1042void
1043fbBresSolid32(DrawablePtr pDrawable,
1044 GCPtr pGC,
1045 int dashOffset,
1046 int signdx,
1047 int signdy,
1048 int axis,
1049 int x,
1050 int y,
1051 int e,
1052 int e1,
1053 int e3,
1054 int len);
1055
1056void
1057fbBresDash32(DrawablePtr pDrawable,
1058 GCPtr pGC,
1059 int dashOffset,
1060 int signdx,
1061 int signdy,
1062 int axis,
1063 int x,
1064 int y,
1065 int e,
1066 int e1,
1067 int e3,
1068 int len);
1069
1070void
1071fbDots32(FbBits *dst,
1072 FbStride dstStride,
1073 int dstBpp,
1074 BoxPtr pBox,
1075 xPoint *pts,
1076 int npt,
1077 int xorg,
1078 int yorg,
1079 int xoff,
1080 int yoff,
1081 FbBits and,
1082 FbBits xor);
1083
1084void
1085fbArc32(FbBits *dst,
1086 FbStride dstStride,
1087 int dstBpp,
1088 xArc *arc,
1089 int dx,
1090 int dy,
1091 FbBits and,
1092 FbBits xor);
1093
1094void
1095fbGlyph32(FbBits *dstLine,
1096 FbStride dstStride,
1097 int dstBpp,
1098 FbStip *stipple,
1099 FbBits fg,
1100 int height,
1101 int shift);
1102void
1103fbPolyline32 (DrawablePtr pDrawable,
1104 GCPtr pGC,
1105 int mode,
1106 int npt,
1107 DDXPointPtr ptsOrig);
1108
1109void
1110fbPolySegment32 (DrawablePtr pDrawable,
1111 GCPtr pGC,
1112 int nseg,
1113 xSegment *pseg);
1114
1115/*
1116 * fbblt.c
1117 */
1118void
1119fbBlt (FbBits *src,
1120 FbStride srcStride,
1121 int srcX,
1122
1123 FbBits *dst,
1124 FbStride dstStride,
1125 int dstX,
1126
1127 int width,
1128 int height,
1129
1130 int alu,
1131 FbBits pm,
1132 int bpp,
1133
1134 Bool reverse,
1135 Bool upsidedown);
1136
1137void
1138fbBlt24 (FbBits *srcLine,
1139 FbStride srcStride,
1140 int srcX,
1141
1142 FbBits *dstLine,
1143 FbStride dstStride,
1144 int dstX,
1145
1146 int width,
1147 int height,
1148
1149 int alu,
1150 FbBits pm,
1151
1152 Bool reverse,
1153 Bool upsidedown);
1154
1155void
1156fbBltStip (FbStip *src,
1157 FbStride srcStride, /* in FbStip units, not FbBits units */
1158 int srcX,
1159
1160 FbStip *dst,
1161 FbStride dstStride, /* in FbStip units, not FbBits units */
1162 int dstX,
1163
1164 int width,
1165 int height,
1166
1167 int alu,
1168 FbBits pm,
1169 int bpp);
1170
1171/*
1172 * fbbltone.c
1173 */
1174void
1175fbBltOne (FbStip *src,
1176 FbStride srcStride,
1177 int srcX,
1178 FbBits *dst,
1179 FbStride dstStride,
1180 int dstX,
1181 int dstBpp,
1182
1183 int width,
1184 int height,
1185
1186 FbBits fgand,
1187 FbBits fbxor,
1188 FbBits bgand,
1189 FbBits bgxor);
1190
1191#ifdef FB_24BIT
1192void
1193fbBltOne24 (FbStip *src,
1194 FbStride srcStride, /* FbStip units per scanline */
1195 int srcX, /* bit position of source */
1196 FbBits *dst,
1197 FbStride dstStride, /* FbBits units per scanline */
1198 int dstX, /* bit position of dest */
1199 int dstBpp, /* bits per destination unit */
1200
1201 int width, /* width in bits of destination */
1202 int height, /* height in scanlines */
1203
1204 FbBits fgand, /* rrop values */
1205 FbBits fgxor,
1206 FbBits bgand,
1207 FbBits bgxor);
1208#endif
1209
1210void
1211fbBltPlane (FbBits *src,
1212 FbStride srcStride,
1213 int srcX,
1214 int srcBpp,
1215
1216 FbStip *dst,
1217 FbStride dstStride,
1218 int dstX,
1219
1220 int width,
1221 int height,
1222
1223 FbStip fgand,
1224 FbStip fgxor,
1225 FbStip bgand,
1226 FbStip bgxor,
1227 Pixel planeMask);
1228
1229/*
1230 * fbbstore.c
1231 */
1232void
1233fbSaveAreas(PixmapPtr pPixmap,
1234 RegionPtr prgnSave,
1235 int xorg,
1236 int yorg,
1237 WindowPtr pWin);
1238
1239void
1240fbRestoreAreas(PixmapPtr pPixmap,
1241 RegionPtr prgnRestore,
1242 int xorg,
1243 int yorg,
1244 WindowPtr pWin);
1245
1246/*
1247 * fbcmap.c
1248 */
1249int
1250fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
1251
1252void
1253fbInstallColormap(ColormapPtr pmap);
1254
1255void
1256fbUninstallColormap(ColormapPtr pmap);
1257
1258void
1259fbResolveColor(unsigned short *pred,
1260 unsigned short *pgreen,
1261 unsigned short *pblue,
1262 VisualPtr pVisual);
1263
1264Bool
1265fbInitializeColormap(ColormapPtr pmap);
1266
1267int
1268fbExpandDirectColors (ColormapPtr pmap,
1269 int ndef,
1270 xColorItem *indefs,
1271 xColorItem *outdefs);
1272
1273Bool
1274fbCreateDefColormap(ScreenPtr pScreen);
1275
1276void
1277fbClearVisualTypes(void);
1278
1279Bool
1280fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);
1281
1282Bool
1283fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
1284 Pixel redMask, Pixel greenMask, Pixel blueMask);
1285
1286Bool
1287fbInitVisuals (VisualPtr *visualp,
1288 DepthPtr *depthp,
1289 int *nvisualp,
1290 int *ndepthp,
1291 int *rootDepthp,
1292 VisualID *defaultVisp,
1293 unsigned long sizes,
1294 int bitsPerRGB);
1295
1296/*
1297 * fbcopy.c
1298 */
1299
1300typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
1301 DrawablePtr pDstDrawable,
1302 GCPtr pGC,
1303 BoxPtr pDstBox,
1304 int nbox,
1305 int dx,
1306 int dy,
1307 Bool reverse,
1308 Bool upsidedown,
1309 Pixel bitplane,
1310 void *closure);
1311
1312void
1313fbCopyNtoN (DrawablePtr pSrcDrawable,
1314 DrawablePtr pDstDrawable,
1315 GCPtr pGC,
1316 BoxPtr pbox,
1317 int nbox,
1318 int dx,
1319 int dy,
1320 Bool reverse,
1321 Bool upsidedown,
1322 Pixel bitplane,
1323 void *closure);
1324
1325void
1326fbCopy1toN (DrawablePtr pSrcDrawable,
1327 DrawablePtr pDstDrawable,
1328 GCPtr pGC,
1329 BoxPtr pbox,
1330 int nbox,
1331 int dx,
1332 int dy,
1333 Bool reverse,
1334 Bool upsidedown,
1335 Pixel bitplane,
1336 void *closure);
1337
1338void
1339fbCopyNto1 (DrawablePtr pSrcDrawable,
1340 DrawablePtr pDstDrawable,
1341 GCPtr pGC,
1342 BoxPtr pbox,
1343 int nbox,
1344 int dx,
1345 int dy,
1346 Bool reverse,
1347 Bool upsidedown,
1348 Pixel bitplane,
1349 void *closure);
1350
1351void
1352fbCopyRegion (DrawablePtr pSrcDrawable,
1353 DrawablePtr pDstDrawable,
1354 GCPtr pGC,
1355 RegionPtr pDstRegion,
1356 int dx,
1357 int dy,
1358 fbCopyProc copyProc,
1359 Pixel bitPlane,
1360 void *closure);
1361
1362RegionPtr
1363fbDoCopy (DrawablePtr pSrcDrawable,
1364 DrawablePtr pDstDrawable,
1365 GCPtr pGC,
1366 int xIn,
1367 int yIn,
1368 int widthSrc,
1369 int heightSrc,
1370 int xOut,
1371 int yOut,
1372 fbCopyProc copyProc,
1373 Pixel bitplane,
1374 void *closure);
1375
1376RegionPtr
1377fbCopyArea (DrawablePtr pSrcDrawable,
1378 DrawablePtr pDstDrawable,
1379 GCPtr pGC,
1380 int xIn,
1381 int yIn,
1382 int widthSrc,
1383 int heightSrc,
1384 int xOut,
1385 int yOut);
1386
1387RegionPtr
1388fbCopyPlane (DrawablePtr pSrcDrawable,
1389 DrawablePtr pDstDrawable,
1390 GCPtr pGC,
1391 int xIn,
1392 int yIn,
1393 int widthSrc,
1394 int heightSrc,
1395 int xOut,
1396 int yOut,
1397 unsigned long bitplane);
1398
1399/*
1400 * fbfill.c
1401 */
1402void
1403fbFill (DrawablePtr pDrawable,
1404 GCPtr pGC,
1405 int x,
1406 int y,
1407 int width,
1408 int height);
1409
1410void
1411fbSolidBoxClipped (DrawablePtr pDrawable,
1412 RegionPtr pClip,
1413 int xa,
1414 int ya,
1415 int xb,
1416 int yb,
1417 FbBits and,
1418 FbBits xor);
1419
1420/*
1421 * fbfillrect.c
1422 */
1423void
1424fbPolyFillRect(DrawablePtr pDrawable,
1425 GCPtr pGC,
1426 int nrectInit,
1427 xRectangle *prectInit);
1428
1429#define fbPolyFillArc miPolyFillArc
1430
1431#define fbFillPolygon miFillPolygon
1432
1433/*
1434 * fbfillsp.c
1435 */
1436void
1437fbFillSpans (DrawablePtr pDrawable,
1438 GCPtr pGC,
1439 int nInit,
1440 DDXPointPtr pptInit,
1441 int *pwidthInit,
1442 int fSorted);
1443
1444
1445/*
1446 * fbgc.c
1447 */
1448
1449Bool
1450fbCreateGC(GCPtr pGC);
1451
1452void
1453fbPadPixmap (PixmapPtr pPixmap);
1454
1455void
1456fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
1457
1458/*
1459 * fbgetsp.c
1460 */
1461void
1462fbGetSpans(DrawablePtr pDrawable,
1463 int wMax,
1464 DDXPointPtr ppt,
1465 int *pwidth,
1466 int nspans,
1467 char *pchardstStart);
1468
1469/*
1470 * fbglyph.c
1471 */
1472
1473Bool
1474fbGlyphIn (RegionPtr pRegion,
1475 int x,
1476 int y,
1477 int width,
1478 int height);
1479
1480void
1481fbPolyGlyphBlt (DrawablePtr pDrawable,
1482 GCPtr pGC,
1483 int x,
1484 int y,
1485 unsigned int nglyph,
1486 CharInfoPtr *ppci,
1487 pointer pglyphBase);
1488
1489void
1490fbImageGlyphBlt (DrawablePtr pDrawable,
1491 GCPtr pGC,
1492 int x,
1493 int y,
1494 unsigned int nglyph,
1495 CharInfoPtr *ppci,
1496 pointer pglyphBase);
1497
1498/*
1499 * fbimage.c
1500 */
1501
1502void
1503fbPutImage (DrawablePtr pDrawable,
1504 GCPtr pGC,
1505 int depth,
1506 int x,
1507 int y,
1508 int w,
1509 int h,
1510 int leftPad,
1511 int format,
1512 char *pImage);
1513
1514void
1515fbPutZImage (DrawablePtr pDrawable,
1516 RegionPtr pClip,
1517 int alu,
1518 FbBits pm,
1519 int x,
1520 int y,
1521 int width,
1522 int height,
1523 FbStip *src,
1524 FbStride srcStride);
1525
1526void
1527fbPutXYImage (DrawablePtr pDrawable,
1528 RegionPtr pClip,
1529 FbBits fg,
1530 FbBits bg,
1531 FbBits pm,
1532 int alu,
1533 Bool opaque,
1534
1535 int x,
1536 int y,
1537 int width,
1538 int height,
1539
1540 FbStip *src,
1541 FbStride srcStride,
1542 int srcX);
1543
1544void
1545fbGetImage (DrawablePtr pDrawable,
1546 int x,
1547 int y,
1548 int w,
1549 int h,
1550 unsigned int format,
1551 unsigned long planeMask,
1552 char *d);
1553/*
1554 * fbline.c
1555 */
1556
1557void
1558fbZeroLine (DrawablePtr pDrawable,
1559 GCPtr pGC,
1560 int mode,
1561 int npt,
1562 DDXPointPtr ppt);
1563
1564void
1565fbZeroSegment (DrawablePtr pDrawable,
1566 GCPtr pGC,
1567 int nseg,
1568 xSegment *pSegs);
1569
1570void
1571fbPolyLine (DrawablePtr pDrawable,
1572 GCPtr pGC,
1573 int mode,
1574 int npt,
1575 DDXPointPtr ppt);
1576
1577void
1578fbFixCoordModePrevious (int npt,
1579 DDXPointPtr ppt);
1580
1581void
1582fbPolySegment (DrawablePtr pDrawable,
1583 GCPtr pGC,
1584 int nseg,
1585 xSegment *pseg);
1586
1587#define fbPolyRectangle miPolyRectangle
1588
1589/*
1590 * fbpict.c
1591 */
1592
1593Bool
1594fbPictureInit (ScreenPtr pScreen,
1595 PictFormatPtr formats,
1596 int nformats);
1597
1598/*
1599 * fbpixmap.c
1600 */
1601
1602PixmapPtr
1603fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp);
1604
1605PixmapPtr
1606fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth);
1607
1608Bool
1609fbDestroyPixmap (PixmapPtr pPixmap);
1610
1611RegionPtr
1612fbPixmapToRegion(PixmapPtr pPix);
1613
1614/*
1615 * fbpoint.c
1616 */
1617
1618void
1619fbDots (FbBits *dstOrig,
1620 FbStride dstStride,
1621 int dstBpp,
1622 BoxPtr pBox,
1623 xPoint *pts,
1624 int npt,
1625 int xorg,
1626 int yorg,
1627 int xoff,
1628 int yoff,
1629 FbBits andOrig,
1630 FbBits xorOrig);
1631
1632void
1633fbPolyPoint (DrawablePtr pDrawable,
1634 GCPtr pGC,
1635 int mode,
1636 int npt,
1637 xPoint *pptInit);
1638
1639/*
1640 * fbpush.c
1641 */
1642void
1643fbPushPattern (DrawablePtr pDrawable,
1644 GCPtr pGC,
1645
1646 FbStip *src,
1647 FbStride srcStride,
1648 int srcX,
1649
1650 int x,
1651 int y,
1652
1653 int width,
1654 int height);
1655
1656void
1657fbPushFill (DrawablePtr pDrawable,
1658 GCPtr pGC,
1659
1660 FbStip *src,
1661 FbStride srcStride,
1662 int srcX,
1663
1664 int x,
1665 int y,
1666 int width,
1667 int height);
1668
1669void
1670fbPush1toN (DrawablePtr pSrcDrawable,
1671 DrawablePtr pDstDrawable,
1672 GCPtr pGC,
1673 BoxPtr pbox,
1674 int nbox,
1675 int dx,
1676 int dy,
1677 Bool reverse,
1678 Bool upsidedown,
1679 Pixel bitplane,
1680 void *closure);
1681
1682void
1683fbPushImage (DrawablePtr pDrawable,
1684 GCPtr pGC,
1685
1686 FbStip *src,
1687 FbStride srcStride,
1688 int srcX,
1689
1690 int x,
1691 int y,
1692 int width,
1693 int height);
1694
1695void
1696fbPushPixels (GCPtr pGC,
1697 PixmapPtr pBitmap,
1698 DrawablePtr pDrawable,
1699 int dx,
1700 int dy,
1701 int xOrg,
1702 int yOrg);
1703
1704
1705/*
1706 * fbscreen.c
1707 */
1708
1709Bool
1710fbCloseScreen (int indx, ScreenPtr pScreen);
1711
1712Bool
1713fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
1714
1715Bool
1716fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
1717
1718void
1719fbQueryBestSize (int class,
1720 unsigned short *width, unsigned short *height,
1721 ScreenPtr pScreen);
1722
1723#ifndef FB_OLD_SCREEN
1724PixmapPtr
1725_fbGetWindowPixmap (WindowPtr pWindow);
1726
1727void
1728_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap);
1729#endif
1730
1731Bool
1732fbSetupScreen(ScreenPtr pScreen,
1733 pointer pbits, /* pointer to screen bitmap */
1734 int xsize, /* in pixels */
1735 int ysize,
1736 int dpix, /* dots per inch */
1737 int dpiy,
1738 int width, /* pixel width of frame buffer */
1739 int bpp); /* bits per pixel of frame buffer */
1740
1741Bool
1742fbFinishScreenInit(ScreenPtr pScreen,
1743 pointer pbits,
1744 int xsize,
1745 int ysize,
1746 int dpix,
1747 int dpiy,
1748 int width,
1749 int bpp);
1750
1751Bool
1752fbScreenInit(ScreenPtr pScreen,
1753 pointer pbits,
1754 int xsize,
1755 int ysize,
1756 int dpix,
1757 int dpiy,
1758 int width,
1759 int bpp);
1760
1761void
1762fbInitializeBackingStore (ScreenPtr pScreen);
1763
1764/*
1765 * fbseg.c
1766 */
1767typedef void FbBres (DrawablePtr pDrawable,
1768 GCPtr pGC,
1769 int dashOffset,
1770 int signdx,
1771 int signdy,
1772 int axis,
1773 int x,
1774 int y,
1775 int e,
1776 int e1,
1777 int e3,
1778 int len);
1779
1780FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash;
1781/*
1782 * fbsetsp.c
1783 */
1784
1785void
1786fbSetSpans (DrawablePtr pDrawable,
1787 GCPtr pGC,
1788 char *src,
1789 DDXPointPtr ppt,
1790 int *pwidth,
1791 int nspans,
1792 int fSorted);
1793
1794FbBres *
1795fbSelectBres (DrawablePtr pDrawable,
1796 GCPtr pGC);
1797
1798void
1799fbBres (DrawablePtr pDrawable,
1800 GCPtr pGC,
1801 int dashOffset,
1802 int signdx,
1803 int signdy,
1804 int axis,
1805 int x,
1806 int y,
1807 int e,
1808 int e1,
1809 int e3,
1810 int len);
1811
1812void
1813fbSegment (DrawablePtr pDrawable,
1814 GCPtr pGC,
1815 int xa,
1816 int ya,
1817 int xb,
1818 int yb,
1819 Bool drawLast,
1820 int *dashOffset);
1821
1822
1823/*
1824 * fbsolid.c
1825 */
1826
1827void
1828fbSolid (FbBits *dst,
1829 FbStride dstStride,
1830 int dstX,
1831 int bpp,
1832
1833 int width,
1834 int height,
1835
1836 FbBits and,
1837 FbBits xor);
1838
1839#ifdef FB_24BIT
1840void
1841fbSolid24 (FbBits *dst,
1842 FbStride dstStride,
1843 int dstX,
1844
1845 int width,
1846 int height,
1847
1848 FbBits and,
1849 FbBits xor);
1850#endif
1851
1852/*
1853 * fbstipple.c
1854 */
1855
1856void
1857fbTransparentSpan (FbBits *dst,
1858 FbBits stip,
1859 FbBits fgxor,
1860 int n);
1861
1862void
1863fbEvenStipple (FbBits *dst,
1864 FbStride dstStride,
1865 int dstX,
1866 int dstBpp,
1867
1868 int width,
1869 int height,
1870
1871 FbStip *stip,
1872 FbStride stipStride,
1873 int stipHeight,
1874
1875 FbBits fgand,
1876 FbBits fgxor,
1877 FbBits bgand,
1878 FbBits bgxor,
1879
1880 int xRot,
1881 int yRot);
1882
1883void
1884fbOddStipple (FbBits *dst,
1885 FbStride dstStride,
1886 int dstX,
1887 int dstBpp,
1888
1889 int width,
1890 int height,
1891
1892 FbStip *stip,
1893 FbStride stipStride,
1894 int stipWidth,
1895 int stipHeight,
1896
1897 FbBits fgand,
1898 FbBits fgxor,
1899 FbBits bgand,
1900 FbBits bgxor,
1901
1902 int xRot,
1903 int yRot);
1904
1905void
1906fbStipple (FbBits *dst,
1907 FbStride dstStride,
1908 int dstX,
1909 int dstBpp,
1910
1911 int width,
1912 int height,
1913
1914 FbStip *stip,
1915 FbStride stipStride,
1916 int stipWidth,
1917 int stipHeight,
1918 Bool even,
1919
1920 FbBits fgand,
1921 FbBits fgxor,
1922 FbBits bgand,
1923 FbBits bgxor,
1924
1925 int xRot,
1926 int yRot);
1927
1928/*
1929 * fbtile.c
1930 */
1931
1932void
1933fbEvenTile (FbBits *dst,
1934 FbStride dstStride,
1935 int dstX,
1936
1937 int width,
1938 int height,
1939
1940 FbBits *tile,
1941 int tileHeight,
1942
1943 int alu,
1944 FbBits pm,
1945 int xRot,
1946 int yRot);
1947
1948void
1949fbOddTile (FbBits *dst,
1950 FbStride dstStride,
1951 int dstX,
1952
1953 int width,
1954 int height,
1955
1956 FbBits *tile,
1957 FbStride tileStride,
1958 int tileWidth,
1959 int tileHeight,
1960
1961 int alu,
1962 FbBits pm,
1963 int bpp,
1964
1965 int xRot,
1966 int yRot);
1967
1968void
1969fbTile (FbBits *dst,
1970 FbStride dstStride,
1971 int dstX,
1972
1973 int width,
1974 int height,
1975
1976 FbBits *tile,
1977 FbStride tileStride,
1978 int tileWidth,
1979 int tileHeight,
1980
1981 int alu,
1982 FbBits pm,
1983 int bpp,
1984
1985 int xRot,
1986 int yRot);
1987
1988/*
1989 * fbutil.c
1990 */
1991FbBits
1992fbReplicatePixel (Pixel p, int bpp);
1993
1994void
1995fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
1996
1997/*
1998 * fbwindow.c
1999 */
2000
2001Bool
2002fbCreateWindow(WindowPtr pWin);
2003
2004Bool
2005fbDestroyWindow(WindowPtr pWin);
2006
2007Bool
2008fbMapWindow(WindowPtr pWindow);
2009
2010Bool
2011fbPositionWindow(WindowPtr pWin, int x, int y);
2012
2013Bool
2014fbUnmapWindow(WindowPtr pWindow);
2015
2016void
2017fbCopyWindowProc (DrawablePtr pSrcDrawable,
2018 DrawablePtr pDstDrawable,
2019 GCPtr pGC,
2020 BoxPtr pbox,
2021 int nbox,
2022 int dx,
2023 int dy,
2024 Bool reverse,
2025 Bool upsidedown,
2026 Pixel bitplane,
2027 void *closure);
2028
2029void
2030fbCopyWindow(WindowPtr pWin,
2031 DDXPointRec ptOldOrg,
2032 RegionPtr prgnSrc);
2033
2034Bool
2035fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
2036
2037void
2038fbFillRegionSolid (DrawablePtr pDrawable,
2039 RegionPtr pRegion,
2040 FbBits and,
2041 FbBits xor);
2042
2043void
2044fbFillRegionTiled (DrawablePtr pDrawable,
2045 RegionPtr pRegion,
2046 PixmapPtr pTile);
2047
2048void
2049fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
2050
2051
2052#endif /* _FB_H_ */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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