VirtualBox

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

Last change on this file since 81043 was 43272, checked in by vboxsync, 12 years ago

Additions/x11: more original X server headers.

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

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