1
/* $Xorg: mfbbstore.c,v 1.4 2001/02/09 02:05:18 xorgcvs Exp $ */
2
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
5
Copyright 1987, 1998 The Open Group
7
Permission to use, copy, modify, distribute, and sell this software and its
8
documentation for any purpose is hereby granted without fee, provided that
9
the above copyright notice appear in all copies and that both that
10
copyright notice and this permission notice appear in supporting
13
The above copyright notice and this permission notice shall be included
14
in all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
OTHER DEALINGS IN THE SOFTWARE.
24
Except as contained in this notice, the name of The Open Group shall
25
not be used in advertising or otherwise to promote the sale, use or
26
other dealings in this Software without prior written authorization
31
#ifdef HAVE_DIX_CONFIG_H
32
#include <dix-config.h>
38
#include "regionstr.h"
39
#include "scrnintstr.h"
40
#include "pixmapstr.h"
41
#include "windowstr.h"
44
*-----------------------------------------------------------------------
46
* Function called by miSaveAreas to actually fetch the areas to be
47
* saved into the backing pixmap. This is very simple to do, since
48
* mfbDoBitblt is designed for this very thing. The region to save is
49
* already destination-relative and we're given the offset to the
50
* window origin, so we have only to create an array of points of the
51
* u.l. corners of the boxes in the region translated to the screen
52
* coordinate system and fetch the screen pixmap out of its devPrivate
59
* Data are copied from the screen into the pixmap.
61
*-----------------------------------------------------------------------
64
mfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
65
PixmapPtr pPixmap; /* Backing pixmap */
66
RegionPtr prgnSave; /* Region to save (pixmap-relative) */
67
int xorg; /* X origin of region */
68
int yorg; /* Y origin of region */
71
register DDXPointPtr pPt;
74
register int numRects;
76
numRects = REGION_NUM_RECTS(prgnSave);
77
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec));
81
pBox = REGION_RECTS(prgnSave);
85
pPt->x = pBox->x1 + xorg;
86
pPt->y = pBox->y1 + yorg;
91
mfbDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivate,
97
DEALLOCATE_LOCAL(pPtsInit);
101
*-----------------------------------------------------------------------
103
* Function called by miRestoreAreas to actually fetch the areas to be
104
* restored from the backing pixmap. This is very simple to do, since
105
* mfbDoBitblt is designed for this very thing. The region to restore is
106
* already destination-relative and we're given the offset to the
107
* window origin, so we have only to create an array of points of the
108
* u.l. corners of the boxes in the region translated to the pixmap
109
* coordinate system and fetch the screen pixmap out of its devPrivate
116
* Data are copied from the pixmap into the screen.
118
*-----------------------------------------------------------------------
121
mfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
122
PixmapPtr pPixmap; /* Backing pixmap */
123
RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
124
int xorg; /* X origin of window */
125
int yorg; /* Y origin of window */
128
register DDXPointPtr pPt;
129
DDXPointPtr pPtsInit;
130
register BoxPtr pBox;
131
register int numRects;
133
numRects = REGION_NUM_RECTS(prgnRestore);
134
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec));
138
pBox = REGION_RECTS(prgnRestore);
142
pPt->x = pBox->x1 - xorg;
143
pPt->y = pBox->y1 - yorg;
148
mfbDoBitblt((DrawablePtr)pPixmap,
149
(DrawablePtr)pPixmap->drawable.pScreen->devPrivate,
154
DEALLOCATE_LOCAL(pPtsInit);