First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xfree86 / xf8_32bpp / cfbbstore.c
blobf4d570f8b93d59b22798e4388f69bbac8a6c80d4
2 #define PSZ 8
3 #ifdef HAVE_XORG_CONFIG_H
4 #include <xorg-config.h>
5 #endif
7 #include "cfb.h"
8 #undef PSZ
9 #include "cfb32.h"
10 #include "cfb8_32.h"
11 #include <X11/X.h>
12 #include "mibstore.h"
13 #include "regionstr.h"
14 #include "scrnintstr.h"
15 #include "pixmapstr.h"
16 #include "windowstr.h"
18 void
19 cfb8_32SaveAreas(
20 PixmapPtr pPixmap,
21 RegionPtr prgnSave,
22 int xorg,
23 int yorg,
24 WindowPtr pWin
26 DDXPointPtr pPt;
27 DDXPointPtr pPtsInit;
28 BoxPtr pBox;
29 int i;
30 ScreenPtr pScreen = pPixmap->drawable.pScreen;
31 PixmapPtr pScrPix;
33 if(pPixmap->drawable.bitsPerPixel == 32) {
34 cfb32SaveAreas(pPixmap, prgnSave, xorg, yorg, pWin);
35 return;
38 i = REGION_NUM_RECTS(prgnSave);
39 pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
40 if (!pPtsInit)
41 return;
43 pBox = REGION_RECTS(prgnSave);
44 pPt = pPtsInit;
45 while (--i >= 0) {
46 pPt->x = pBox->x1 + xorg;
47 pPt->y = pBox->y1 + yorg;
48 pPt++;
49 pBox++;
52 pScrPix = (PixmapPtr) pScreen->devPrivate;
54 cfbDoBitblt32To8((DrawablePtr) pScrPix, (DrawablePtr)pPixmap,
55 GXcopy, prgnSave, pPtsInit, ~0L);
57 DEALLOCATE_LOCAL (pPtsInit);
61 void
62 cfb8_32RestoreAreas(
63 PixmapPtr pPixmap,
64 RegionPtr prgnRestore,
65 int xorg,
66 int yorg,
67 WindowPtr pWin
69 DDXPointPtr pPt;
70 DDXPointPtr pPtsInit;
71 BoxPtr pBox;
72 int i;
73 ScreenPtr pScreen = pPixmap->drawable.pScreen;
74 PixmapPtr pScrPix;
76 i = REGION_NUM_RECTS(prgnRestore);
77 pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec));
78 if (!pPtsInit)
79 return;
81 pBox = REGION_RECTS(prgnRestore);
82 pPt = pPtsInit;
83 while (--i >= 0) {
84 pPt->x = pBox->x1 - xorg;
85 pPt->y = pBox->y1 - yorg;
86 pPt++;
87 pBox++;
90 pScrPix = (PixmapPtr) pScreen->devPrivate;
92 if(pPixmap->drawable.bitsPerPixel == 32) {
93 if(pWin->drawable.depth == 24)
94 cfb32DoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
95 GXcopy, prgnRestore, pPtsInit, 0x00ffffff);
96 else
97 cfb32DoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
98 GXcopy, prgnRestore, pPtsInit, ~0);
99 } else {
100 cfbDoBitblt8To32((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
101 GXcopy, prgnRestore, pPtsInit, ~0L);
104 DEALLOCATE_LOCAL (pPtsInit);