VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/1.5/xorg/afb.h@ 9233

Last change on this file since 9233 was 9233, checked in by vboxsync, 17 years ago

Additions/x11: added header files for X.org server 1.5

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 22.1 KB
Line 
1/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
2/***********************************************************
3
4Copyright (c) 1987 X Consortium
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of the X Consortium shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from the X Consortium.
26
27
28Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
29
30 All Rights Reserved
31
32Permission to use, copy, modify, and distribute this software and its
33documentation for any purpose and without fee is hereby granted,
34provided that the above copyright notice appear in all copies and that
35both that copyright notice and this permission notice appear in
36supporting documentation, and that the name of Digital not be
37used in advertising or publicity pertaining to distribution of the
38software without specific, written prior permission.
39
40DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
41ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
42DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
43ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46SOFTWARE.
47
48******************************************************************/
49/* Monochrome Frame Buffer definitions
50 written by drewry, september 1986
51*/
52
53#include "pixmap.h"
54#include "region.h"
55#include "gc.h"
56#include "colormap.h"
57#include "regionstr.h"
58#include "privates.h"
59#include "mibstore.h"
60#include "mfb.h"
61
62extern int afbInverseAlu[];
63/* warning: PixelType definition duplicated in maskbits.h */
64#ifndef PixelType
65#define PixelType CARD32
66#endif /* PixelType */
67
68#define AFB_MAX_DEPTH 8
69
70/* afbbitblt.c */
71
72extern void afbDoBitblt(
73 DrawablePtr /*pSrc*/,
74 DrawablePtr /*pDst*/,
75 int /*alu*/,
76 RegionPtr /*prgnDst*/,
77 DDXPointPtr /*pptSrc*/,
78 unsigned long /*planemask*/
79);
80
81extern RegionPtr afbCopyArea(
82 DrawablePtr /*pSrcDrawable*/,
83 DrawablePtr /*pDstDrawable*/,
84 GCPtr/*pGC*/,
85 int /*srcx*/,
86 int /*srcy*/,
87 int /*width*/,
88 int /*height*/,
89 int /*dstx*/,
90 int /*dsty*/
91);
92
93/* afbbltC.c */
94
95extern void afbDoBitbltCopy(
96 DrawablePtr /*pSrc*/,
97 DrawablePtr /*pDst*/,
98 int /*alu*/,
99 RegionPtr /*prgnDst*/,
100 DDXPointPtr /*pptSrc*/,
101 unsigned long /*planemask*/
102);
103/* afbbltCI.c */
104
105extern void afbDoBitbltCopyInverted(
106 DrawablePtr /*pSrc*/,
107 DrawablePtr /*pDst*/,
108 int /*alu*/,
109 RegionPtr /*prgnDst*/,
110 DDXPointPtr /*pptSrc*/,
111 unsigned long /*planemask*/
112);
113/* afbbltG.c */
114
115extern void afbDoBitbltGeneral(
116 DrawablePtr /*pSrc*/,
117 DrawablePtr /*pDst*/,
118 int /*alu*/,
119 RegionPtr /*prgnDst*/,
120 DDXPointPtr /*pptSrc*/,
121 unsigned long /*planemask*/
122);
123/* afbbltO.c */
124
125extern void afbDoBitbltOr(
126 DrawablePtr /*pSrc*/,
127 DrawablePtr /*pDst*/,
128 int /*alu*/,
129 RegionPtr /*prgnDst*/,
130 DDXPointPtr /*pptSrc*/,
131 unsigned long /*planemask*/
132);
133/* afbbltX.c */
134
135extern void afbDoBitbltXor(
136 DrawablePtr /*pSrc*/,
137 DrawablePtr /*pDst*/,
138 int /*alu*/,
139 RegionPtr /*prgnDst*/,
140 DDXPointPtr /*pptSrc*/,
141 unsigned long /*planemask*/
142);
143/* afbbres.c */
144
145extern void afbBresS(
146 PixelType * /*addrl*/,
147 int /*nlwidth*/,
148 int /*sizeDst*/,
149 int /*depthDst*/,
150 int /*signdx*/,
151 int /*signdy*/,
152 int /*axis*/,
153 int /*x1*/,
154 int /*y1*/,
155 int /*e*/,
156 int /*e1*/,
157 int /*e2*/,
158 int /*len*/,
159 unsigned char * /*rrops*/
160);
161/* afbbresd.c */
162
163extern void afbBresD(
164 int * /*pdashIndex*/,
165 unsigned char * /*pDash*/,
166 int /*numInDashList*/,
167 int * /*pdashOffset*/,
168 int /*isDoubleDash*/,
169 PixelType * /*addrl*/,
170 int /*nlwidth*/,
171 int /*sizeDst*/,
172 int /*depthDst*/,
173 int /*signdx*/,
174 int /*signdy*/,
175 int /*axis*/,
176 int /*x1*/,
177 int /*y1*/,
178 int /*e*/,
179 int /*e1*/,
180 int /*e2*/,
181 int /*len*/,
182 unsigned char * /*rrops*/,
183 unsigned char * /*bgrrops*/
184);
185
186/* afbclip.c */
187
188extern RegionPtr afbPixmapToRegion(
189 PixmapPtr /*pPix*/
190);
191
192/* afbcmap.c */
193
194extern int afbListInstalledColormaps(
195 ScreenPtr /*pScreen*/,
196 Colormap * /*pmaps*/
197);
198
199extern void afbInstallColormap(
200 ColormapPtr /*pmap*/
201);
202
203extern void afbUninstallColormap(
204 ColormapPtr /*pmap*/
205);
206
207extern void afbResolveColor(
208 unsigned short * /*pred*/,
209 unsigned short * /*pgreen*/,
210 unsigned short * /*pblue*/,
211 VisualPtr /*pVisual*/
212);
213
214extern Bool afbInitializeColormap(
215 ColormapPtr /*pmap*/
216);
217
218extern Bool afbInitVisuals(
219 VisualPtr * /*visualp*/,
220 DepthPtr * /*depthp*/,
221 int * /*nvisualp*/,
222 int * /*ndepthp*/,
223 int * /*rootDepthp*/,
224 VisualID * /*defaultVisp*/,
225 unsigned long /*sizes*/,
226 int /*bitsPerRGB*/
227);
228
229/* afbfillarc.c */
230
231extern void afbPolyFillArcSolid(
232 DrawablePtr /*pDraw*/,
233 GCPtr /*pGC*/,
234 int /*narcs*/,
235 xArc * /*parcs*/
236);
237/* afbfillrct.c */
238
239extern void afbPolyFillRect(
240 DrawablePtr /*pDrawable*/,
241 GCPtr /*pGC*/,
242 int /*nrectFill*/,
243 xRectangle * /*prectInit*/
244);
245
246/* afbply1rct.c */
247extern void afbFillPolygonSolid(
248 DrawablePtr /*pDrawable*/,
249 GCPtr /*pGC*/,
250 int /*mode*/,
251 int /*shape*/,
252 int /*count*/,
253 DDXPointPtr /*ptsIn*/
254);
255
256/* afbfillsp.c */
257
258extern void afbSolidFS(
259 DrawablePtr /*pDrawable*/,
260 GCPtr /*pGC*/,
261 int /*nInit*/,
262 DDXPointPtr /*pptInit*/,
263 int * /*pwidthInit*/,
264 int /*fSorted*/
265);
266
267extern void afbStippleFS(
268 DrawablePtr /*pDrawable*/,
269 GCPtr/*pGC*/,
270 int /*nInit*/,
271 DDXPointPtr /*pptInit*/,
272 int * /*pwidthInit*/,
273 int /*fSorted*/
274);
275
276extern void afbTileFS(
277 DrawablePtr /*pDrawable*/,
278 GCPtr/*pGC*/,
279 int /*nInit*/,
280 DDXPointPtr /*pptInit*/,
281 int * /*pwidthInit*/,
282 int /*fSorted*/
283);
284
285extern void afbUnnaturalTileFS(
286 DrawablePtr /*pDrawable*/,
287 GCPtr/*pGC*/,
288 int /*nInit*/,
289 DDXPointPtr /*pptInit*/,
290 int * /*pwidthInit*/,
291 int /*fSorted*/
292);
293
294extern void afbUnnaturalStippleFS(
295 DrawablePtr /*pDrawable*/,
296 GCPtr/*pGC*/,
297 int /*nInit*/,
298 DDXPointPtr /*pptInit*/,
299 int * /*pwidthInit*/,
300 int /*fSorted*/
301);
302
303extern void afbOpaqueStippleFS(
304 DrawablePtr /*pDrawable*/,
305 GCPtr/*pGC*/,
306 int /*nInit*/,
307 DDXPointPtr /*pptInit*/,
308 int * /*pwidthInit*/,
309 int /*fSorted*/
310);
311
312extern void afbUnnaturalOpaqueStippleFS(
313 DrawablePtr /*pDrawable*/,
314 GCPtr/*pGC*/,
315 int /*nInit*/,
316 DDXPointPtr /*pptInit*/,
317 int * /*pwidthInit*/,
318 int /*fSorted*/
319);
320
321/* afbfont.c */
322
323extern Bool afbRealizeFont(
324 ScreenPtr /*pscr*/,
325 FontPtr /*pFont*/
326);
327
328extern Bool afbUnrealizeFont(
329 ScreenPtr /*pscr*/,
330 FontPtr /*pFont*/
331);
332/* afbgc.c */
333
334extern Bool afbCreateGC(
335 GCPtr /*pGC*/
336);
337
338extern void afbReduceRop(
339 int /*alu*/,
340 Pixel /*src*/,
341 unsigned long /*planemask*/,
342 int /*depth*/,
343 unsigned char * /*rrops*/
344);
345
346/* afbgetsp.c */
347
348extern void afbGetSpans(
349 DrawablePtr /*pDrawable*/,
350 int /*wMax*/,
351 DDXPointPtr /*ppt*/,
352 int * /*pwidth*/,
353 int /*nspans*/,
354 char * /*pdstStart*/
355);
356/* afbhrzvert.c */
357
358extern void afbHorzS(
359 PixelType * /*addrl*/,
360 int /*nlwidth*/,
361 int /*sizeDst*/,
362 int /*depthDst*/,
363 int /*x1*/,
364 int /*y1*/,
365 int /*len*/,
366 unsigned char * /*rrops*/
367);
368
369extern void afbVertS(
370 PixelType * /*addrl*/,
371 int /*nlwidth*/,
372 int /*sizeDst*/,
373 int /*depthDst*/,
374 int /*x1*/,
375 int /*y1*/,
376 int /*len*/,
377 unsigned char * /*rrops*/
378);
379/* afbigbblak.c */
380
381extern void afbImageGlyphBlt (
382 DrawablePtr /*pDrawable*/,
383 GCPtr/*pGC*/,
384 int /*x*/,
385 int /*y*/,
386 unsigned int /*nglyph*/,
387 CharInfoPtr * /*ppci*/,
388 pointer /*pglyphBase*/
389);
390/* afbigbwht.c */
391
392/* afbimage.c */
393
394extern void afbPutImage(
395 DrawablePtr /*dst*/,
396 GCPtr /*pGC*/,
397 int /*depth*/,
398 int /*x*/,
399 int /*y*/,
400 int /*w*/,
401 int /*h*/,
402 int /*leftPad*/,
403 int /*format*/,
404 char * /*pImage*/
405);
406
407extern void afbGetImage(
408 DrawablePtr /*pDrawable*/,
409 int /*sx*/,
410 int /*sy*/,
411 int /*w*/,
412 int /*h*/,
413 unsigned int /*format*/,
414 unsigned long /*planeMask*/,
415 char * /*pdstLine*/
416);
417/* afbline.c */
418
419extern void afbLineSS(
420 DrawablePtr /*pDrawable*/,
421 GCPtr /*pGC*/,
422 int /*mode*/,
423 int /*npt*/,
424 DDXPointPtr /*pptInit*/
425);
426
427extern void afbLineSD(
428 DrawablePtr /*pDrawable*/,
429 GCPtr /*pGC*/,
430 int /*mode*/,
431 int /*npt*/,
432 DDXPointPtr /*pptInit*/
433);
434
435/* afbmisc.c */
436
437extern void afbQueryBestSize(
438 int /*class*/,
439 unsigned short * /*pwidth*/,
440 unsigned short * /*pheight*/,
441 ScreenPtr /*pScreen*/
442);
443/* afbpntarea.c */
444
445extern void afbSolidFillArea(
446 DrawablePtr /*pDraw*/,
447 int /*nbox*/,
448 BoxPtr /*pbox*/,
449 unsigned char * /*rrops*/
450);
451
452extern void afbStippleAreaPPW(
453 DrawablePtr /*pDraw*/,
454 int /*nbox*/,
455 BoxPtr /*pbox*/,
456 PixmapPtr /*pstipple*/,
457 unsigned char * /*rrops*/
458);
459extern void afbStippleArea(
460 DrawablePtr /*pDraw*/,
461 int /*nbox*/,
462 BoxPtr /*pbox*/,
463 PixmapPtr /*pstipple*/,
464 int /*xOff*/,
465 int /*yOff*/,
466 unsigned char * /*rrops*/
467);
468/* afbplygblt.c */
469
470extern void afbPolyGlyphBlt(
471 DrawablePtr /*pDrawable*/,
472 GCPtr /*pGC*/,
473 int /*x*/,
474 int /*y*/,
475 unsigned int /*nglyph*/,
476 CharInfoPtr * /*ppci*/,
477 pointer /*pglyphBase*/
478);
479
480/* afbpixmap.c */
481
482extern PixmapPtr afbCreatePixmap(
483 ScreenPtr /*pScreen*/,
484 int /*width*/,
485 int /*height*/,
486 int /*depth*/,
487 unsigned /*usage_hint*/
488);
489
490extern Bool afbDestroyPixmap(
491 PixmapPtr /*pPixmap*/
492);
493
494extern void afbXRotatePixmap(
495 PixmapPtr /*pPix*/,
496 int /*rw*/
497);
498
499extern void afbYRotatePixmap(
500 PixmapPtr /*pPix*/,
501 int /*rh*/
502);
503
504extern void afbCopyRotatePixmap(
505 PixmapPtr /*psrcPix*/,
506 PixmapPtr * /*ppdstPix*/,
507 int /*xrot*/,
508 int /*yrot*/
509);
510/* afbpolypnt.c */
511
512extern void afbPolyPoint(
513 DrawablePtr /*pDrawable*/,
514 GCPtr /*pGC*/,
515 int /*mode*/,
516 int /*npt*/,
517 xPoint * /*pptInit*/
518);
519/* afbpushpxl.c */
520
521extern void afbPushPixels(
522 GCPtr /*pGC*/,
523 PixmapPtr /*pBitMap*/,
524 DrawablePtr /*pDrawable*/,
525 int /*dx*/,
526 int /*dy*/,
527 int /*xOrg*/,
528 int /*yOrg*/
529);
530
531/* afbscrinit.c */
532
533extern Bool afbScreenInit(
534 ScreenPtr /*pScreen*/,
535 pointer /*pbits*/,
536 int /*xsize*/,
537 int /*ysize*/,
538 int /*dpix*/,
539 int /*dpiy*/,
540 int /*width*/
541);
542
543/* afbseg.c */
544
545extern void afbSegmentSS(
546 DrawablePtr /*pDrawable*/,
547 GCPtr /*pGC*/,
548 int /*nseg*/,
549 xSegment * /*pSeg*/
550);
551
552extern void afbSegmentSD(
553 DrawablePtr /*pDrawable*/,
554 GCPtr /*pGC*/,
555 int /*nseg*/,
556 xSegment * /*pSeg*/
557);
558/* afbsetsp.c */
559
560extern void afbSetSpans(
561 DrawablePtr /*pDrawable*/,
562 GCPtr /*pGC*/,
563 char * /*psrc*/,
564 DDXPointPtr /*ppt*/,
565 int * /*pwidth*/,
566 int /*nspans*/,
567 int /*fSorted*/
568);
569/* afbtegblt.c */
570
571extern void afbTEGlyphBlt(
572 DrawablePtr /*pDrawable*/,
573 GCPtr/*pGC*/,
574 int /*x*/,
575 int /*y*/,
576 unsigned int /*nglyph*/,
577 CharInfoPtr * /*ppci*/,
578 pointer /*pglyphBase*/
579);
580/* afbtileC.c */
581
582extern void afbTileAreaPPWCopy(
583 DrawablePtr /*pDraw*/,
584 int /*nbox*/,
585 BoxPtr /*pbox*/,
586 int /*alu*/,
587 PixmapPtr /*ptile*/,
588 unsigned long /*planemask*/
589);
590/* afbtileG.c */
591
592extern void afbTileAreaPPWGeneral(
593 DrawablePtr /*pDraw*/,
594 int /*nbox*/,
595 BoxPtr /*pbox*/,
596 int /*alu*/,
597 PixmapPtr /*ptile*/,
598 unsigned long /*planemask*/
599);
600
601extern void afbTileAreaCopy(
602 DrawablePtr /*pDraw*/,
603 int /*nbox*/,
604 BoxPtr /*pbox*/,
605 int /*alu*/,
606 PixmapPtr /*ptile*/,
607 int /*xOff*/,
608 int /*yOff*/,
609 unsigned long /*planemask*/
610);
611/* afbtileG.c */
612
613extern void afbTileAreaGeneral(
614 DrawablePtr /*pDraw*/,
615 int /*nbox*/,
616 BoxPtr /*pbox*/,
617 int /*alu*/,
618 PixmapPtr /*ptile*/,
619 int /*xOff*/,
620 int /*yOff*/,
621 unsigned long /*planemask*/
622);
623
624extern void afbOpaqueStippleAreaPPWCopy(
625 DrawablePtr /*pDraw*/,
626 int /*nbox*/,
627 BoxPtr /*pbox*/,
628 int /*alu*/,
629 PixmapPtr /*ptile*/,
630 unsigned char */*rropsOS*/,
631 unsigned long /*planemask*/
632);
633/* afbtileG.c */
634
635extern void afbOpaqueStippleAreaPPWGeneral(
636 DrawablePtr /*pDraw*/,
637 int /*nbox*/,
638 BoxPtr /*pbox*/,
639 int /*alu*/,
640 PixmapPtr /*ptile*/,
641 unsigned char */*rropsOS*/,
642 unsigned long /*planemask*/
643);
644
645extern void afbOpaqueStippleAreaCopy(
646 DrawablePtr /*pDraw*/,
647 int /*nbox*/,
648 BoxPtr /*pbox*/,
649 int /*alu*/,
650 PixmapPtr /*ptile*/,
651 int /*xOff*/,
652 int /*yOff*/,
653 unsigned char */*rropsOS*/,
654 unsigned long /*planemask*/
655);
656/* afbtileG.c */
657
658extern void afbOpaqueStippleAreaGeneral(
659 DrawablePtr /*pDraw*/,
660 int /*nbox*/,
661 BoxPtr /*pbox*/,
662 int /*alu*/,
663 PixmapPtr /*ptile*/,
664 int /*xOff*/,
665 int /*yOff*/,
666 unsigned char */*rropsOS*/,
667 unsigned long /*planemask*/
668);
669
670/* afbwindow.c */
671
672extern Bool afbCreateWindow(
673 WindowPtr /*pWin*/
674);
675
676extern Bool afbDestroyWindow(
677 WindowPtr /*pWin*/
678);
679
680extern Bool afbMapWindow(
681 WindowPtr /*pWindow*/
682);
683
684extern Bool afbPositionWindow(
685 WindowPtr /*pWin*/,
686 int /*x*/,
687 int /*y*/
688);
689
690extern Bool afbUnmapWindow(
691 WindowPtr /*pWindow*/
692);
693
694extern void afbCopyWindow(
695 WindowPtr /*pWin*/,
696 DDXPointRec /*ptOldOrg*/,
697 RegionPtr /*prgnSrc*/
698);
699
700extern Bool afbChangeWindowAttributes(
701 WindowPtr /*pWin*/,
702 unsigned long /*mask*/
703);
704/* afbzerarc.c */
705
706extern void afbZeroPolyArcSS(
707 DrawablePtr /*pDraw*/,
708 GCPtr /*pGC*/,
709 int /*narcs*/,
710 xArc * /*parcs*/
711);
712
713/*
714 private field of pixmap
715 pixmap.devPrivate = (PixelType *)pointer_to_bits
716 pixmap.devKind = width_of_pixmap_in_bytes
717
718 private field of screen
719 a pixmap, for which we allocate storage. devPrivate is a pointer to
720the bits in the hardware framebuffer. note that devKind can be poked to
721make the code work for framebuffers that are wider than their
722displayable screen (e.g. the early vsII, which displayed 960 pixels
723across, but was 1024 in the hardware.)
724
725 private field of GC
726*/
727
728typedef struct {
729 unsigned char rrops[AFB_MAX_DEPTH]; /* reduction of rasterop to 1 of 3 */
730 unsigned char rropOS[AFB_MAX_DEPTH]; /* rop for opaque stipple */
731} afbPrivGC;
732typedef afbPrivGC *afbPrivGCPtr;
733
734extern DevPrivateKey afbScreenPrivateKey;
735extern DevPrivateKey afbGCPrivateKey;
736extern DevPrivateKey afbWindowPrivateKey;
737#ifdef PIXMAP_PER_WINDOW
738extern DevPrivateKey frameWindowPrivateKey;
739#endif
740
741#define afbGetGCPrivate(pGC) \
742 ((afbPrivGC *)dixLookupPrivate(&(pGC)->devPrivates, afbGCPrivateKey))
743
744/* Common macros for extracting drawing information */
745
746#define afbGetTypedWidth(pDrawable,wtype)( \
747 (((pDrawable)->type == DRAWABLE_WINDOW) ? \
748 (int)(((PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey)->devKind) : \
749 (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
750
751#define afbGetByteWidth(pDrawable) afbGetTypedWidth(pDrawable, unsigned char)
752
753#define afbGetPixelWidth(pDrawable) afbGetTypedWidth(pDrawable, PixelType)
754
755#define afbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
756 PixmapPtr _pPix; \
757 if ((pDrawable)->type == DRAWABLE_WINDOW) \
758 _pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \
759 else \
760 _pPix = (PixmapPtr)(pDrawable); \
761 (pointer) = (ptype *) _pPix->devPrivate.ptr; \
762 (width) = ((int) _pPix->devKind) / sizeof (wtype); \
763}
764
765#define afbGetPixelWidthSizeDepthAndPointer(pDrawable, width, size, dep, pointer) {\
766 PixmapPtr _pPix; \
767 if ((pDrawable)->type == DRAWABLE_WINDOW) \
768 _pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \
769 else \
770 _pPix = (PixmapPtr)(pDrawable); \
771 (pointer) = (PixelType *)_pPix->devPrivate.ptr; \
772 (width) = ((int)_pPix->devKind) / sizeof (PixelType); \
773 (size) = (width) * _pPix->drawable.height; \
774 (dep) = _pPix->drawable.depth; (void)(dep); \
775}
776
777#define afbGetByteWidthAndPointer(pDrawable, width, pointer) \
778 afbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
779
780#define afbGetPixelWidthAndPointer(pDrawable, width, pointer) \
781 afbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
782
783#define afbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
784 PixmapPtr _pPix = (PixmapPtr)dixLookupPrivate(&(pWin)->drawable.pScreen->devPrivates, afbScreenPrivateKey); \
785 (pointer) = (ptype *) _pPix->devPrivate.ptr; \
786 (width) = ((int) _pPix->devKind) / sizeof (wtype); \
787}
788
789#define afbGetWindowPixelWidthAndPointer(pWin, width, pointer) \
790 afbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType)
791
792#define afbGetWindowByteWidthAndPointer(pWin, width, pointer) \
793 afbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char)
794
795/* afb uses the following macros to calculate addresses in drawables.
796 * To support banked framebuffers, the macros come in four flavors.
797 * All four collapse into the same definition on unbanked devices.
798 *
799 * afbScanlineFoo - calculate address and do bank switching
800 * afbScanlineFooNoBankSwitch - calculate address, don't bank switch
801 * afbScanlineFooSrc - calculate address, switch source bank
802 * afbScanlineFooDst - calculate address, switch destination bank
803 */
804
805/* The NoBankSwitch versions are the same for banked and unbanked cases */
806
807#define afbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off)
808#define afbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off))
809#define afbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \
810 afbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w))
811#define afbScanlineNoBankSwitch(_ptr, _x, _y, _w) \
812 afbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
813
814#ifdef MFB_LINE_BANK
815
816#include "afblinebank.h" /* get macro definitions from this file */
817
818#else /* !MFB_LINE_BANK - unbanked case */
819
820#define afbScanlineInc(_ptr, _off) afbScanlineIncNoBankSwitch(_ptr, _off)
821#define afbScanlineIncSrc(_ptr, _off) afbScanlineInc(_ptr, _off)
822#define afbScanlineIncDst(_ptr, _off) afbScanlineInc(_ptr, _off)
823
824#define afbScanlineOffset(_ptr, _off) afbScanlineOffsetNoBankSwitch(_ptr, _off)
825#define afbScanlineOffsetSrc(_ptr, _off) afbScanlineOffset(_ptr, _off)
826#define afbScanlineOffsetDst(_ptr, _off) afbScanlineOffset(_ptr, _off)
827
828#define afbScanlineSrc(_ptr, _x, _y, _w) afbScanline(_ptr, _x, _y, _w)
829#define afbScanlineDst(_ptr, _x, _y, _w) afbScanline(_ptr, _x, _y, _w)
830
831#define afbScanlineDeltaSrc(_ptr, _y, _w) afbScanlineDelta(_ptr, _y, _w)
832#define afbScanlineDeltaDst(_ptr, _y, _w) afbScanlineDelta(_ptr, _y, _w)
833
834#endif /* MFB_LINE_BANK */
835
836#define afbScanlineDelta(_ptr, _y, _w) \
837 afbScanlineOffset(_ptr, (_y) * (_w))
838
839#define afbScanline(_ptr, _x, _y, _w) \
840 afbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
841
842/* precomputed information about each glyph for GlyphBlt code.
843 this saves recalculating the per glyph information for each box.
844*/
845
846typedef struct _afbpos{
847 int xpos; /* xposition of glyph's origin */
848 int xchar; /* x position mod 32 */
849 int leftEdge;
850 int rightEdge;
851 int topEdge;
852 int bottomEdge;
853 PixelType *pdstBase; /* longword with character origin */
854 int widthGlyph; /* width in bytes of this glyph */
855} afbTEXTPOS;
856
857/* reduced raster ops for afb */
858#define RROP_BLACK GXclear
859#define RROP_WHITE GXset
860#define RROP_NOP GXnoop
861#define RROP_INVERT GXinvert
862#define RROP_COPY GXcopy
863
864/* macros for afbbitblt.c, afbfillsp.c
865 these let the code do one switch on the rop per call, rather
866 than a switch on the rop per item (span or rectangle.)
867*/
868
869#define fnCLEAR(src, dst) (0)
870#define fnAND(src, dst) (src & dst)
871#define fnANDREVERSE(src, dst) (src & ~dst)
872#define fnCOPY(src, dst) (src)
873#define fnANDINVERTED(src, dst) (~src & dst)
874#define fnNOOP(src, dst) (dst)
875#define fnXOR(src, dst) (src ^ dst)
876#define fnOR(src, dst) (src | dst)
877#define fnNOR(src, dst) (~(src | dst))
878#define fnEQUIV(src, dst) (~src ^ dst)
879#define fnINVERT(src, dst) (~dst)
880#define fnORREVERSE(src, dst) (src | ~dst)
881#define fnCOPYINVERTED(src, dst) (~src)
882#define fnORINVERTED(src, dst) (~src | dst)
883#define fnNAND(src, dst) (~(src & dst))
884#undef fnSET
885#define fnSET(src, dst) (~0)
886
887/* Using a "switch" statement is much faster in most cases
888 * since the compiler can do a look-up table or multi-way branch
889 * instruction, depending on the architecture. The result on
890 * A Sun 3/50 is at least 2.5 times faster, assuming a uniform
891 * distribution of RasterOp operation types.
892 *
893 * However, doing some profiling on a running system reveals
894 * GXcopy is the operation over 99.5% of the time and
895 * GXxor is the next most frequent (about .4%), so we make special
896 * checks for those first.
897 *
898 * Note that this requires a change to the "calling sequence"
899 * since we can't engineer a "switch" statement to have an lvalue.
900 */
901#undef DoRop
902#define DoRop(result, alu, src, dst) \
903{ \
904 if (alu == GXcopy) \
905 result = fnCOPY (src, dst); \
906 else if (alu == GXxor) \
907 result = fnXOR (src, dst); \
908 else \
909 switch (alu) { \
910 case GXclear: \
911 result = fnCLEAR (src, dst); \
912 break; \
913 case GXand: \
914 result = fnAND (src, dst); \
915 break; \
916 case GXandReverse: \
917 result = fnANDREVERSE (src, dst); \
918 break; \
919 case GXandInverted: \
920 result = fnANDINVERTED (src, dst); \
921 break; \
922 default: \
923 case GXnoop: \
924 result = fnNOOP (src, dst); \
925 break; \
926 case GXor: \
927 result = fnOR (src, dst); \
928 break; \
929 case GXnor: \
930 result = fnNOR (src, dst); \
931 break; \
932 case GXequiv: \
933 result = fnEQUIV (src, dst); \
934 break; \
935 case GXinvert: \
936 result = fnINVERT (src, dst); \
937 break; \
938 case GXorReverse: \
939 result = fnORREVERSE (src, dst); \
940 break; \
941 case GXcopyInverted: \
942 result = fnCOPYINVERTED (src, dst); \
943 break; \
944 case GXorInverted: \
945 result = fnORINVERTED (src, dst); \
946 break; \
947 case GXnand: \
948 result = fnNAND (src, dst); \
949 break; \
950 case GXset: \
951 result = fnSET (src, dst); \
952 break; \
953 } \
954}
955
956
957/* C expression fragments for various operations. These get passed in
958 * as -D's on the compile command line. See afb/Imakefile. This
959 * fixes XBUG 6319.
960 *
961 * This seems like a good place to point out that afb's use of the
962 * words black and white is an unfortunate misnomer. In afb code, black
963 * means zero, and white means one.
964 */
965#define MFB_OPEQ_WHITE |=
966#define MFB_OPEQ_BLACK &=~
967#define MFB_OPEQ_INVERT ^=
968#define MFB_EQWHOLEWORD_WHITE =~0
969#define MFB_EQWHOLEWORD_BLACK =0
970#define MFB_EQWHOLEWORD_INVERT ^=~0
971#define MFB_OP_WHITE /* nothing */
972#define MFB_OP_BLACK ~
Note: See TracBrowser for help on using the repository browser.

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