VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.6.99-20090831/fb.h@ 40349

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

export Xorg 1.6.99 headers to OSE

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

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