Initial commit
[xorg_rtime.git] / xorg-server-1.4 / hw / xfree86 / xf4bpp / ppcPntWin.c
blob5d7a07e12ef5694f762a503ef63141ea51268d3f
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 /***********************************************************
26 Copyright (c) 1987 X Consortium
28 Permission is hereby granted, free of charge, to any person obtaining a copy
29 of this software and associated documentation files (the "Software"), to deal
30 in the Software without restriction, including without limitation the rights
31 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32 copies of the Software, and to permit persons to whom the Software is
33 furnished to do so, subject to the following conditions:
35 The above copyright notice and this permission notice shall be included in
36 all copies or substantial portions of the Software.
38 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
42 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
43 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 Except as contained in this notice, the name of the X Consortium shall not be
46 used in advertising or otherwise to promote the sale, use or other dealings
47 in this Software without prior written authorization from the X Consortium.
50 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
52 All Rights Reserved
54 Permission to use, copy, modify, and distribute this software and its
55 documentation for any purpose and without fee is hereby granted,
56 provided that the above copyright notice appear in all copies and that
57 both that copyright notice and this permission notice appear in
58 supporting documentation, and that the name of Digital not be
59 used in advertising or publicity pertaining to distribution of the
60 software without specific, written prior permission.
62 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
63 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
64 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
65 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
66 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
67 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
68 SOFTWARE.
70 ******************************************************************/
72 #ifdef HAVE_XORG_CONFIG_H
73 #include <xorg-config.h>
74 #endif
76 #include "xf4bpp.h"
77 #include "mfbmap.h"
78 #include "mfb.h"
79 #include "mi.h"
80 #include "scrnintstr.h"
81 #include "ibmTrace.h"
83 /* NOTE: These functions only work for visuals up to 31-bits deep */
84 static void xf4bppPaintWindowSolid(
85 WindowPtr,
86 RegionPtr,
87 int
89 static void xf4bppPaintWindowTile(
90 WindowPtr,
91 RegionPtr,
92 int
95 void
96 xf4bppPaintWindow(pWin, pRegion, what)
97 WindowPtr pWin;
98 RegionPtr pRegion;
99 int what;
102 register mfbPrivWin *pPrivWin;
103 pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbGetWindowPrivateIndex()].ptr);
105 TRACE(("xf4bppPaintWindow( pWin= 0x%x, pRegion= 0x%x, what= %d )\n",
106 pWin,pRegion,what));
108 switch (what) {
109 case PW_BACKGROUND:
110 switch (pWin->backgroundState) {
111 case None:
112 return;
113 case ParentRelative:
114 do {
115 pWin = pWin->parent;
116 } while (pWin->backgroundState == ParentRelative);
117 (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
118 what);
119 return;
120 case BackgroundPixmap:
121 if (pPrivWin->fastBackground)
123 xf4bppPaintWindowTile(pWin, pRegion, what);
124 return;
126 break;
127 case BackgroundPixel:
128 xf4bppPaintWindowSolid(pWin, pRegion, what);
129 return;
131 break;
132 case PW_BORDER:
133 if (pWin->borderIsPixel)
135 xf4bppPaintWindowSolid(pWin, pRegion, what);
136 return;
138 else if (pPrivWin->fastBorder)
140 xf4bppPaintWindowTile(pWin, pRegion, what);
141 return;
143 break;
145 miPaintWindow(pWin, pRegion, what);
148 static void
149 xf4bppPaintWindowSolid(pWin, pRegion, what)
150 register WindowPtr pWin;
151 register RegionPtr pRegion;
152 int what;
154 register int nbox;
155 register BoxPtr pbox;
156 register unsigned long int pixel;
157 register unsigned long int pm ;
159 TRACE(("xf4bppPaintWindowSolid(pWin= 0x%x, pRegion= 0x%x, what= %d)\n", pWin, pRegion, what));
161 if ( !( nbox = REGION_NUM_RECTS(pRegion)))
162 return ;
163 pbox = REGION_RECTS(pRegion);
165 if (what == PW_BACKGROUND)
166 pixel = pWin->background.pixel;
167 else
168 pixel = pWin->border.pixel;
170 pm = ( 1 << pWin->drawable.depth ) - 1 ;
171 for ( ; nbox-- ; pbox++ ) {
173 * call fill routine, the parms are:
174 * fill(color, alu, planes, x, y, width, height);
176 xf4bppFillSolid( pWin, pixel, GXcopy, pm, pbox->x1, pbox->y1,
177 pbox->x2 - pbox->x1, pbox->y2 - pbox->y1 ) ;
179 return ;
182 static void
183 xf4bppPaintWindowTile(pWin, pRegion, what)
184 register WindowPtr pWin;
185 register RegionPtr pRegion;
186 int what;
188 register int nbox;
189 register BoxPtr pbox;
190 register PixmapPtr pTile;
191 register unsigned long int pm ;
193 TRACE(("xf4bppPaintWindowTile(pWin= 0x%x, pRegion= 0x%x, what= %d)\n", pWin, pRegion, what));
195 if ( !( nbox = REGION_NUM_RECTS(pRegion)))
196 return ;
197 pbox = REGION_RECTS(pRegion);
199 if (what == PW_BACKGROUND)
200 pTile = pWin->background.pixmap;
201 else
202 pTile = pWin->border.pixmap;
204 pm = ( 1 << pWin->drawable.depth ) - 1 ;
205 for ( ; nbox-- ; pbox++ ) {
207 * call tile routine, the parms are:
208 * tile(tile, alu, planes, x, y, width, height,xSrc,ySrc);
210 xf4bppTileRect(pWin, pTile, GXcopy, pm,
211 pbox->x1, pbox->y1,
212 pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
213 pWin->drawable.x, pWin->drawable.y );
215 return ;