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 */
37
#ifdef HAVE_DIX_CONFIG_H
38
#include <dix-config.h>
44
#include "regionstr.h"
45
#include "scrnintstr.h"
46
#include "pixmapstr.h"
47
#include "windowstr.h"
50
*-----------------------------------------------------------------------
52
* Function called by miSaveAreas to actually fetch the areas to be
53
* saved into the backing pixmap. This is very simple to do, since
54
* ilbmDoBitblt is designed for this very thing. The region to save is
55
* already destination-relative and we're given the offset to the
56
* window origin, so we have only to create an array of points of the
57
* u.l. corners of the boxes in the region translated to the screen
58
* coordinate system and fetch the screen pixmap out of its devPrivate
65
* Data are copied from the screen into the pixmap.
67
*-----------------------------------------------------------------------
70
ilbmSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
71
PixmapPtr pPixmap; /* Backing pixmap */
72
RegionPtr prgnSave; /* Region to save (pixmap-relative) */
73
int xorg; /* X origin of region */
74
int yorg; /* Y origin of region */
77
register DDXPointPtr pPt;
80
register int numRects;
82
numRects = REGION_NUM_RECTS(prgnSave);
83
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec));
87
pBox = REGION_RECTS(prgnSave);
90
pPt->x = pBox->x1 + xorg;
91
pPt->y = pBox->y1 + yorg;
96
ilbmDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr,
100
pPtsInit, wBackingBitPlanes (pWin));
102
DEALLOCATE_LOCAL(pPtsInit);
106
*-----------------------------------------------------------------------
107
* ilbmRestoreAreas --
108
* Function called by miRestoreAreas to actually fetch the areas to be
109
* restored from the backing pixmap. This is very simple to do, since
110
* ilbmDoBitblt is designed for this very thing. The region to restore is
111
* already destination-relative and we're given the offset to the
112
* window origin, so we have only to create an array of points of the
113
* u.l. corners of the boxes in the region translated to the pixmap
114
* coordinate system and fetch the screen pixmap out of its devPrivate
121
* Data are copied from the pixmap into the screen.
123
*-----------------------------------------------------------------------
126
ilbmRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
127
PixmapPtr pPixmap; /* Backing pixmap */
128
RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
129
int xorg; /* X origin of window */
130
int yorg; /* Y origin of window */
133
register DDXPointPtr pPt;
134
DDXPointPtr pPtsInit;
135
register BoxPtr pBox;
136
register int numRects;
138
numRects = REGION_NUM_RECTS(prgnRestore);
139
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec));
143
pBox = REGION_RECTS(prgnRestore);
146
pPt->x = pBox->x1 - xorg;
147
pPt->y = pBox->y1 - yorg;
152
ilbmDoBitblt((DrawablePtr)pPixmap,
153
(DrawablePtr)pPixmap->drawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr,
156
pPtsInit, wBackingBitPlanes (pWin));
158
DEALLOCATE_LOCAL(pPtsInit);