(file) Return to iplbstore.c CVS log (file) (dir) Up to [XFree86 CVS] / xc / programs / Xserver / iplan2p4

  1 dawes 3.2 /* $XFree86: xc/programs/Xserver/iplan2p4/iplbstore.c,v 3.1 2005/10/14 15:17:18 tsi Exp $ */
  2 dawes 3.0 
  3 tsi   3.1 /*
  4 dawes 3.0  * iplbstore.c --
  5            *	Functions required by the backing-store implementation in MI.
  6            *
  7            * Copyright (c) 1987 by the Regents of the University of California
  8            *
  9            * Permission to use, copy, modify, and distribute this
 10            * software and its documentation for any purpose and without
 11            * fee is hereby granted, provided that the above copyright
 12            * notice appear in all copies.  The University of California
 13            * makes no representations about the suitability of this
 14            * software for any purpose.  It is provided "as is" without
 15            * express or implied warranty.
 16            *
 17            *
 18            */
 19           
 20           /* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
 21           interleaved planes */
 22           
 23           #include    "ipl.h"
 24 tsi   3.1 #include    <X11/X.h>
 25 dawes 3.0 #include    "mibstore.h"
 26           #include    "regionstr.h"
 27           #include    "scrnintstr.h"
 28           #include    "pixmapstr.h"
 29           #include    "windowstr.h"
 30           
 31 tsi   3.1 /*
 32 dawes 3.0  *-----------------------------------------------------------------------
 33            * iplSaveAreas --
 34            *	Function called by miSaveAreas to actually fetch the areas to be
 35            *	saved into the backing pixmap. This is very simple to do, since
 36            *	iplDoBitblt is designed for this very thing. The region to save is
 37            *	already destination-relative and we're given the offset to the
 38            *	window origin, so we have only to create an array of points of the
 39            *	u.l. corners of the boxes in the region translated to the screen
 40            *	coordinate system and fetch the screen pixmap out of its devPrivate
 41            *	field....
 42            *
 43            * Results:
 44            *	None.
 45            *
 46            * Side Effects:
 47            *	Data are copied from the screen into the pixmap.
 48            *
 49            *-----------------------------------------------------------------------
 50            */
 51           void
 52           iplSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
 53 dawes 3.0     PixmapPtr	  	pPixmap;  	/* Backing pixmap */
 54               RegionPtr	  	prgnSave; 	/* Region to save (pixmap-relative) */
 55               int	    	  	xorg;	    	/* X origin of region */
 56               int	    	  	yorg;	    	/* Y origin of region */
 57               WindowPtr		pWin;
 58           {
 59               register DDXPointPtr pPt;
 60               DDXPointPtr		pPtsInit;
 61               register BoxPtr	pBox;
 62               register int	i;
 63               ScreenPtr		pScreen = pPixmap->drawable.pScreen;
 64               PixmapPtr		pScrPix;
 65               
 66               i = REGION_NUM_RECTS(prgnSave);
 67               pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
 68               if (!pPtsInit)
 69           	return;
 70               
 71               pBox = REGION_RECTS(prgnSave);
 72               pPt = pPtsInit;
 73               while (--i >= 0) {
 74 dawes 3.0 	pPt->x = pBox->x1 + xorg;
 75           	pPt->y = pBox->y1 + yorg;
 76           	pPt++;
 77           	pBox++;
 78               }
 79           
 80           #ifdef CFB_NEED_SCREEN_PRIVATE
 81               pScrPix = (PixmapPtr) pScreen->devPrivates[iplScreenPrivateIndex].ptr;
 82           #else
 83               pScrPix = (PixmapPtr) pScreen->devPrivate;
 84           #endif
 85           
 86               iplDoBitbltCopy((DrawablePtr) pScrPix, (DrawablePtr)pPixmap,
 87           		    GXcopy, prgnSave, pPtsInit, ~0L);
 88           
 89               DEALLOCATE_LOCAL (pPtsInit);
 90           }
 91           
 92 tsi   3.1 /*
 93 dawes 3.0  *-----------------------------------------------------------------------
 94            * iplRestoreAreas --
 95            *	Function called by miRestoreAreas to actually fetch the areas to be
 96            *	restored from the backing pixmap. This is very simple to do, since
 97            *	iplDoBitblt is designed for this very thing. The region to restore is
 98            *	already destination-relative and we're given the offset to the
 99            *	window origin, so we have only to create an array of points of the
100            *	u.l. corners of the boxes in the region translated to the pixmap
101            *	coordinate system and fetch the screen pixmap out of its devPrivate
102            *	field....
103            *
104            * Results:
105            *	None.
106            *
107            * Side Effects:
108            *	Data are copied from the pixmap into the screen.
109            *
110            *-----------------------------------------------------------------------
111            */
112           void
113           iplRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
114 dawes 3.0     PixmapPtr	  	pPixmap;  	/* Backing pixmap */
115               RegionPtr	  	prgnRestore; 	/* Region to restore (screen-relative)*/
116               int	    	  	xorg;	    	/* X origin of window */
117               int	    	  	yorg;	    	/* Y origin of window */
118               WindowPtr		pWin;
119           {
120               register DDXPointPtr pPt;
121               DDXPointPtr		pPtsInit;
122               register BoxPtr	pBox;
123               register int	i;
124               ScreenPtr		pScreen = pPixmap->drawable.pScreen;
125               PixmapPtr		pScrPix;
126               
127               i = REGION_NUM_RECTS(prgnRestore);
128               pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec));
129               if (!pPtsInit)
130           	return;
131               
132               pBox = REGION_RECTS(prgnRestore);
133               pPt = pPtsInit;
134               while (--i >= 0) {
135 dawes 3.0 	pPt->x = pBox->x1 - xorg;
136           	pPt->y = pBox->y1 - yorg;
137           	pPt++;
138           	pBox++;
139               }
140           
141           #ifdef CFB_NEED_SCREEN_PRIVATE
142               pScrPix = (PixmapPtr) pScreen->devPrivates[iplScreenPrivateIndex].ptr;
143           #else
144               pScrPix = (PixmapPtr) pScreen->devPrivate;
145           #endif
146           
147               iplDoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
148           		    GXcopy, prgnRestore, pPtsInit, ~0L);
149           
150               DEALLOCATE_LOCAL (pPtsInit);
151           }

Powered by
ViewCVS 0.9.2