]> git.sesse.net Git - rdpsrv/blob - Xserver/programs/Xserver/mfb/mfb.h
24ef7b8fd1294da28925e48bce384ba866e6c8f7
[rdpsrv] / Xserver / programs / Xserver / mfb / mfb.h
1 /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
2 /***********************************************************
3
4 Copyright (c) 1987  X Consortium
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 Except as contained in this notice, the name of the X Consortium shall not be
24 used in advertising or otherwise to promote the sale, use or other dealings
25 in this Software without prior written authorization from the X Consortium.
26
27
28 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
29
30                         All Rights Reserved
31
32 Permission to use, copy, modify, and distribute this software and its 
33 documentation for any purpose and without fee is hereby granted, 
34 provided that the above copyright notice appear in all copies and that
35 both that copyright notice and this permission notice appear in 
36 supporting documentation, and that the name of Digital not be
37 used in advertising or publicity pertaining to distribution of the
38 software without specific, written prior permission.  
39
40 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
41 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
42 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
43 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 SOFTWARE.
47
48 ******************************************************************/
49 /* $XConsortium: mfb.h,v 5.31 94/04/17 20:28:15 dpw Exp $ */
50
51
52
53
54 /* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.2 1997/01/14 22:22:44 dawes Exp $ */
55 /* Monochrome Frame Buffer definitions 
56    written by drewry, september 1986
57 */
58 #include "pixmap.h"
59 #include "region.h"
60 #include "gc.h"
61 #include "colormap.h"
62 #include "miscstruct.h"
63 #include "mibstore.h"
64
65 extern int InverseAlu[];
66
67 /* warning: PixelType definition duplicated in maskbits.h */
68 #ifndef PixelType
69 #define PixelType unsigned long
70 #endif /* PixelType */
71
72 /* mfbbitblt.c */
73
74 extern void mfbDoBitblt(
75 #if NeedFunctionPrototypes
76     DrawablePtr /*pSrc*/,
77     DrawablePtr /*pDst*/,
78     int /*alu*/,
79     RegionPtr /*prgnDst*/,
80     DDXPointPtr /*pptSrc*/
81 #endif
82 );
83
84 extern RegionPtr mfbCopyArea(
85 #if NeedFunctionPrototypes
86     DrawablePtr /*pSrcDrawable*/,
87     DrawablePtr /*pDstDrawable*/,
88     GCPtr/*pGC*/,
89     int /*srcx*/,
90     int /*srcy*/,
91     int /*width*/,
92     int /*height*/,
93     int /*dstx*/,
94     int /*dsty*/
95 #endif
96 );
97
98 extern Bool mfbRegisterCopyPlaneProc(
99 #if NeedFunctionPrototypes
100     ScreenPtr /*pScreen*/,
101     RegionPtr (* /*proc*/)(
102 #if NeedNestedPrototypes
103         DrawablePtr         /* pSrcDrawable */,
104         DrawablePtr         /* pDstDrawable */,
105         GCPtr               /* pGC */,
106         int                 /* srcx */,
107         int                 /* srcy */,
108         int                 /* width */,
109         int                 /* height */,
110         int                 /* dstx */,
111         int                 /* dsty */,
112         unsigned long       /* bitPlane */
113 #endif
114         )
115 #endif
116 );
117
118 extern RegionPtr mfbCopyPlane(
119 #if NeedFunctionPrototypes
120     DrawablePtr /*pSrcDrawable*/,
121     DrawablePtr /*pDstDrawable*/,
122     GCPtr/*pGC*/,
123     int /*srcx*/,
124     int /*srcy*/,
125     int /*width*/,
126     int /*height*/,
127     int /*dstx*/,
128     int /*dsty*/,
129     unsigned long /*plane*/
130 #endif
131 );
132 /* mfbbltC.c */
133
134 extern void mfbDoBitbltCopy(
135 #if NeedFunctionPrototypes
136     DrawablePtr /*pSrc*/,
137     DrawablePtr /*pDst*/,
138     int /*alu*/,
139     RegionPtr /*prgnDst*/,
140     DDXPointPtr /*pptSrc*/
141 #endif
142 );
143 /* mfbbltCI.c */
144
145 extern void mfbDoBitbltCopyInverted(
146 #if NeedFunctionPrototypes
147     DrawablePtr /*pSrc*/,
148     DrawablePtr /*pDst*/,
149     int /*alu*/,
150     RegionPtr /*prgnDst*/,
151     DDXPointPtr /*pptSrc*/
152 #endif
153 );
154 /* mfbbltG.c */
155
156 extern void mfbDoBitbltGeneral(
157 #if NeedFunctionPrototypes
158     DrawablePtr /*pSrc*/,
159     DrawablePtr /*pDst*/,
160     int /*alu*/,
161     RegionPtr /*prgnDst*/,
162     DDXPointPtr /*pptSrc*/
163 #endif
164 );
165 /* mfbbltO.c */
166
167 extern void mfbDoBitbltOr(
168 #if NeedFunctionPrototypes
169     DrawablePtr /*pSrc*/,
170     DrawablePtr /*pDst*/,
171     int /*alu*/,
172     RegionPtr /*prgnDst*/,
173     DDXPointPtr /*pptSrc*/
174 #endif
175 );
176 /* mfbbltX.c */
177
178 extern void mfbDoBitbltXor(
179 #if NeedFunctionPrototypes
180     DrawablePtr /*pSrc*/,
181     DrawablePtr /*pDst*/,
182     int /*alu*/,
183     RegionPtr /*prgnDst*/,
184     DDXPointPtr /*pptSrc*/
185 #endif
186 );
187 /* mfbbres.c */
188
189 extern void mfbBresS(
190 #if NeedFunctionPrototypes
191     int /*rop*/,
192     PixelType * /*addrl*/,
193     int /*nlwidth*/,
194     int /*signdx*/,
195     int /*signdy*/,
196     int /*axis*/,
197     int /*x1*/,
198     int /*y1*/,
199     int /*e*/,
200     int /*e1*/,
201     int /*e2*/,
202     int /*len*/
203 #endif
204 );
205 /* mfbbresd.c */
206
207 extern void mfbBresD(
208 #if NeedFunctionPrototypes
209     int /*fgrop*/,
210     int /*bgrop*/,
211     int * /*pdashIndex*/,
212     unsigned char * /*pDash*/,
213     int /*numInDashList*/,
214     int * /*pdashOffset*/,
215     int /*isDoubleDash*/,
216     PixelType * /*addrl*/,
217     int /*nlwidth*/,
218     int /*signdx*/,
219     int /*signdy*/,
220     int /*axis*/,
221     int /*x1*/,
222     int /*y1*/,
223     int /*e*/,
224     int /*e1*/,
225     int /*e2*/,
226     int /*len*/
227 #endif
228 );
229 /* mfbbstore.c */
230
231 extern void mfbSaveAreas(
232 #if NeedFunctionPrototypes
233     PixmapPtr /*pPixmap*/,
234     RegionPtr /*prgnSave*/,
235     int /*xorg*/,
236     int /*yorg*/,
237     WindowPtr /*pWin*/
238 #endif
239 );
240
241 extern void mfbRestoreAreas(
242 #if NeedFunctionPrototypes
243     PixmapPtr /*pPixmap*/,
244     RegionPtr /*prgnRestore*/,
245     int /*xorg*/,
246     int /*yorg*/,
247     WindowPtr /*pWin*/
248 #endif
249 );
250 /* mfbclip.c */
251
252 extern RegionPtr mfbPixmapToRegion(
253 #if NeedFunctionPrototypes
254     PixmapPtr /*pPix*/
255 #endif
256 );
257 /* mfbcmap.c */
258
259 extern int mfbListInstalledColormaps(
260 #if NeedFunctionPrototypes
261     ScreenPtr /*pScreen*/,
262     Colormap * /*pmaps*/
263 #endif
264 );
265
266 extern void mfbInstallColormap(
267 #if NeedFunctionPrototypes
268     ColormapPtr /*pmap*/
269 #endif
270 );
271
272 extern void mfbUninstallColormap(
273 #if NeedFunctionPrototypes
274     ColormapPtr /*pmap*/
275 #endif
276 );
277
278 extern void mfbResolveColor(
279 #if NeedFunctionPrototypes
280     unsigned short * /*pred*/,
281     unsigned short * /*pgreen*/,
282     unsigned short * /*pblue*/,
283     VisualPtr /*pVisual*/
284 #endif
285 );
286
287 extern Bool mfbCreateColormap(
288 #if NeedFunctionPrototypes
289     ColormapPtr /*pMap*/
290 #endif
291 );
292
293 extern void mfbDestroyColormap(
294 #if NeedFunctionPrototypes
295     ColormapPtr /*pMap*/
296 #endif
297 );
298
299 extern Bool mfbCreateDefColormap(
300 #if NeedFunctionPrototypes
301     ScreenPtr /*pScreen*/
302 #endif
303 );
304 /* mfbfillarc.c */
305
306 extern void mfbPolyFillArcSolid(
307 #if NeedFunctionPrototypes
308     DrawablePtr /*pDraw*/,
309     GCPtr /*pGC*/,
310     int /*narcs*/,
311     xArc * /*parcs*/
312 #endif
313 );
314 /* mfbfillrct.c */
315
316 extern void mfbPolyFillRect(
317 #if NeedFunctionPrototypes
318     DrawablePtr /*pDrawable*/,
319     GCPtr /*pGC*/,
320     int /*nrectFill*/,
321     xRectangle * /*prectInit*/
322 #endif
323 );
324 /* mfbfillsp.c */
325
326 extern void mfbBlackSolidFS(
327 #if NeedFunctionPrototypes
328     DrawablePtr /*pDrawable*/,
329     GCPtr /*pGC*/,
330     int /*nInit*/,
331     DDXPointPtr /*pptInit*/,
332     int * /*pwidthInit*/,
333     int /*fSorted*/
334 #endif
335 );
336
337 extern void mfbWhiteSolidFS(
338 #if NeedFunctionPrototypes
339     DrawablePtr /*pDrawable*/,
340     GCPtr /*pGC*/,
341     int /*nInit*/,
342     DDXPointPtr /*pptInit*/,
343     int * /*pwidthInit*/,
344     int /*fSorted*/
345 #endif
346 );
347
348 extern void mfbInvertSolidFS(
349 #if NeedFunctionPrototypes
350     DrawablePtr /*pDrawable*/,
351     GCPtr /*pGC*/,
352     int /*nInit*/,
353     DDXPointPtr /*pptInit*/,
354     int * /*pwidthInit*/,
355     int /*fSorted*/
356 #endif
357 );
358
359 extern void mfbWhiteStippleFS(
360 #if NeedFunctionPrototypes
361     DrawablePtr /*pDrawable*/,
362     GCPtr/*pGC*/,
363     int /*nInit*/,
364     DDXPointPtr /*pptInit*/,
365     int * /*pwidthInit*/,
366     int /*fSorted*/
367 #endif
368 );
369
370 extern void mfbBlackStippleFS(
371 #if NeedFunctionPrototypes
372     DrawablePtr /*pDrawable*/,
373     GCPtr/*pGC*/,
374     int /*nInit*/,
375     DDXPointPtr /*pptInit*/,
376     int * /*pwidthInit*/,
377     int /*fSorted*/
378 #endif
379 );
380
381 extern void mfbInvertStippleFS(
382 #if NeedFunctionPrototypes
383     DrawablePtr /*pDrawable*/,
384     GCPtr/*pGC*/,
385     int /*nInit*/,
386     DDXPointPtr /*pptInit*/,
387     int * /*pwidthInit*/,
388     int /*fSorted*/
389 #endif
390 );
391
392 extern void mfbTileFS(
393 #if NeedFunctionPrototypes
394     DrawablePtr /*pDrawable*/,
395     GCPtr/*pGC*/,
396     int /*nInit*/,
397     DDXPointPtr /*pptInit*/,
398     int * /*pwidthInit*/,
399     int /*fSorted*/
400 #endif
401 );
402
403 extern void mfbUnnaturalTileFS(
404 #if NeedFunctionPrototypes
405     DrawablePtr /*pDrawable*/,
406     GCPtr/*pGC*/,
407     int /*nInit*/,
408     DDXPointPtr /*pptInit*/,
409     int * /*pwidthInit*/,
410     int /*fSorted*/
411 #endif
412 );
413
414 extern void mfbUnnaturalStippleFS(
415 #if NeedFunctionPrototypes
416     DrawablePtr /*pDrawable*/,
417     GCPtr/*pGC*/,
418     int /*nInit*/,
419     DDXPointPtr /*pptInit*/,
420     int * /*pwidthInit*/,
421     int /*fSorted*/
422 #endif
423 );
424 /* mfbfont.c */
425
426 extern Bool mfbRealizeFont(
427 #if NeedFunctionPrototypes
428     ScreenPtr /*pscr*/,
429     FontPtr /*pFont*/
430 #endif
431 );
432
433 extern Bool mfbUnrealizeFont(
434 #if NeedFunctionPrototypes
435     ScreenPtr /*pscr*/,
436     FontPtr /*pFont*/
437 #endif
438 );
439 /* mfbgc.c */
440
441 extern Bool mfbCreateGC(
442 #if NeedFunctionPrototypes
443     GCPtr /*pGC*/
444 #endif
445 );
446
447 extern void mfbValidateGC(
448 #if NeedFunctionPrototypes
449     GCPtr /*pGC*/,
450     unsigned long /*changes*/,
451     DrawablePtr /*pDrawable*/
452 #endif
453 );
454
455 extern int mfbReduceRop(
456 #if NeedFunctionPrototypes
457     int /*alu*/,
458     Pixel /*src*/
459 #endif
460 );
461
462 /* mfbgetsp.c */
463
464 extern void mfbGetSpans(
465 #if NeedFunctionPrototypes
466     DrawablePtr /*pDrawable*/,
467     int /*wMax*/,
468     DDXPointPtr /*ppt*/,
469     int * /*pwidth*/,
470     int /*nspans*/,
471     char * /*pdstStart*/
472 #endif
473 );
474 /* mfbhrzvert.c */
475
476 extern int mfbHorzS(
477 #if NeedFunctionPrototypes
478     int /*rop*/,
479     PixelType * /*addrl*/,
480     int /*nlwidth*/,
481     int /*x1*/,
482     int /*y1*/,
483     int /*len*/
484 #endif
485 );
486
487 extern int mfbVertS(
488 #if NeedFunctionPrototypes
489     int /*rop*/,
490     PixelType * /*addrl*/,
491     int /*nlwidth*/,
492     int /*x1*/,
493     int /*y1*/,
494     int /*len*/
495 #endif
496 );
497 /* mfbigbblak.c */
498
499 extern void mfbImageGlyphBltBlack(
500 #if NeedFunctionPrototypes
501     DrawablePtr /*pDrawable*/,
502     GCPtr/*pGC*/,
503     int /*x*/,
504     int /*y*/,
505     unsigned int /*nglyph*/,
506     CharInfoPtr * /*ppci*/,
507     pointer /*pglyphBase*/
508 #endif
509 );
510 /* mfbigbwht.c */
511
512 extern void mfbImageGlyphBltWhite(
513 #if NeedFunctionPrototypes
514     DrawablePtr /*pDrawable*/,
515     GCPtr/*pGC*/,
516     int /*x*/,
517     int /*y*/,
518     unsigned int /*nglyph*/,
519     CharInfoPtr * /*ppci*/,
520     pointer /*pglyphBase*/
521 #endif
522 );
523 /* mfbimage.c */
524
525 extern void mfbPutImage(
526 #if NeedFunctionPrototypes
527     DrawablePtr /*dst*/,
528     GCPtr /*pGC*/,
529     int /*depth*/,
530     int /*x*/,
531     int /*y*/,
532     int /*w*/,
533     int /*h*/,
534     int /*leftPad*/,
535     int /*format*/,
536     char * /*pImage*/
537 #endif
538 );
539
540 extern void mfbGetImage(
541 #if NeedFunctionPrototypes
542     DrawablePtr /*pDrawable*/,
543     int /*sx*/,
544     int /*sy*/,
545     int /*w*/,
546     int /*h*/,
547     unsigned int /*format*/,
548     unsigned long /*planeMask*/,
549     char * /*pdstLine*/
550 #endif
551 );
552 /* mfbline.c */
553
554 extern void mfbLineSS(
555 #if NeedFunctionPrototypes
556     DrawablePtr /*pDrawable*/,
557     GCPtr /*pGC*/,
558     int /*mode*/,
559     int /*npt*/,
560     DDXPointPtr /*pptInit*/
561 #endif
562 );
563
564 extern void mfbLineSD(
565 #if NeedFunctionPrototypes
566     DrawablePtr /*pDrawable*/,
567     GCPtr /*pGC*/,
568     int /*mode*/,
569     int /*npt*/,
570     DDXPointPtr /*pptInit*/
571 #endif
572 );
573
574 /* mfbmisc.c */
575
576 extern void mfbQueryBestSize(
577 #if NeedFunctionPrototypes
578     int /*class*/,
579     unsigned short * /*pwidth*/,
580     unsigned short * /*pheight*/,
581     ScreenPtr /*pScreen*/
582 #endif
583 );
584 /* mfbpablack.c */
585
586 extern void mfbSolidBlackArea(
587 #if NeedFunctionPrototypes
588     DrawablePtr /*pDraw*/,
589     int /*nbox*/,
590     BoxPtr /*pbox*/,
591     int /*alu*/,
592     PixmapPtr /*nop*/
593 #endif
594 );
595
596 extern void mfbStippleBlackArea(
597 #if NeedFunctionPrototypes
598     DrawablePtr /*pDraw*/,
599     int /*nbox*/,
600     BoxPtr /*pbox*/,
601     int /*alu*/,
602     PixmapPtr /*pstipple*/
603 #endif
604 );
605 /* mfbpainv.c */
606
607 extern void mfbSolidInvertArea(
608 #if NeedFunctionPrototypes
609     DrawablePtr /*pDraw*/,
610     int /*nbox*/,
611     BoxPtr /*pbox*/,
612     int /*alu*/,
613     PixmapPtr /*nop*/
614 #endif
615 );
616
617 extern void mfbStippleInvertArea(
618 #if NeedFunctionPrototypes
619     DrawablePtr /*pDraw*/,
620     int /*nbox*/,
621     BoxPtr /*pbox*/,
622     int /*alu*/,
623     PixmapPtr /*pstipple*/
624 #endif
625 );
626 /* mfbpawhite.c */
627
628 extern void mfbSolidWhiteArea(
629 #if NeedFunctionPrototypes
630     DrawablePtr /*pDraw*/,
631     int /*nbox*/,
632     BoxPtr /*pbox*/,
633     int /*alu*/,
634     PixmapPtr /*nop*/
635 #endif
636 );
637
638 extern void mfbStippleWhiteArea(
639 #if NeedFunctionPrototypes
640     DrawablePtr /*pDraw*/,
641     int /*nbox*/,
642     BoxPtr /*pbox*/,
643     int /*alu*/,
644     PixmapPtr /*pstipple*/
645 #endif
646 );
647 /* mfbpgbblak.c */
648
649 extern void mfbPolyGlyphBltBlack(
650 #if NeedFunctionPrototypes
651     DrawablePtr /*pDrawable*/,
652     GCPtr /*pGC*/,
653     int /*x*/,
654     int /*y*/,
655     unsigned int /*nglyph*/,
656     CharInfoPtr * /*ppci*/,
657     pointer /*pglyphBase*/
658 #endif
659 );
660 /* mfbpgbinv.c */
661
662 extern void mfbPolyGlyphBltInvert(
663 #if NeedFunctionPrototypes
664     DrawablePtr /*pDrawable*/,
665     GCPtr /*pGC*/,
666     int /*x*/,
667     int /*y*/,
668     unsigned int /*nglyph*/,
669     CharInfoPtr * /*ppci*/,
670     pointer /*pglyphBase*/
671 #endif
672 );
673 /* mfbpgbwht.c */
674
675 extern void mfbPolyGlyphBltWhite(
676 #if NeedFunctionPrototypes
677     DrawablePtr /*pDrawable*/,
678     GCPtr /*pGC*/,
679     int /*x*/,
680     int /*y*/,
681     unsigned int /*nglyph*/,
682     CharInfoPtr * /*ppci*/,
683     pointer /*pglyphBase*/
684 #endif
685 );
686 /* mfbpixmap.c */
687
688 extern PixmapPtr mfbCreatePixmap(
689 #if NeedFunctionPrototypes
690     ScreenPtr /*pScreen*/,
691     int /*width*/,
692     int /*height*/,
693     int /*depth*/
694 #endif
695 );
696
697 extern Bool mfbDestroyPixmap(
698 #if NeedFunctionPrototypes
699     PixmapPtr /*pPixmap*/
700 #endif
701 );
702
703 extern PixmapPtr mfbCopyPixmap(
704 #if NeedFunctionPrototypes
705     PixmapPtr /*pSrc*/
706 #endif
707 );
708
709 extern void mfbPadPixmap(
710 #if NeedFunctionPrototypes
711     PixmapPtr /*pPixmap*/
712 #endif
713 );
714
715 extern void mfbXRotatePixmap(
716 #if NeedFunctionPrototypes
717     PixmapPtr /*pPix*/,
718     int /*rw*/
719 #endif
720 );
721
722 extern void mfbYRotatePixmap(
723 #if NeedFunctionPrototypes
724     PixmapPtr /*pPix*/,
725     int /*rh*/
726 #endif
727 );
728
729 extern void mfbCopyRotatePixmap(
730 #if NeedFunctionPrototypes
731     PixmapPtr /*psrcPix*/,
732     PixmapPtr * /*ppdstPix*/,
733     int /*xrot*/,
734     int /*yrot*/
735 #endif
736 );
737 /* mfbplyblack.c */
738
739 extern void mfbFillPolyBlack(
740 #if NeedFunctionPrototypes
741     DrawablePtr /*pDrawable*/,
742     GCPtr /*pGC*/,
743     int /*shape*/,
744     int /*mode*/,
745     int /*count*/,
746     DDXPointPtr /*ptsIn*/
747 #endif
748 );
749 /* mfbplyinv.c */
750
751 extern void mfbFillPolyInvert(
752 #if NeedFunctionPrototypes
753     DrawablePtr /*pDrawable*/,
754     GCPtr /*pGC*/,
755     int /*shape*/,
756     int /*mode*/,
757     int /*count*/,
758     DDXPointPtr /*ptsIn*/
759 #endif
760 );
761 /* mfbplywhite.c */
762
763 extern void mfbFillPolyWhite(
764 #if NeedFunctionPrototypes
765     DrawablePtr /*pDrawable*/,
766     GCPtr /*pGC*/,
767     int /*shape*/,
768     int /*mode*/,
769     int /*count*/,
770     DDXPointPtr /*ptsIn*/
771 #endif
772 );
773 /* mfbpntwin.c */
774
775 extern void mfbPaintWindow(
776 #if NeedFunctionPrototypes
777     WindowPtr /*pWin*/,
778     RegionPtr /*pRegion*/,
779     int /*what*/
780 #endif
781 );
782 /* mfbpolypnt.c */
783
784 extern void mfbPolyPoint(
785 #if NeedFunctionPrototypes
786     DrawablePtr /*pDrawable*/,
787     GCPtr /*pGC*/,
788     int /*mode*/,
789     int /*npt*/,
790     xPoint * /*pptInit*/
791 #endif
792 );
793 /* mfbpushpxl.c */
794
795 extern void mfbSolidPP(
796 #if NeedFunctionPrototypes
797     GCPtr /*pGC*/,
798     PixmapPtr /*pBitMap*/,
799     DrawablePtr /*pDrawable*/,
800     int /*dx*/,
801     int /*dy*/,
802     int /*xOrg*/,
803     int /*yOrg*/
804 #endif
805 );
806
807 extern void mfbPushPixels(
808 #if NeedFunctionPrototypes
809     GCPtr /*pGC*/,
810     PixmapPtr /*pBitMap*/,
811     DrawablePtr /*pDrawable*/,
812     int /*dx*/,
813     int /*dy*/,
814     int /*xOrg*/,
815     int /*yOrg*/
816 #endif
817 );
818 /* mfbscrclse.c */
819
820 extern Bool mfbCloseScreen(
821 #if NeedFunctionPrototypes
822     int /*index*/,
823     ScreenPtr /*pScreen*/
824 #endif
825 );
826 /* mfbscrinit.c */
827
828 extern Bool mfbAllocatePrivates(
829 #if NeedFunctionPrototypes
830     ScreenPtr /*pScreen*/,
831     int * /*pWinIndex*/,
832     int * /*pGCIndex*/
833 #endif
834 );
835
836 extern Bool mfbScreenInit(
837 #if NeedFunctionPrototypes
838     ScreenPtr /*pScreen*/,
839     pointer /*pbits*/,
840     int /*xsize*/,
841     int /*ysize*/,
842     int /*dpix*/,
843     int /*dpiy*/,
844     int /*width*/
845 #endif
846 );
847 /* mfbseg.c */
848
849 extern void mfbSegmentSS(
850 #if NeedFunctionPrototypes
851     DrawablePtr /*pDrawable*/,
852     GCPtr /*pGC*/,
853     int /*nseg*/,
854     xSegment * /*pSeg*/
855 #endif
856 );
857
858 extern void mfbSegmentSD(
859 #if NeedFunctionPrototypes
860     DrawablePtr /*pDrawable*/,
861     GCPtr /*pGC*/,
862     int /*nseg*/,
863     xSegment * /*pSeg*/
864 #endif
865 );
866 /* mfbsetsp.c */
867
868 extern int mfbSetScanline(
869 #if NeedFunctionPrototypes
870     int /*y*/,
871     int /*xOrigin*/,
872     int /*xStart*/,
873     int /*xEnd*/,
874     PixelType * /*psrc*/,
875     int /*alu*/,
876     PixelType * /*pdstBase*/,
877     int /*widthDst*/
878 #endif
879 );
880
881 extern void mfbSetSpans(
882 #if NeedFunctionPrototypes
883     DrawablePtr /*pDrawable*/,
884     GCPtr /*pGC*/,
885     char * /*psrc*/,
886     DDXPointPtr /*ppt*/,
887     int * /*pwidth*/,
888     int /*nspans*/,
889     int /*fSorted*/
890 #endif
891 );
892 /* mfbteblack.c */
893
894 extern void mfbTEGlyphBltBlack(
895 #if NeedFunctionPrototypes
896     DrawablePtr /*pDrawable*/,
897     GCPtr/*pGC*/,
898     int /*x*/,
899     int /*y*/,
900     unsigned int /*nglyph*/,
901     CharInfoPtr * /*ppci*/,
902     pointer /*pglyphBase*/
903 #endif
904 );
905 /* mfbtewhite.c */
906
907 extern void mfbTEGlyphBltWhite(
908 #if NeedFunctionPrototypes
909     DrawablePtr /*pDrawable*/,
910     GCPtr/*pGC*/,
911     int /*x*/,
912     int /*y*/,
913     unsigned int /*nglyph*/,
914     CharInfoPtr * /*ppci*/,
915     pointer /*pglyphBase*/
916 #endif
917 );
918 /* mfbtileC.c */
919
920 extern void mfbTileAreaPPWCopy(
921 #if NeedFunctionPrototypes
922     DrawablePtr /*pDraw*/,
923     int /*nbox*/,
924     BoxPtr /*pbox*/,
925     int /*alu*/,
926     PixmapPtr /*ptile*/
927 #endif
928 );
929 /* mfbtileG.c */
930
931 extern void mfbTileAreaPPWGeneral(
932 #if NeedFunctionPrototypes
933     DrawablePtr /*pDraw*/,
934     int /*nbox*/,
935     BoxPtr /*pbox*/,
936     int /*alu*/,
937     PixmapPtr /*ptile*/
938 #endif
939 );
940
941 extern void mfbTileAreaPPW(
942 #if NeedFunctionPrototypes
943     DrawablePtr /*pDraw*/,
944     int /*nbox*/,
945     BoxPtr /*pbox*/,
946     int /*alu*/,
947     PixmapPtr /*ptile*/
948 #endif
949 );
950 /* mfbwindow.c */
951
952 extern Bool mfbCreateWindow(
953 #if NeedFunctionPrototypes
954     WindowPtr /*pWin*/
955 #endif
956 );
957
958 extern Bool mfbDestroyWindow(
959 #if NeedFunctionPrototypes
960     WindowPtr /*pWin*/
961 #endif
962 );
963
964 extern Bool mfbMapWindow(
965 #if NeedFunctionPrototypes
966     WindowPtr /*pWindow*/
967 #endif
968 );
969
970 extern Bool mfbPositionWindow(
971 #if NeedFunctionPrototypes
972     WindowPtr /*pWin*/,
973     int /*x*/,
974     int /*y*/
975 #endif
976 );
977
978 extern Bool mfbUnmapWindow(
979 #if NeedFunctionPrototypes
980     WindowPtr /*pWindow*/
981 #endif
982 );
983
984 extern void mfbCopyWindow(
985 #if NeedFunctionPrototypes
986     WindowPtr /*pWin*/,
987     DDXPointRec /*ptOldOrg*/,
988     RegionPtr /*prgnSrc*/
989 #endif
990 );
991
992 extern Bool mfbChangeWindowAttributes(
993 #if NeedFunctionPrototypes
994     WindowPtr /*pWin*/,
995     unsigned long /*mask*/
996 #endif
997 );
998 /* mfbzerarc.c */
999
1000 extern void mfbZeroPolyArcSS(
1001 #if NeedFunctionPrototypes
1002     DrawablePtr /*pDraw*/,
1003     GCPtr /*pGC*/,
1004     int /*narcs*/,
1005     xArc * /*parcs*/
1006 #endif
1007 );
1008
1009 /*
1010    private filed of pixmap
1011    pixmap.devPrivate = (PixelType *)pointer_to_bits
1012    pixmap.devKind = width_of_pixmap_in_bytes
1013
1014    private field of screen
1015    a pixmap, for which we allocate storage.  devPrivate is a pointer to
1016 the bits in the hardware framebuffer.  note that devKind can be poked to
1017 make the code work for framebuffers that are wider than their
1018 displayable screen (e.g. the early vsII, which displayed 960 pixels
1019 across, but was 1024 in the hardware.)
1020
1021    private field of GC 
1022         Freeing pCompositeClip is done based on the value of
1023 freeCompClip; if freeCompClip is not carefully maintained, we will end
1024 up losing storage or freeing something that isn't ours.
1025 */
1026
1027 typedef struct {
1028     unsigned char       rop;            /* reduction of rasterop to 1 of 3 */
1029     unsigned char       ropOpStip;      /* rop for opaque stipple */
1030     unsigned char       ropFillArea;    /*  == alu, rop, or ropOpStip */
1031     unsigned    fExpose:1;              /* callexposure handling ? */
1032     unsigned    freeCompClip:1;
1033     PixmapPtr   pRotatedPixmap;         /* tile/stipple rotated to align */
1034     RegionPtr   pCompositeClip;         /* free this based on freeCompClip
1035                                            flag rather than NULLness */
1036     void        (* FillArea)(           /* fills regions; look at the code */
1037 #if NeedNestedPrototypes
1038                 DrawablePtr /*pDraw*/,
1039                 int /*nbox*/,
1040                 BoxPtr /*pbox*/,
1041                 int /*alu*/,
1042                 PixmapPtr /*nop*/
1043 #endif
1044                 );
1045     } mfbPrivGC;
1046 typedef mfbPrivGC       *mfbPrivGCPtr;
1047
1048 extern int  mfbGCPrivateIndex;          /* index into GC private array */
1049 extern int  mfbWindowPrivateIndex;      /* index into Window private array */
1050 #ifdef PIXMAP_PER_WINDOW
1051 extern int  frameWindowPrivateIndex;    /* index into Window private array */
1052 #endif
1053
1054 /* private field of window */
1055 typedef struct {
1056     unsigned char fastBorder;   /* non-zero if border tile is 32 bits wide */
1057     unsigned char fastBackground;
1058     unsigned short unused; /* pad for alignment with Sun compiler */
1059     DDXPointRec oldRotate;
1060     PixmapPtr   pRotatedBackground;
1061     PixmapPtr   pRotatedBorder;
1062     } mfbPrivWin;
1063
1064 /* Common macros for extracting drawing information */
1065
1066 #define mfbGetTypedWidth(pDrawable,type) (\
1067     (((pDrawable)->type == DRAWABLE_WINDOW) ? \
1068      (int) (((PixmapPtr)((pDrawable)->pScreen->devPrivate))->devKind) : \
1069      (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (type))
1070
1071 #define mfbGetByteWidth(pDrawable) mfbGetTypedWidth(pDrawable, unsigned char)
1072
1073 #define mfbGetPixelWidth(pDrawable) mfbGetTypedWidth(pDrawable, PixelType)
1074     
1075 #define mfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
1076     PixmapPtr   _pPix; \
1077     if ((pDrawable)->type == DRAWABLE_WINDOW) \
1078         _pPix = (PixmapPtr) (pDrawable)->pScreen->devPrivate; \
1079     else \
1080         _pPix = (PixmapPtr) (pDrawable); \
1081     (pointer) = (ptype *) _pPix->devPrivate.ptr; \
1082     (width) = ((int) _pPix->devKind) / sizeof (wtype); \
1083 }
1084
1085 #define mfbGetByteWidthAndPointer(pDrawable, width, pointer) \
1086     mfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
1087
1088 #define mfbGetPixelWidthAndPointer(pDrawable, width, pointer) \
1089     mfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
1090
1091 #define mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
1092     PixmapPtr   _pPix = (PixmapPtr) (pWin)->drawable.pScreen->devPrivate; \
1093     (pointer) = (ptype *) _pPix->devPrivate.ptr; \
1094     (width) = ((int) _pPix->devKind) / sizeof (wtype); \
1095 }
1096
1097 #define mfbGetWindowPixelWidthAndPointer(pWin, width, pointer) \
1098     mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType)
1099
1100 #define mfbGetWindowByteWidthAndPointer(pWin, width, pointer) \
1101     mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char)
1102
1103 /*  mfb uses the following macros to calculate addresses in drawables.
1104  *  To support banked framebuffers, the macros come in four flavors.
1105  *  All four collapse into the same definition on unbanked devices.
1106  *  
1107  *  mfbScanlineFoo - calculate address and do bank switching
1108  *  mfbScanlineFooNoBankSwitch - calculate address, don't bank switch
1109  *  mfbScanlineFooSrc - calculate address, switch source bank
1110  *  mfbScanlineFooDst - calculate address, switch destination bank
1111  */
1112
1113 /* The NoBankSwitch versions are the same for banked and unbanked cases */
1114
1115 #define mfbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off)
1116 #define mfbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off))
1117 #define mfbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \
1118     mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w))
1119 #define mfbScanlineNoBankSwitch(_ptr, _x, _y, _w) \
1120     mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
1121
1122 #ifdef MFB_LINE_BANK
1123
1124 #include "mfblinebank.h" /* get macro definitions from this file */
1125
1126 #else /* !MFB_LINE_BANK - unbanked case */
1127
1128 #define mfbScanlineInc(_ptr, _off)       mfbScanlineIncNoBankSwitch(_ptr, _off)
1129 #define mfbScanlineIncSrc(_ptr, _off)     mfbScanlineInc(_ptr, _off)
1130 #define mfbScanlineIncDst(_ptr, _off)     mfbScanlineInc(_ptr, _off)
1131
1132 #define mfbScanlineOffset(_ptr, _off) mfbScanlineOffsetNoBankSwitch(_ptr, _off)
1133 #define mfbScanlineOffsetSrc(_ptr, _off)  mfbScanlineOffset(_ptr, _off)
1134 #define mfbScanlineOffsetDst(_ptr, _off)  mfbScanlineOffset(_ptr, _off)
1135
1136 #define mfbScanlineSrc(_ptr, _x, _y, _w)  mfbScanline(_ptr, _x, _y, _w)
1137 #define mfbScanlineDst(_ptr, _x, _y, _w)  mfbScanline(_ptr, _x, _y, _w)
1138
1139 #define mfbScanlineDeltaSrc(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w)
1140 #define mfbScanlineDeltaDst(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w)
1141
1142 #endif /* MFB_LINE_BANK */
1143
1144 #define mfbScanlineDelta(_ptr, _y, _w) \
1145     mfbScanlineOffset(_ptr, (_y) * (_w))
1146
1147 #define mfbScanline(_ptr, _x, _y, _w) \
1148     mfbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
1149
1150
1151 /* precomputed information about each glyph for GlyphBlt code.
1152    this saves recalculating the per glyph information for each box.
1153 */
1154 typedef struct _pos{
1155     int xpos;           /* xposition of glyph's origin */
1156     int xchar;          /* x position mod 32 */
1157     int leftEdge;
1158     int rightEdge;
1159     int topEdge;
1160     int bottomEdge;
1161     PixelType *pdstBase;        /* longword with character origin */
1162     int widthGlyph;     /* width in bytes of this glyph */
1163 } TEXTPOS;
1164
1165 /* reduced raster ops for mfb */
1166 #define RROP_BLACK      GXclear
1167 #define RROP_WHITE      GXset
1168 #define RROP_NOP        GXnoop
1169 #define RROP_INVERT     GXinvert
1170
1171 /* macros for mfbbitblt.c, mfbfillsp.c
1172    these let the code do one switch on the rop per call, rather
1173 than a switch on the rop per item (span or rectangle.)
1174 */
1175
1176 #define fnCLEAR(src, dst)       (0)
1177 #define fnAND(src, dst)         (src & dst)
1178 #define fnANDREVERSE(src, dst)  (src & ~dst)
1179 #define fnCOPY(src, dst)        (src)
1180 #define fnANDINVERTED(src, dst) (~src & dst)
1181 #define fnNOOP(src, dst)        (dst)
1182 #define fnXOR(src, dst)         (src ^ dst)
1183 #define fnOR(src, dst)          (src | dst)
1184 #define fnNOR(src, dst)         (~(src | dst))
1185 #define fnEQUIV(src, dst)       (~src ^ dst)
1186 #define fnINVERT(src, dst)      (~dst)
1187 #define fnORREVERSE(src, dst)   (src | ~dst)
1188 #define fnCOPYINVERTED(src, dst)(~src)
1189 #define fnORINVERTED(src, dst)  (~src | dst)
1190 #define fnNAND(src, dst)        (~(src & dst))
1191 #define fnSET(src, dst)         (~0)
1192
1193 /*  Using a "switch" statement is much faster in most cases
1194  *  since the compiler can do a look-up table or multi-way branch
1195  *  instruction, depending on the architecture.  The result on
1196  *  A Sun 3/50 is at least 2.5 times faster, assuming a uniform
1197  *  distribution of RasterOp operation types.
1198  *
1199  *  However, doing some profiling on a running system reveals
1200  *  GXcopy is the operation over 99.5% of the time and
1201  *  GXxor is the next most frequent (about .4%), so we make special
1202  *  checks for those first.
1203  *
1204  *  Note that this requires a change to the "calling sequence"
1205  *  since we can't engineer a "switch" statement to have an lvalue.
1206  */
1207 #define DoRop(result, alu, src, dst) \
1208 { \
1209     if (alu == GXcopy) \
1210         result = fnCOPY (src, dst); \
1211     else if (alu == GXxor) \
1212         result = fnXOR (src, dst); \
1213     else \
1214         switch (alu) \
1215         { \
1216           case GXclear: \
1217             result = fnCLEAR (src, dst); \
1218             break; \
1219           case GXand: \
1220             result = fnAND (src, dst); \
1221             break; \
1222           case GXandReverse: \
1223             result = fnANDREVERSE (src, dst); \
1224             break; \
1225           case GXandInverted: \
1226             result = fnANDINVERTED (src, dst); \
1227             break; \
1228           case GXnoop: \
1229             result = fnNOOP (src, dst); \
1230             break; \
1231           case GXor: \
1232             result = fnOR (src, dst); \
1233             break; \
1234           case GXnor: \
1235             result = fnNOR (src, dst); \
1236             break; \
1237           case GXequiv: \
1238             result = fnEQUIV (src, dst); \
1239             break; \
1240           case GXinvert: \
1241             result = fnINVERT (src, dst); \
1242             break; \
1243           case GXorReverse: \
1244             result = fnORREVERSE (src, dst); \
1245             break; \
1246           case GXcopyInverted: \
1247             result = fnCOPYINVERTED (src, dst); \
1248             break; \
1249           case GXorInverted: \
1250             result = fnORINVERTED (src, dst); \
1251             break; \
1252           case GXnand: \
1253             result = fnNAND (src, dst); \
1254             break; \
1255           case GXset: \
1256             result = fnSET (src, dst); \
1257             break; \
1258         } \
1259 }
1260
1261
1262 /*  C expression fragments for various operations.  These get passed in
1263  *  as -D's on the compile command line.  See mfb/Imakefile.  This
1264  *  fixes XBUG 6319.
1265  *
1266  *  This seems like a good place to point out that mfb's use of the
1267  *  words black and white is an unfortunate misnomer.  In mfb code, black
1268  *  means zero, and white means one.
1269  */
1270 #define MFB_OPEQ_WHITE  |=
1271 #define MFB_OPEQ_BLACK  &=~
1272 #define MFB_OPEQ_INVERT ^=
1273 #define MFB_EQWHOLEWORD_WHITE   =~0
1274 #define MFB_EQWHOLEWORD_BLACK   =0
1275 #define MFB_EQWHOLEWORD_INVERT  ^=~0
1276 #define MFB_OP_WHITE    /* nothing */
1277 #define MFB_OP_BLACK    ~