1
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcWindow.c,v 1.3 1999/06/06 08:49:06 dawes Exp $ */
4
Copyright (c) 1987 X Consortium
6
Permission is hereby granted, free of charge, to any person obtaining
7
a copy of this software and associated documentation files (the
8
"Software"), to deal in the Software without restriction, including
9
without limitation the rights to use, copy, modify, merge, publish,
10
distribute, sublicense, and/or sell copies of the Software, and to
11
permit persons to whom the Software is furnished to do so, subject to
12
the following conditions:
14
The above copyright notice and this permission notice shall be included
15
in all copies or substantial portions of the Software.
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
21
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
OTHER DEALINGS IN THE SOFTWARE.
25
Except as contained in this notice, the name of the X Consortium shall
26
not be used in advertising or otherwise to promote the sale, use or
27
other dealings in this Software without prior written authorization
28
from the X Consortium.
31
Copyright IBM Corporation 1987,1988,1989
34
Permission to use, copy, modify, and distribute this software and its
35
documentation for any purpose and without fee is hereby granted,
36
provided that the above copyright notice appear in all copies and that
37
both that copyright notice and this permission notice appear in
38
supporting documentation, and that the name of IBM not be
39
used in advertising or publicity pertaining to distribution of the
40
software without specific, written prior permission.
42
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
43
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
44
IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
45
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
46
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
47
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
51
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
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
71
/* $XConsortium: ppcWindow.c /main/5 1996/02/21 17:58:43 kaleb $ */
73
#ifdef HAVE_XORG_CONFIG_H
74
#include <xorg-config.h>
80
#include "scrnintstr.h"
84
xf4bppCopyWindow copies only the parts of the destination that are
85
visible in the source.
89
xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc)
90
register WindowPtr pWin ;
91
DDXPointRec ptOldOrg ;
95
register BoxPtr pbox ;
100
BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew ;
101
/* temporaries for shuffling rectangles */
103
TRACE(("xf4bppCopyWindow(pWin= 0x%x, ptOldOrg= 0x%x, prgnSrc= 0x%x)\n", pWin, ptOldOrg, prgnSrc)) ;
106
dx = ptOldOrg.x - pWin->drawable.x ;
107
dy = ptOldOrg.y - pWin->drawable.y ;
108
REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
110
prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
111
REGION_INTERSECT(pWin->drawable.pScreen, prgnDst,
112
&pWin->borderClip, prgnSrc);
114
if ( !( nbox = REGION_NUM_RECTS(prgnDst) ) )
117
pbox = REGION_RECTS(prgnDst);
123
/* walk source bottom to top */
124
/* keep ordering in each band, reverse order of bands */
126
(BoxPtr) ALLOCATE_LOCAL( sizeof( BoxRec ) * nbox ) ) )
128
pboxBase = pboxNext = pbox+nbox - 1 ;
129
while ( pboxBase >= pbox ) {
130
while ( ( pboxNext >= pbox )
131
&& ( pboxBase->y1 == pboxNext->y1 ) )
133
pboxTmp = pboxNext + 1 ;
134
while ( pboxTmp <= pboxBase )
135
*pboxNew++ = *pboxTmp++ ;
136
pboxBase = pboxNext ;
142
/* we can just reverse the entire list in place */
143
/* Do three-position swaps */
147
pboxNext = pbox + nbox - 1 ;
148
while ( pboxBase < pboxNext ) {
149
/* ****** Warning Structure Assignment !! ****** */
151
*pboxBase = *pboxNext ;
159
/* walk source right to left */
160
/* reverse order of rects in each band */
161
if ( !( pboxNew = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox) ) )
163
pboxBase = pboxNext = pbox ;
164
while (pboxBase < pbox+nbox)
166
while ((pboxNext < pbox+nbox) &&
167
(pboxNext->y1 == pboxBase->y1))
170
while (pboxTmp != pboxBase)
171
*pboxNew++ = *--pboxTmp ;
172
pboxBase = pboxNext ;
177
} /* END if nbox > 1 */
180
* call blit several times, the parms are:
181
* blit( alu,rplanes, wplanes, srcx, srcy, destx, desty, width, height ) ;
184
pm = ( 1 << pWin->drawable.depth ) - 1 ;
185
for ( ; nbox-- ; pbox++ )
186
xf4bppBitBlt( pWin, GXcopy, pm,
187
pbox->x1 + dx, pbox->y1 + dy,
189
pbox->x2 - pbox->x1, pbox->y2 - pbox->y1) ;
193
DEALLOCATE_LOCAL( pboxNew ) ;
195
REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
198
Bool xf4bppPositionWindow(pWin, x, y)
199
register WindowPtr pWin ;
206
xf4bppDestroyWindow(pWin)
207
register WindowPtr pWin ;
209
return pWin ? TRUE : FALSE ;
212
/* As The Name Says -- Used For ega, vga and apa8c */
214
xf4bppCreateWindowForXYhardware(pWin)
215
register WindowPtr pWin ;
217
register mfbPrivWin *pPrivWin;
219
TRACE(("xf4bppCreateWindowForXYhardware (pWin= 0x%x)\n", pWin));
221
pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbGetWindowPrivateIndex()].ptr);
222
pPrivWin->pRotatedBorder = NullPixmap;
223
pPrivWin->pRotatedBackground = NullPixmap;
224
pPrivWin->fastBackground = 0;
225
pPrivWin->fastBorder = 0;