VirtualBox

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

Last change on this file since 32915 was 17471, checked in by vboxsync, 16 years ago

export to OSE

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