VirtualBox

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

最後變更 在這個檔案從81245是 43251,由 vboxsync 提交於 12 年 前

Additions/x11: added headers for X.Org Server 1.13.

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

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