VirtualBox

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

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

Additions/x11: added a full header set for X.Org server 1.5 and 1.6

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