3 * Functions required by the backing-store implementation in MI.
5 * Copyright (c) 1987 by the Regents of the University of California
7 * Permission to use, copy, modify, and distribute this
8 * software and its documentation for any purpose and without
9 * fee is hereby granted, provided that the above copyright
10 * notice appear in all copies. The University of California
11 * makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without
13 * express or implied warranty.
19 "$XConsortium: cfbbstore.c,v 5.8 93/12/13 17:21:51 dpw Exp $ SPRITE (Berkeley)";
25 #include "regionstr.h"
26 #include "scrnintstr.h"
27 #include "pixmapstr.h"
28 #include "windowstr.h"
31 *-----------------------------------------------------------------------
33 * Function called by miSaveAreas to actually fetch the areas to be
34 * saved into the backing pixmap. This is very simple to do, since
35 * cfbDoBitblt is designed for this very thing. The region to save is
36 * already destination-relative and we're given the offset to the
37 * window origin, so we have only to create an array of points of the
38 * u.l. corners of the boxes in the region translated to the screen
39 * coordinate system and fetch the screen pixmap out of its devPrivate
46 * Data are copied from the screen into the pixmap.
48 *-----------------------------------------------------------------------
51 cfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
52 PixmapPtr pPixmap; /* Backing pixmap */
53 RegionPtr prgnSave; /* Region to save (pixmap-relative) */
54 int xorg; /* X origin of region */
55 int yorg; /* Y origin of region */
58 register DDXPointPtr pPt;
62 ScreenPtr pScreen = pPixmap->drawable.pScreen;
65 i = REGION_NUM_RECTS(prgnSave);
66 pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
70 pBox = REGION_RECTS(prgnSave);
73 pPt->x = pBox->x1 + xorg;
74 pPt->y = pBox->y1 + yorg;
79 #ifdef CFB_NEED_SCREEN_PRIVATE
80 pScrPix = (PixmapPtr) pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
82 pScrPix = (PixmapPtr) pScreen->devPrivate;
85 cfbDoBitbltCopy((DrawablePtr) pScrPix, (DrawablePtr)pPixmap,
86 GXcopy, prgnSave, pPtsInit, ~0L);
88 DEALLOCATE_LOCAL (pPtsInit);
92 *-----------------------------------------------------------------------
94 * Function called by miRestoreAreas to actually fetch the areas to be
95 * restored from the backing pixmap. This is very simple to do, since
96 * cfbDoBitblt is designed for this very thing. The region to restore is
97 * already destination-relative and we're given the offset to the
98 * window origin, so we have only to create an array of points of the
99 * u.l. corners of the boxes in the region translated to the pixmap
100 * coordinate system and fetch the screen pixmap out of its devPrivate
107 * Data are copied from the pixmap into the screen.
109 *-----------------------------------------------------------------------
112 cfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
113 PixmapPtr pPixmap; /* Backing pixmap */
114 RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
115 int xorg; /* X origin of window */
116 int yorg; /* Y origin of window */
119 register DDXPointPtr pPt;
120 DDXPointPtr pPtsInit;
121 register BoxPtr pBox;
123 ScreenPtr pScreen = pPixmap->drawable.pScreen;
126 i = REGION_NUM_RECTS(prgnRestore);
127 pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec));
131 pBox = REGION_RECTS(prgnRestore);
134 pPt->x = pBox->x1 - xorg;
135 pPt->y = pBox->y1 - yorg;
140 #ifdef CFB_NEED_SCREEN_PRIVATE
141 pScrPix = (PixmapPtr) pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
143 pScrPix = (PixmapPtr) pScreen->devPrivate;
146 cfbDoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
147 GXcopy, prgnRestore, pPtsInit, ~0L);
149 DEALLOCATE_LOCAL (pPtsInit);