1
/* $XFree86: xc/programs/Xserver/ilbm/ilbmbstore.c,v 3.0 1996/08/18 01:53:43 dawes Exp $ */
2
/* $XConsortium: ilbmbstore.c,v 5.7 94/04/17 20:28:18 dpw Exp $ */
3
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
6
Copyright (c) 1987 X Consortium
8
Permission is hereby granted, free of charge, to any person obtaining
9
a copy of this software and associated documentation files (the
10
"Software"), to deal in the Software without restriction, including
11
without limitation the rights to use, copy, modify, merge, publish,
12
distribute, sublicense, and/or sell copies of the Software, and to
13
permit persons to whom the Software is furnished to do so, subject to
14
the following conditions:
16
The above copyright notice and this permission notice shall be included
17
in all copies or substantial portions of the Software.
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
23
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
OTHER DEALINGS IN THE SOFTWARE.
27
Except as contained in this notice, the name of the X Consortium shall
28
not be used in advertising or otherwise to promote the sale, use or
29
other dealings in this Software without prior written authorization
30
from the X Consortium.
34
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
35
to use interleaved bitplanes instead of normal bitplanes */
40
#include "regionstr.h"
41
#include "scrnintstr.h"
42
#include "pixmapstr.h"
43
#include "windowstr.h"
46
*-----------------------------------------------------------------------
48
* Function called by miSaveAreas to actually fetch the areas to be
49
* saved into the backing pixmap. This is very simple to do, since
50
* ilbmDoBitblt is designed for this very thing. The region to save is
51
* already destination-relative and we're given the offset to the
52
* window origin, so we have only to create an array of points of the
53
* u.l. corners of the boxes in the region translated to the screen
54
* coordinate system and fetch the screen pixmap out of its devPrivate
61
* Data are copied from the screen into the pixmap.
63
*-----------------------------------------------------------------------
66
ilbmSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
67
PixmapPtr pPixmap; /* Backing pixmap */
68
RegionPtr prgnSave; /* Region to save (pixmap-relative) */
69
int xorg; /* X origin of region */
70
int yorg; /* Y origin of region */
73
register DDXPointPtr pPt;
76
register int numRects;
78
numRects = REGION_NUM_RECTS(prgnSave);
79
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec));
83
pBox = REGION_RECTS(prgnSave);
86
pPt->x = pBox->x1 + xorg;
87
pPt->y = pBox->y1 + yorg;
92
ilbmDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr,
96
pPtsInit, wBackingBitPlanes (pWin));
98
DEALLOCATE_LOCAL(pPtsInit);
102
*-----------------------------------------------------------------------
103
* ilbmRestoreAreas --
104
* Function called by miRestoreAreas to actually fetch the areas to be
105
* restored from the backing pixmap. This is very simple to do, since
106
* ilbmDoBitblt is designed for this very thing. The region to restore is
107
* already destination-relative and we're given the offset to the
108
* window origin, so we have only to create an array of points of the
109
* u.l. corners of the boxes in the region translated to the pixmap
110
* coordinate system and fetch the screen pixmap out of its devPrivate
117
* Data are copied from the pixmap into the screen.
119
*-----------------------------------------------------------------------
122
ilbmRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
123
PixmapPtr pPixmap; /* Backing pixmap */
124
RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
125
int xorg; /* X origin of window */
126
int yorg; /* Y origin of window */
129
register DDXPointPtr pPt;
130
DDXPointPtr pPtsInit;
131
register BoxPtr pBox;
132
register int numRects;
134
numRects = REGION_NUM_RECTS(prgnRestore);
135
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec));
139
pBox = REGION_RECTS(prgnRestore);
142
pPt->x = pBox->x1 - xorg;
143
pPt->y = pBox->y1 - yorg;
148
ilbmDoBitblt((DrawablePtr)pPixmap,
149
(DrawablePtr)pPixmap->drawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr,
152
pPtsInit, wBackingBitPlanes (pWin));
154
DEALLOCATE_LOCAL(pPtsInit);