VirtualBox

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

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

fix OSE

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

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