VirtualBox

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

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

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

  • 屬性 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 oneRect; /* clip list is single rectangle */
670 unsigned char evenStipple; /* stipple is even */
671 unsigned char bpp; /* current drawable bpp */
672} FbGCPrivRec, *FbGCPrivPtr;
673
674#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
675 dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey()))
676
677#define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
678#define fbGetExpose(pGC) ((pGC)->fExpose)
679#define fbGetFreeCompClip(pGC) ((pGC)->freeCompClip)
680#define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap)
681
682#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
683#define fbGetWindowPixmap(pWin) ((PixmapPtr)\
684 dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey()))
685
686#ifdef ROOTLESS
687#define __fbPixDrawableX(pPix) ((pPix)->drawable.x)
688#define __fbPixDrawableY(pPix) ((pPix)->drawable.y)
689#else
690#define __fbPixDrawableX(pPix) 0
691#define __fbPixDrawableY(pPix) 0
692#endif
693
694#ifdef COMPOSITE
695#define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix) - (pPix)->screen_x)
696#define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix) - (pPix)->screen_y)
697#else
698#define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix))
699#define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix))
700#endif
701#define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix))
702#define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix))
703
704#define fbGetDrawablePixmap(pDrawable, pixmap, xoff, yoff) { \
705 if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
706 (pixmap) = fbGetWindowPixmap(pDrawable); \
707 (xoff) = __fbPixOffXWin(pixmap); \
708 (yoff) = __fbPixOffYWin(pixmap); \
709 } else { \
710 (pixmap) = (PixmapPtr) (pDrawable); \
711 (xoff) = __fbPixOffXPix(pixmap); \
712 (yoff) = __fbPixOffYPix(pixmap); \
713 } \
714 fbPrepareAccess(pDrawable); \
715}
716
717#define fbGetPixmapBitsData(pixmap, pointer, stride, bpp) { \
718 (pointer) = (FbBits *) (pixmap)->devPrivate.ptr; \
719 (stride) = ((int) (pixmap)->devKind) / sizeof (FbBits); (void)(stride); \
720 (bpp) = (pixmap)->drawable.bitsPerPixel; (void)(bpp); \
721}
722
723#define fbGetPixmapStipData(pixmap, pointer, stride, bpp) { \
724 (pointer) = (FbStip *) (pixmap)->devPrivate.ptr; \
725 (stride) = ((int) (pixmap)->devKind) / sizeof (FbStip); (void)(stride); \
726 (bpp) = (pixmap)->drawable.bitsPerPixel; (void)(bpp); \
727}
728
729#define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
730 PixmapPtr _pPix; \
731 fbGetDrawablePixmap(pDrawable, _pPix, xoff, yoff); \
732 fbGetPixmapBitsData(_pPix, pointer, stride, bpp); \
733}
734
735#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
736 PixmapPtr _pPix; \
737 fbGetDrawablePixmap(pDrawable, _pPix, xoff, yoff); \
738 fbGetPixmapStipData(_pPix, pointer, stride, bpp); \
739}
740
741/*
742 * XFree86 empties the root BorderClip when the VT is inactive,
743 * here's a macro which uses that to disable GetImage and GetSpans
744 */
745
746#define fbWindowEnabled(pWin) \
747 RegionNotEmpty(&(pWin)->drawable.pScreen->root->borderClip)
748
749#define fbDrawableEnabled(pDrawable) \
750 ((pDrawable)->type == DRAWABLE_PIXMAP ? \
751 TRUE : fbWindowEnabled((WindowPtr) pDrawable))
752
753#define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0)
754/*
755 * Accelerated tiles are power of 2 width <= FB_UNIT
756 */
757#define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w))
758/*
759 * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp
760 * with dstBpp a power of 2 as well
761 */
762#define FbEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp))
763
764/*
765 * fb24_32.c
766 */
767extern _X_EXPORT void
768fb24_32GetSpans(DrawablePtr pDrawable,
769 int wMax,
770 DDXPointPtr ppt,
771 int *pwidth,
772 int nspans,
773 char *pchardstStart);
774
775extern _X_EXPORT void
776fb24_32SetSpans (DrawablePtr pDrawable,
777 GCPtr pGC,
778 char *src,
779 DDXPointPtr ppt,
780 int *pwidth,
781 int nspans,
782 int fSorted);
783
784extern _X_EXPORT void
785fb24_32PutZImage (DrawablePtr pDrawable,
786 RegionPtr pClip,
787 int alu,
788 FbBits pm,
789 int x,
790 int y,
791 int width,
792 int height,
793 CARD8 *src,
794 FbStride srcStride);
795
796extern _X_EXPORT void
797fb24_32GetImage (DrawablePtr pDrawable,
798 int x,
799 int y,
800 int w,
801 int h,
802 unsigned int format,
803 unsigned long planeMask,
804 char *d);
805
806extern _X_EXPORT void
807fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
808 DrawablePtr pDstDrawable,
809 GCPtr pGC,
810 BoxPtr pbox,
811 int nbox,
812 int dx,
813 int dy,
814 Bool reverse,
815 Bool upsidedown,
816 Pixel bitplane,
817 void *closure);
818
819extern _X_EXPORT PixmapPtr
820fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
821
822extern _X_EXPORT Bool
823fb24_32CreateScreenResources(ScreenPtr pScreen);
824
825extern _X_EXPORT Bool
826fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
827 int width,
828 int height,
829 int depth,
830 int bitsPerPixel,
831 int devKind,
832 pointer pPixData);
833
834/*
835 * fballpriv.c
836 */
837extern _X_EXPORT Bool
838fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex);
839
840/*
841 * fbarc.c
842 */
843
844extern _X_EXPORT void
845fbPolyArc (DrawablePtr pDrawable,
846 GCPtr pGC,
847 int narcs,
848 xArc *parcs);
849
850/*
851 * fbbits.c
852 */
853
854extern _X_EXPORT void
855fbBresSolid8(DrawablePtr pDrawable,
856 GCPtr pGC,
857 int dashOffset,
858 int signdx,
859 int signdy,
860 int axis,
861 int x,
862 int y,
863 int e,
864 int e1,
865 int e3,
866 int len);
867
868extern _X_EXPORT void
869fbBresDash8 (DrawablePtr pDrawable,
870 GCPtr pGC,
871 int dashOffset,
872 int signdx,
873 int signdy,
874 int axis,
875 int x,
876 int y,
877 int e,
878 int e1,
879 int e3,
880 int len);
881
882extern _X_EXPORT void
883fbDots8 (FbBits *dst,
884 FbStride dstStride,
885 int dstBpp,
886 BoxPtr pBox,
887 xPoint *pts,
888 int npt,
889 int xorg,
890 int yorg,
891 int xoff,
892 int yoff,
893 FbBits and,
894 FbBits xor);
895
896extern _X_EXPORT void
897fbArc8 (FbBits *dst,
898 FbStride dstStride,
899 int dstBpp,
900 xArc *arc,
901 int dx,
902 int dy,
903 FbBits and,
904 FbBits xor);
905
906extern _X_EXPORT void
907fbGlyph8 (FbBits *dstLine,
908 FbStride dstStride,
909 int dstBpp,
910 FbStip *stipple,
911 FbBits fg,
912 int height,
913 int shift);
914
915extern _X_EXPORT void
916fbPolyline8 (DrawablePtr pDrawable,
917 GCPtr pGC,
918 int mode,
919 int npt,
920 DDXPointPtr ptsOrig);
921
922extern _X_EXPORT void
923fbPolySegment8 (DrawablePtr pDrawable,
924 GCPtr pGC,
925 int nseg,
926 xSegment *pseg);
927
928extern _X_EXPORT void
929fbBresSolid16(DrawablePtr pDrawable,
930 GCPtr pGC,
931 int dashOffset,
932 int signdx,
933 int signdy,
934 int axis,
935 int x,
936 int y,
937 int e,
938 int e1,
939 int e3,
940 int len);
941
942extern _X_EXPORT void
943fbBresDash16(DrawablePtr pDrawable,
944 GCPtr pGC,
945 int dashOffset,
946 int signdx,
947 int signdy,
948 int axis,
949 int x,
950 int y,
951 int e,
952 int e1,
953 int e3,
954 int len);
955
956extern _X_EXPORT void
957fbDots16(FbBits *dst,
958 FbStride dstStride,
959 int dstBpp,
960 BoxPtr pBox,
961 xPoint *pts,
962 int npt,
963 int xorg,
964 int yorg,
965 int xoff,
966 int yoff,
967 FbBits and,
968 FbBits xor);
969
970extern _X_EXPORT void
971fbArc16(FbBits *dst,
972 FbStride dstStride,
973 int dstBpp,
974 xArc *arc,
975 int dx,
976 int dy,
977 FbBits and,
978 FbBits xor);
979
980extern _X_EXPORT void
981fbGlyph16(FbBits *dstLine,
982 FbStride dstStride,
983 int dstBpp,
984 FbStip *stipple,
985 FbBits fg,
986 int height,
987 int shift);
988
989extern _X_EXPORT void
990fbPolyline16 (DrawablePtr pDrawable,
991 GCPtr pGC,
992 int mode,
993 int npt,
994 DDXPointPtr ptsOrig);
995
996extern _X_EXPORT void
997fbPolySegment16 (DrawablePtr pDrawable,
998 GCPtr pGC,
999 int nseg,
1000 xSegment *pseg);
1001
1002
1003extern _X_EXPORT void
1004fbBresSolid24(DrawablePtr pDrawable,
1005 GCPtr pGC,
1006 int dashOffset,
1007 int signdx,
1008 int signdy,
1009 int axis,
1010 int x,
1011 int y,
1012 int e,
1013 int e1,
1014 int e3,
1015 int len);
1016
1017extern _X_EXPORT void
1018fbBresDash24(DrawablePtr pDrawable,
1019 GCPtr pGC,
1020 int dashOffset,
1021 int signdx,
1022 int signdy,
1023 int axis,
1024 int x,
1025 int y,
1026 int e,
1027 int e1,
1028 int e3,
1029 int len);
1030
1031extern _X_EXPORT void
1032fbDots24(FbBits *dst,
1033 FbStride dstStride,
1034 int dstBpp,
1035 BoxPtr pBox,
1036 xPoint *pts,
1037 int npt,
1038 int xorg,
1039 int yorg,
1040 int xoff,
1041 int yoff,
1042 FbBits and,
1043 FbBits xor);
1044
1045extern _X_EXPORT void
1046fbArc24(FbBits *dst,
1047 FbStride dstStride,
1048 int dstBpp,
1049 xArc *arc,
1050 int dx,
1051 int dy,
1052 FbBits and,
1053 FbBits xor);
1054
1055extern _X_EXPORT void
1056fbGlyph24(FbBits *dstLine,
1057 FbStride dstStride,
1058 int dstBpp,
1059 FbStip *stipple,
1060 FbBits fg,
1061 int height,
1062 int shift);
1063
1064extern _X_EXPORT void
1065fbPolyline24 (DrawablePtr pDrawable,
1066 GCPtr pGC,
1067 int mode,
1068 int npt,
1069 DDXPointPtr ptsOrig);
1070
1071extern _X_EXPORT void
1072fbPolySegment24 (DrawablePtr pDrawable,
1073 GCPtr pGC,
1074 int nseg,
1075 xSegment *pseg);
1076
1077
1078extern _X_EXPORT void
1079fbBresSolid32(DrawablePtr pDrawable,
1080 GCPtr pGC,
1081 int dashOffset,
1082 int signdx,
1083 int signdy,
1084 int axis,
1085 int x,
1086 int y,
1087 int e,
1088 int e1,
1089 int e3,
1090 int len);
1091
1092extern _X_EXPORT void
1093fbBresDash32(DrawablePtr pDrawable,
1094 GCPtr pGC,
1095 int dashOffset,
1096 int signdx,
1097 int signdy,
1098 int axis,
1099 int x,
1100 int y,
1101 int e,
1102 int e1,
1103 int e3,
1104 int len);
1105
1106extern _X_EXPORT void
1107fbDots32(FbBits *dst,
1108 FbStride dstStride,
1109 int dstBpp,
1110 BoxPtr pBox,
1111 xPoint *pts,
1112 int npt,
1113 int xorg,
1114 int yorg,
1115 int xoff,
1116 int yoff,
1117 FbBits and,
1118 FbBits xor);
1119
1120extern _X_EXPORT void
1121fbArc32(FbBits *dst,
1122 FbStride dstStride,
1123 int dstBpp,
1124 xArc *arc,
1125 int dx,
1126 int dy,
1127 FbBits and,
1128 FbBits xor);
1129
1130extern _X_EXPORT void
1131fbGlyph32(FbBits *dstLine,
1132 FbStride dstStride,
1133 int dstBpp,
1134 FbStip *stipple,
1135 FbBits fg,
1136 int height,
1137 int shift);
1138extern _X_EXPORT void
1139fbPolyline32 (DrawablePtr pDrawable,
1140 GCPtr pGC,
1141 int mode,
1142 int npt,
1143 DDXPointPtr ptsOrig);
1144
1145extern _X_EXPORT void
1146fbPolySegment32 (DrawablePtr pDrawable,
1147 GCPtr pGC,
1148 int nseg,
1149 xSegment *pseg);
1150
1151/*
1152 * fbblt.c
1153 */
1154extern _X_EXPORT void
1155fbBlt (FbBits *src,
1156 FbStride srcStride,
1157 int srcX,
1158
1159 FbBits *dst,
1160 FbStride dstStride,
1161 int dstX,
1162
1163 int width,
1164 int height,
1165
1166 int alu,
1167 FbBits pm,
1168 int bpp,
1169
1170 Bool reverse,
1171 Bool upsidedown);
1172
1173extern _X_EXPORT void
1174fbBlt24 (FbBits *srcLine,
1175 FbStride srcStride,
1176 int srcX,
1177
1178 FbBits *dstLine,
1179 FbStride dstStride,
1180 int dstX,
1181
1182 int width,
1183 int height,
1184
1185 int alu,
1186 FbBits pm,
1187
1188 Bool reverse,
1189 Bool upsidedown);
1190
1191extern _X_EXPORT void
1192fbBltStip (FbStip *src,
1193 FbStride srcStride, /* in FbStip units, not FbBits units */
1194 int srcX,
1195
1196 FbStip *dst,
1197 FbStride dstStride, /* in FbStip units, not FbBits units */
1198 int dstX,
1199
1200 int width,
1201 int height,
1202
1203 int alu,
1204 FbBits pm,
1205 int bpp);
1206
1207/*
1208 * fbbltone.c
1209 */
1210extern _X_EXPORT void
1211fbBltOne (FbStip *src,
1212 FbStride srcStride,
1213 int srcX,
1214 FbBits *dst,
1215 FbStride dstStride,
1216 int dstX,
1217 int dstBpp,
1218
1219 int width,
1220 int height,
1221
1222 FbBits fgand,
1223 FbBits fbxor,
1224 FbBits bgand,
1225 FbBits bgxor);
1226
1227#ifdef FB_24BIT
1228extern _X_EXPORT void
1229fbBltOne24 (FbStip *src,
1230 FbStride srcStride, /* FbStip units per scanline */
1231 int srcX, /* bit position of source */
1232 FbBits *dst,
1233 FbStride dstStride, /* FbBits units per scanline */
1234 int dstX, /* bit position of dest */
1235 int dstBpp, /* bits per destination unit */
1236
1237 int width, /* width in bits of destination */
1238 int height, /* height in scanlines */
1239
1240 FbBits fgand, /* rrop values */
1241 FbBits fgxor,
1242 FbBits bgand,
1243 FbBits bgxor);
1244#endif
1245
1246extern _X_EXPORT void
1247fbBltPlane (FbBits *src,
1248 FbStride srcStride,
1249 int srcX,
1250 int srcBpp,
1251
1252 FbStip *dst,
1253 FbStride dstStride,
1254 int dstX,
1255
1256 int width,
1257 int height,
1258
1259 FbStip fgand,
1260 FbStip fgxor,
1261 FbStip bgand,
1262 FbStip bgxor,
1263 Pixel planeMask);
1264
1265/*
1266 * fbcmap.c
1267 */
1268extern _X_EXPORT int
1269fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
1270
1271extern _X_EXPORT void
1272fbInstallColormap(ColormapPtr pmap);
1273
1274extern _X_EXPORT void
1275fbUninstallColormap(ColormapPtr pmap);
1276
1277extern _X_EXPORT void
1278fbResolveColor(unsigned short *pred,
1279 unsigned short *pgreen,
1280 unsigned short *pblue,
1281 VisualPtr pVisual);
1282
1283extern _X_EXPORT Bool
1284fbInitializeColormap(ColormapPtr pmap);
1285
1286extern _X_EXPORT int
1287fbExpandDirectColors (ColormapPtr pmap,
1288 int ndef,
1289 xColorItem *indefs,
1290 xColorItem *outdefs);
1291
1292extern _X_EXPORT Bool
1293fbCreateDefColormap(ScreenPtr pScreen);
1294
1295extern _X_EXPORT void
1296fbClearVisualTypes(void);
1297
1298extern _X_EXPORT Bool
1299fbHasVisualTypes (int depth);
1300
1301extern _X_EXPORT Bool
1302fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);
1303
1304extern _X_EXPORT Bool
1305fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
1306 Pixel redMask, Pixel greenMask, Pixel blueMask);
1307
1308extern _X_EXPORT Bool
1309fbInitVisuals (VisualPtr *visualp,
1310 DepthPtr *depthp,
1311 int *nvisualp,
1312 int *ndepthp,
1313 int *rootDepthp,
1314 VisualID *defaultVisp,
1315 unsigned long sizes,
1316 int bitsPerRGB);
1317
1318/*
1319 * fbcopy.c
1320 */
1321
1322/* Compatibility definition, to be removed at next ABI change. */
1323typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
1324 DrawablePtr pDstDrawable,
1325 GCPtr pGC,
1326 BoxPtr pDstBox,
1327 int nbox,
1328 int dx,
1329 int dy,
1330 Bool reverse,
1331 Bool upsidedown,
1332 Pixel bitplane,
1333 void *closure);
1334
1335extern _X_EXPORT void
1336fbCopyNtoN (DrawablePtr pSrcDrawable,
1337 DrawablePtr pDstDrawable,
1338 GCPtr pGC,
1339 BoxPtr pbox,
1340 int nbox,
1341 int dx,
1342 int dy,
1343 Bool reverse,
1344 Bool upsidedown,
1345 Pixel bitplane,
1346 void *closure);
1347
1348/* Compatibility wrapper, to be removed at next ABI change. */
1349extern _X_EXPORT void
1350fbCopyRegion (DrawablePtr pSrcDrawable,
1351 DrawablePtr pDstDrawable,
1352 GCPtr pGC,
1353 RegionPtr pDstRegion,
1354 int dx,
1355 int dy,
1356 fbCopyProc copyProc,
1357 Pixel bitPlane,
1358 void *closure);
1359
1360/* Compatibility wrapper, to be removed at next ABI change. */
1361extern _X_EXPORT RegionPtr
1362fbDoCopy (DrawablePtr pSrcDrawable,
1363 DrawablePtr pDstDrawable,
1364 GCPtr pGC,
1365 int xIn,
1366 int yIn,
1367 int widthSrc,
1368 int heightSrc,
1369 int xOut,
1370 int yOut,
1371 fbCopyProc copyProc,
1372 Pixel bitplane,
1373 void *closure);
1374
1375extern _X_EXPORT void
1376fbCopy1toN (DrawablePtr pSrcDrawable,
1377 DrawablePtr pDstDrawable,
1378 GCPtr pGC,
1379 BoxPtr pbox,
1380 int nbox,
1381 int dx,
1382 int dy,
1383 Bool reverse,
1384 Bool upsidedown,
1385 Pixel bitplane,
1386 void *closure);
1387
1388extern _X_EXPORT void
1389fbCopyNto1 (DrawablePtr pSrcDrawable,
1390 DrawablePtr pDstDrawable,
1391 GCPtr pGC,
1392 BoxPtr pbox,
1393 int nbox,
1394 int dx,
1395 int dy,
1396 Bool reverse,
1397 Bool upsidedown,
1398 Pixel bitplane,
1399 void *closure);
1400
1401extern _X_EXPORT RegionPtr
1402fbCopyArea (DrawablePtr pSrcDrawable,
1403 DrawablePtr pDstDrawable,
1404 GCPtr pGC,
1405 int xIn,
1406 int yIn,
1407 int widthSrc,
1408 int heightSrc,
1409 int xOut,
1410 int yOut);
1411
1412extern _X_EXPORT RegionPtr
1413fbCopyPlane (DrawablePtr pSrcDrawable,
1414 DrawablePtr pDstDrawable,
1415 GCPtr pGC,
1416 int xIn,
1417 int yIn,
1418 int widthSrc,
1419 int heightSrc,
1420 int xOut,
1421 int yOut,
1422 unsigned long bitplane);
1423
1424/*
1425 * fbfill.c
1426 */
1427extern _X_EXPORT void
1428fbFill (DrawablePtr pDrawable,
1429 GCPtr pGC,
1430 int x,
1431 int y,
1432 int width,
1433 int height);
1434
1435extern _X_EXPORT void
1436fbSolidBoxClipped (DrawablePtr pDrawable,
1437 RegionPtr pClip,
1438 int xa,
1439 int ya,
1440 int xb,
1441 int yb,
1442 FbBits and,
1443 FbBits xor);
1444
1445/*
1446 * fbfillrect.c
1447 */
1448extern _X_EXPORT void
1449fbPolyFillRect(DrawablePtr pDrawable,
1450 GCPtr pGC,
1451 int nrectInit,
1452 xRectangle *prectInit);
1453
1454#define fbPolyFillArc miPolyFillArc
1455
1456#define fbFillPolygon miFillPolygon
1457
1458/*
1459 * fbfillsp.c
1460 */
1461extern _X_EXPORT void
1462fbFillSpans (DrawablePtr pDrawable,
1463 GCPtr pGC,
1464 int nInit,
1465 DDXPointPtr pptInit,
1466 int *pwidthInit,
1467 int fSorted);
1468
1469
1470/*
1471 * fbgc.c
1472 */
1473
1474extern _X_EXPORT Bool
1475fbCreateGC(GCPtr pGC);
1476
1477extern _X_EXPORT void
1478fbPadPixmap (PixmapPtr pPixmap);
1479
1480extern _X_EXPORT void
1481fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
1482
1483/*
1484 * fbgetsp.c
1485 */
1486extern _X_EXPORT void
1487fbGetSpans(DrawablePtr pDrawable,
1488 int wMax,
1489 DDXPointPtr ppt,
1490 int *pwidth,
1491 int nspans,
1492 char *pchardstStart);
1493
1494/*
1495 * fbglyph.c
1496 */
1497
1498extern _X_EXPORT Bool
1499fbGlyphIn (RegionPtr pRegion,
1500 int x,
1501 int y,
1502 int width,
1503 int height);
1504
1505extern _X_EXPORT void
1506fbPolyGlyphBlt (DrawablePtr pDrawable,
1507 GCPtr pGC,
1508 int x,
1509 int y,
1510 unsigned int nglyph,
1511 CharInfoPtr *ppci,
1512 pointer pglyphBase);
1513
1514extern _X_EXPORT void
1515fbImageGlyphBlt (DrawablePtr pDrawable,
1516 GCPtr pGC,
1517 int x,
1518 int y,
1519 unsigned int nglyph,
1520 CharInfoPtr *ppci,
1521 pointer pglyphBase);
1522
1523/*
1524 * fbimage.c
1525 */
1526
1527extern _X_EXPORT void
1528fbPutImage (DrawablePtr pDrawable,
1529 GCPtr pGC,
1530 int depth,
1531 int x,
1532 int y,
1533 int w,
1534 int h,
1535 int leftPad,
1536 int format,
1537 char *pImage);
1538
1539extern _X_EXPORT void
1540fbPutZImage (DrawablePtr pDrawable,
1541 RegionPtr pClip,
1542 int alu,
1543 FbBits pm,
1544 int x,
1545 int y,
1546 int width,
1547 int height,
1548 FbStip *src,
1549 FbStride srcStride);
1550
1551extern _X_EXPORT void
1552fbPutXYImage (DrawablePtr pDrawable,
1553 RegionPtr pClip,
1554 FbBits fg,
1555 FbBits bg,
1556 FbBits pm,
1557 int alu,
1558 Bool opaque,
1559
1560 int x,
1561 int y,
1562 int width,
1563 int height,
1564
1565 FbStip *src,
1566 FbStride srcStride,
1567 int srcX);
1568
1569extern _X_EXPORT void
1570fbGetImage (DrawablePtr pDrawable,
1571 int x,
1572 int y,
1573 int w,
1574 int h,
1575 unsigned int format,
1576 unsigned long planeMask,
1577 char *d);
1578/*
1579 * fbline.c
1580 */
1581
1582extern _X_EXPORT void
1583fbZeroLine (DrawablePtr pDrawable,
1584 GCPtr pGC,
1585 int mode,
1586 int npt,
1587 DDXPointPtr ppt);
1588
1589extern _X_EXPORT void
1590fbZeroSegment (DrawablePtr pDrawable,
1591 GCPtr pGC,
1592 int nseg,
1593 xSegment *pSegs);
1594
1595extern _X_EXPORT void
1596fbPolyLine (DrawablePtr pDrawable,
1597 GCPtr pGC,
1598 int mode,
1599 int npt,
1600 DDXPointPtr ppt);
1601
1602extern _X_EXPORT void
1603fbFixCoordModePrevious (int npt,
1604 DDXPointPtr ppt);
1605
1606extern _X_EXPORT void
1607fbPolySegment (DrawablePtr pDrawable,
1608 GCPtr pGC,
1609 int nseg,
1610 xSegment *pseg);
1611
1612#define fbPolyRectangle miPolyRectangle
1613
1614/*
1615 * fbpict.c
1616 */
1617
1618extern _X_EXPORT Bool
1619fbPictureInit (ScreenPtr pScreen,
1620 PictFormatPtr formats,
1621 int nformats);
1622
1623/*
1624 * fbpixmap.c
1625 */
1626
1627extern _X_EXPORT PixmapPtr
1628fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
1629 unsigned usage_hint);
1630
1631extern _X_EXPORT PixmapPtr
1632fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
1633 unsigned usage_hint);
1634
1635extern _X_EXPORT Bool
1636fbDestroyPixmap (PixmapPtr pPixmap);
1637
1638extern _X_EXPORT RegionPtr
1639fbPixmapToRegion(PixmapPtr pPix);
1640
1641/*
1642 * fbpoint.c
1643 */
1644
1645extern _X_EXPORT void
1646fbDots (FbBits *dstOrig,
1647 FbStride dstStride,
1648 int dstBpp,
1649 BoxPtr pBox,
1650 xPoint *pts,
1651 int npt,
1652 int xorg,
1653 int yorg,
1654 int xoff,
1655 int yoff,
1656 FbBits andOrig,
1657 FbBits xorOrig);
1658
1659extern _X_EXPORT void
1660fbPolyPoint (DrawablePtr pDrawable,
1661 GCPtr pGC,
1662 int mode,
1663 int npt,
1664 xPoint *pptInit);
1665
1666/*
1667 * fbpush.c
1668 */
1669extern _X_EXPORT void
1670fbPushPattern (DrawablePtr pDrawable,
1671 GCPtr pGC,
1672
1673 FbStip *src,
1674 FbStride srcStride,
1675 int srcX,
1676
1677 int x,
1678 int y,
1679
1680 int width,
1681 int height);
1682
1683extern _X_EXPORT void
1684fbPushFill (DrawablePtr pDrawable,
1685 GCPtr pGC,
1686
1687 FbStip *src,
1688 FbStride srcStride,
1689 int srcX,
1690
1691 int x,
1692 int y,
1693 int width,
1694 int height);
1695
1696extern _X_EXPORT void
1697fbPushImage (DrawablePtr pDrawable,
1698 GCPtr pGC,
1699
1700 FbStip *src,
1701 FbStride srcStride,
1702 int srcX,
1703
1704 int x,
1705 int y,
1706 int width,
1707 int height);
1708
1709extern _X_EXPORT void
1710fbPushPixels (GCPtr pGC,
1711 PixmapPtr pBitmap,
1712 DrawablePtr pDrawable,
1713 int dx,
1714 int dy,
1715 int xOrg,
1716 int yOrg);
1717
1718
1719/*
1720 * fbscreen.c
1721 */
1722
1723extern _X_EXPORT Bool
1724fbCloseScreen (int indx, ScreenPtr pScreen);
1725
1726extern _X_EXPORT Bool
1727fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
1728
1729extern _X_EXPORT Bool
1730fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
1731
1732extern _X_EXPORT void
1733fbQueryBestSize (int class,
1734 unsigned short *width, unsigned short *height,
1735 ScreenPtr pScreen);
1736
1737extern _X_EXPORT PixmapPtr
1738_fbGetWindowPixmap (WindowPtr pWindow);
1739
1740extern _X_EXPORT void
1741_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap);
1742
1743extern _X_EXPORT Bool
1744fbSetupScreen(ScreenPtr pScreen,
1745 pointer pbits, /* pointer to screen bitmap */
1746 int xsize, /* in pixels */
1747 int ysize,
1748 int dpix, /* dots per inch */
1749 int dpiy,
1750 int width, /* pixel width of frame buffer */
1751 int bpp); /* bits per pixel of frame buffer */
1752
1753extern _X_EXPORT Bool
1754wfbFinishScreenInit(ScreenPtr pScreen,
1755 pointer pbits,
1756 int xsize,
1757 int ysize,
1758 int dpix,
1759 int dpiy,
1760 int width,
1761 int bpp,
1762 SetupWrapProcPtr setupWrap,
1763 FinishWrapProcPtr finishWrap);
1764
1765extern _X_EXPORT Bool
1766wfbScreenInit(ScreenPtr pScreen,
1767 pointer pbits,
1768 int xsize,
1769 int ysize,
1770 int dpix,
1771 int dpiy,
1772 int width,
1773 int bpp,
1774 SetupWrapProcPtr setupWrap,
1775 FinishWrapProcPtr finishWrap);
1776
1777extern _X_EXPORT Bool
1778fbFinishScreenInit(ScreenPtr pScreen,
1779 pointer pbits,
1780 int xsize,
1781 int ysize,
1782 int dpix,
1783 int dpiy,
1784 int width,
1785 int bpp);
1786
1787extern _X_EXPORT Bool
1788fbScreenInit(ScreenPtr pScreen,
1789 pointer pbits,
1790 int xsize,
1791 int ysize,
1792 int dpix,
1793 int dpiy,
1794 int width,
1795 int bpp);
1796
1797/*
1798 * fbseg.c
1799 */
1800typedef void FbBres (DrawablePtr pDrawable,
1801 GCPtr pGC,
1802 int dashOffset,
1803 int signdx,
1804 int signdy,
1805 int axis,
1806 int x,
1807 int y,
1808 int e,
1809 int e1,
1810 int e3,
1811 int len);
1812
1813extern _X_EXPORT FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash;
1814/*
1815 * fbsetsp.c
1816 */
1817
1818extern _X_EXPORT void
1819fbSetSpans (DrawablePtr pDrawable,
1820 GCPtr pGC,
1821 char *src,
1822 DDXPointPtr ppt,
1823 int *pwidth,
1824 int nspans,
1825 int fSorted);
1826
1827extern _X_EXPORT FbBres *
1828fbSelectBres (DrawablePtr pDrawable,
1829 GCPtr pGC);
1830
1831extern _X_EXPORT void
1832fbBres (DrawablePtr pDrawable,
1833 GCPtr pGC,
1834 int dashOffset,
1835 int signdx,
1836 int signdy,
1837 int axis,
1838 int x,
1839 int y,
1840 int e,
1841 int e1,
1842 int e3,
1843 int len);
1844
1845extern _X_EXPORT void
1846fbSegment (DrawablePtr pDrawable,
1847 GCPtr pGC,
1848 int xa,
1849 int ya,
1850 int xb,
1851 int yb,
1852 Bool drawLast,
1853 int *dashOffset);
1854
1855
1856/*
1857 * fbsolid.c
1858 */
1859
1860extern _X_EXPORT void
1861fbSolid (FbBits *dst,
1862 FbStride dstStride,
1863 int dstX,
1864 int bpp,
1865
1866 int width,
1867 int height,
1868
1869 FbBits and,
1870 FbBits xor);
1871
1872#ifdef FB_24BIT
1873extern _X_EXPORT void
1874fbSolid24 (FbBits *dst,
1875 FbStride dstStride,
1876 int dstX,
1877
1878 int width,
1879 int height,
1880
1881 FbBits and,
1882 FbBits xor);
1883#endif
1884
1885/*
1886 * fbstipple.c
1887 */
1888
1889extern _X_EXPORT void
1890fbTransparentSpan (FbBits *dst,
1891 FbBits stip,
1892 FbBits fgxor,
1893 int n);
1894
1895extern _X_EXPORT void
1896fbEvenStipple (FbBits *dst,
1897 FbStride dstStride,
1898 int dstX,
1899 int dstBpp,
1900
1901 int width,
1902 int height,
1903
1904 FbStip *stip,
1905 FbStride stipStride,
1906 int stipHeight,
1907
1908 FbBits fgand,
1909 FbBits fgxor,
1910 FbBits bgand,
1911 FbBits bgxor,
1912
1913 int xRot,
1914 int yRot);
1915
1916extern _X_EXPORT void
1917fbOddStipple (FbBits *dst,
1918 FbStride dstStride,
1919 int dstX,
1920 int dstBpp,
1921
1922 int width,
1923 int height,
1924
1925 FbStip *stip,
1926 FbStride stipStride,
1927 int stipWidth,
1928 int stipHeight,
1929
1930 FbBits fgand,
1931 FbBits fgxor,
1932 FbBits bgand,
1933 FbBits bgxor,
1934
1935 int xRot,
1936 int yRot);
1937
1938extern _X_EXPORT void
1939fbStipple (FbBits *dst,
1940 FbStride dstStride,
1941 int dstX,
1942 int dstBpp,
1943
1944 int width,
1945 int height,
1946
1947 FbStip *stip,
1948 FbStride stipStride,
1949 int stipWidth,
1950 int stipHeight,
1951 Bool even,
1952
1953 FbBits fgand,
1954 FbBits fgxor,
1955 FbBits bgand,
1956 FbBits bgxor,
1957
1958 int xRot,
1959 int yRot);
1960
1961/*
1962 * fbtile.c
1963 */
1964
1965extern _X_EXPORT void
1966fbEvenTile (FbBits *dst,
1967 FbStride dstStride,
1968 int dstX,
1969
1970 int width,
1971 int height,
1972
1973 FbBits *tile,
1974 FbStride tileStride,
1975 int tileHeight,
1976
1977 int alu,
1978 FbBits pm,
1979 int xRot,
1980 int yRot);
1981
1982extern _X_EXPORT void
1983fbOddTile (FbBits *dst,
1984 FbStride dstStride,
1985 int dstX,
1986
1987 int width,
1988 int height,
1989
1990 FbBits *tile,
1991 FbStride tileStride,
1992 int tileWidth,
1993 int tileHeight,
1994
1995 int alu,
1996 FbBits pm,
1997 int bpp,
1998
1999 int xRot,
2000 int yRot);
2001
2002extern _X_EXPORT void
2003fbTile (FbBits *dst,
2004 FbStride dstStride,
2005 int dstX,
2006
2007 int width,
2008 int height,
2009
2010 FbBits *tile,
2011 FbStride tileStride,
2012 int tileWidth,
2013 int tileHeight,
2014
2015 int alu,
2016 FbBits pm,
2017 int bpp,
2018
2019 int xRot,
2020 int yRot);
2021
2022/*
2023 * fbutil.c
2024 */
2025extern _X_EXPORT FbBits
2026fbReplicatePixel (Pixel p, int bpp);
2027
2028extern _X_EXPORT void
2029fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
2030
2031#ifdef FB_ACCESS_WRAPPER
2032extern _X_EXPORT ReadMemoryProcPtr wfbReadMemory;
2033extern _X_EXPORT WriteMemoryProcPtr wfbWriteMemory;
2034#endif
2035
2036/*
2037 * fbwindow.c
2038 */
2039
2040extern _X_EXPORT Bool
2041fbCreateWindow(WindowPtr pWin);
2042
2043extern _X_EXPORT Bool
2044fbDestroyWindow(WindowPtr pWin);
2045
2046extern _X_EXPORT Bool
2047fbMapWindow(WindowPtr pWindow);
2048
2049extern _X_EXPORT Bool
2050fbPositionWindow(WindowPtr pWin, int x, int y);
2051
2052extern _X_EXPORT Bool
2053fbUnmapWindow(WindowPtr pWindow);
2054
2055extern _X_EXPORT void
2056fbCopyWindowProc (DrawablePtr pSrcDrawable,
2057 DrawablePtr pDstDrawable,
2058 GCPtr pGC,
2059 BoxPtr pbox,
2060 int nbox,
2061 int dx,
2062 int dy,
2063 Bool reverse,
2064 Bool upsidedown,
2065 Pixel bitplane,
2066 void *closure);
2067
2068extern _X_EXPORT void
2069fbCopyWindow(WindowPtr pWin,
2070 DDXPointRec ptOldOrg,
2071 RegionPtr prgnSrc);
2072
2073extern _X_EXPORT Bool
2074fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
2075
2076extern _X_EXPORT void
2077fbFillRegionSolid (DrawablePtr pDrawable,
2078 RegionPtr pRegion,
2079 FbBits and,
2080 FbBits xor);
2081
2082extern _X_EXPORT pixman_image_t *
2083image_from_pict (PicturePtr pict,
2084 Bool has_clip,
2085 int *xoff,
2086 int *yoff);
2087
2088extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
2089
2090#endif /* _FB_H_ */
2091
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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