1 /* $XConsortium: mfbbstore.c,v 5.7 94/04/17 20:28:18 dpw Exp $ */
2 /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
5 Copyright (c) 1987 X Consortium
7 Permission is hereby granted, free of charge, to any person obtaining
8 a copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sublicense, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
15 The above copyright notice and this permission notice shall be included
16 in all copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 OTHER DEALINGS IN THE SOFTWARE.
26 Except as contained in this notice, the name of the X Consortium shall
27 not be used in advertising or otherwise to promote the sale, use or
28 other dealings in this Software without prior written authorization
29 from the X Consortium.
36 #include "regionstr.h"
37 #include "scrnintstr.h"
38 #include "pixmapstr.h"
39 #include "windowstr.h"
42 *-----------------------------------------------------------------------
44 * Function called by miSaveAreas to actually fetch the areas to be
45 * saved into the backing pixmap. This is very simple to do, since
46 * mfbDoBitblt is designed for this very thing. The region to save is
47 * already destination-relative and we're given the offset to the
48 * window origin, so we have only to create an array of points of the
49 * u.l. corners of the boxes in the region translated to the screen
50 * coordinate system and fetch the screen pixmap out of its devPrivate
57 * Data are copied from the screen into the pixmap.
59 *-----------------------------------------------------------------------
62 mfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
63 PixmapPtr pPixmap; /* Backing pixmap */
64 RegionPtr prgnSave; /* Region to save (pixmap-relative) */
65 int xorg; /* X origin of region */
66 int yorg; /* Y origin of region */
69 register DDXPointPtr pPt;
72 register int numRects;
74 numRects = REGION_NUM_RECTS(prgnSave);
75 pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec));
79 pBox = REGION_RECTS(prgnSave);
83 pPt->x = pBox->x1 + xorg;
84 pPt->y = pBox->y1 + yorg;
89 mfbDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivate,
95 DEALLOCATE_LOCAL(pPtsInit);
99 *-----------------------------------------------------------------------
101 * Function called by miRestoreAreas to actually fetch the areas to be
102 * restored from the backing pixmap. This is very simple to do, since
103 * mfbDoBitblt is designed for this very thing. The region to restore is
104 * already destination-relative and we're given the offset to the
105 * window origin, so we have only to create an array of points of the
106 * u.l. corners of the boxes in the region translated to the pixmap
107 * coordinate system and fetch the screen pixmap out of its devPrivate
114 * Data are copied from the pixmap into the screen.
116 *-----------------------------------------------------------------------
119 mfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
120 PixmapPtr pPixmap; /* Backing pixmap */
121 RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
122 int xorg; /* X origin of window */
123 int yorg; /* Y origin of window */
126 register DDXPointPtr pPt;
127 DDXPointPtr pPtsInit;
128 register BoxPtr pBox;
129 register int numRects;
131 numRects = REGION_NUM_RECTS(prgnRestore);
132 pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec));
136 pBox = REGION_RECTS(prgnRestore);
140 pPt->x = pBox->x1 - xorg;
141 pPt->y = pBox->y1 - yorg;
146 mfbDoBitblt((DrawablePtr)pPixmap,
147 (DrawablePtr)pPixmap->drawable.pScreen->devPrivate,
152 DEALLOCATE_LOCAL(pPtsInit);