Initial commit
[xorg_rtime.git] / xorg-server-1.4 / hw / xfree86 / xf4bpp / ppcArea.c
blobe9569626003d7d1bbc251cb1f810c11d3e0b516d
1 /*
2 * Copyright IBM Corporation 1987,1988,1989
4 * All Rights Reserved
6 * Permission to use, copy, modify, and distribute this software and its
7 * documentation for any purpose and without fee is hereby granted,
8 * provided that the above copyright notice appear in all copies and that
9 * both that copyright notice and this permission notice appear in
10 * supporting documentation, and that the name of IBM not be
11 * used in advertising or publicity pertaining to distribution of the
12 * software without specific, written prior permission.
14 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 * SOFTWARE.
24 /*
25 * ppc solid area fill
27 * Tom Paquin 8/87
30 #ifdef HAVE_XORG_CONFIG_H
31 #include <xorg-config.h>
32 #endif
34 #include "xf4bpp.h"
35 #include "mfbmap.h"
36 #include "mfb.h"
37 #include "ppcGCstr.h"
38 #include "ibmTrace.h"
40 void
41 xf4bppFillArea( pWin, nboxes, pBox, pGC )
42 register WindowPtr pWin ;
43 register int nboxes ;
44 register BoxPtr pBox ;
45 GCPtr pGC ;
47 register int x, y, w, h ;
48 int alu ;
49 unsigned long int fg, bg, pm ;
50 int xSrc, ySrc ;
51 PixmapPtr pPixmap ;
52 ppcPrivGC *pPrivGC = pGC->devPrivates[mfbGetGCPrivateIndex()].ptr;
54 TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ;
56 if ( ( alu = pPrivGC->colorRrop.alu ) == GXnoop || !nboxes )
57 return ;
59 xSrc = pGC->patOrg.x + pWin->drawable.x ;
60 ySrc = pGC->patOrg.y + pWin->drawable.y ;
62 pm = pPrivGC->colorRrop.planemask ;
63 fg = pPrivGC->colorRrop.fgPixel ;
64 bg = pPrivGC->colorRrop.bgPixel ;
66 nboxes++ ;
67 switch ( pPrivGC->colorRrop.fillStyle ) {
68 case FillTiled:
69 for ( pPixmap = pGC->tile.pixmap ; --nboxes ; pBox++ )
70 if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
71 && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
72 xf4bppTileRect( pWin, pPixmap, alu, pm,
73 x, y, w, h, xSrc, ySrc ) ;
74 break ;
75 case FillOpaqueStippled:
76 for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
77 if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
78 && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
79 xf4bppOpaqueStipple( pWin, pPixmap, fg, bg, alu, pm,
80 x, y, w, h, xSrc, ySrc ) ;
81 break ;
82 case FillStippled:
83 for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
84 if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
85 && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
86 xf4bppFillStipple( pWin, pPixmap, fg, alu, pm,
87 x, y, w, h, xSrc, ySrc ) ;
88 break ;
89 case FillSolid:
90 for ( ; --nboxes ; pBox++ )
91 if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
92 && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
93 xf4bppFillSolid( pWin, fg, alu, pm, x, y, w, h ) ;
94 break ;