1 /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
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.
32 #ifdef HAVE_DIX_CONFIG_H
33 #include <dix-config.h>
39 #include "regionstr.h"
40 #include "scrnintstr.h"
41 #include "pixmapstr.h"
42 #include "windowstr.h"
45 *-----------------------------------------------------------------------
47 * Function called by miSaveAreas to actually fetch the areas to be
48 * saved into the backing pixmap. This is very simple to do, since
49 * afbDoBitblt is designed for this very thing. The region to save is
50 * already destination-relative and we're given the offset to the
51 * window origin, so we have only to create an array of points of the
52 * u.l. corners of the boxes in the region translated to the screen
53 * coordinate system and fetch the screen pixmap out of its devPrivate
60 * Data are copied from the screen into the pixmap.
62 *-----------------------------------------------------------------------
65 afbSaveAreas(pPixmap
, prgnSave
, xorg
, yorg
, pWin
)
66 PixmapPtr pPixmap
; /* Backing pixmap */
67 RegionPtr prgnSave
; /* Region to save (pixmap-relative) */
68 int xorg
; /* X origin of region */
69 int yorg
; /* Y origin of region */
72 register DDXPointPtr pPt
;
75 register int numRects
;
77 numRects
= REGION_NUM_RECTS(prgnSave
);
78 pPtsInit
= (DDXPointPtr
)ALLOCATE_LOCAL(numRects
* sizeof(DDXPointRec
));
82 pBox
= REGION_RECTS(prgnSave
);
85 pPt
->x
= pBox
->x1
+ xorg
;
86 pPt
->y
= pBox
->y1
+ yorg
;
91 afbDoBitblt((DrawablePtr
)pPixmap
->drawable
.pScreen
->devPrivates
[afbScreenPrivateIndex
].ptr
,
95 pPtsInit
, wBackingBitPlanes (pWin
));
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 * afbDoBitblt 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 afbRestoreAreas(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
);
141 pPt
->x
= pBox
->x1
- xorg
;
142 pPt
->y
= pBox
->y1
- yorg
;
147 afbDoBitblt((DrawablePtr
)pPixmap
,
148 (DrawablePtr
)pPixmap
->drawable
.pScreen
->devPrivates
[afbScreenPrivateIndex
].ptr
,
151 pPtsInit
, wBackingBitPlanes (pWin
));
153 DEALLOCATE_LOCAL(pPtsInit
);