VirtualBox

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

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

Additions/xorg: support X.Org Server 1.12.

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

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