3 Copyright (c) 1999 - The XFree86 Project Inc.
5 Written by Mark Vojkovich
9 #ifdef HAVE_XORG_CONFIG_H
10 #include <xorg-config.h>
15 #include "xf86_OSproc.h"
18 #include "scrnintstr.h"
19 #include "pixmapstr.h"
20 #include "windowstr.h"
27 #include "xf86fbman.h"
31 XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
33 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
34 PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
38 pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
39 pLink->area = pPriv->offscreenArea;
40 XAAMoveOutOffscreenPixmap(pLink->pPix);
48 XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
50 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
51 PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
52 PixmapPtr pPix, pScreenPix, tmpPix;
58 pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
62 pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
65 data = pPix->devPrivate.ptr;
66 tmpPix = GetScratchPixmapHeader(pScreen,
67 pPix->drawable.width, pPix->drawable.height,
68 pPix->drawable.depth, pPix->drawable.bitsPerPixel,
71 pPriv->freeData = FALSE;
73 pPix->drawable.x = area->box.x1;
74 pPix->drawable.y = area->box.y1;
75 pPix->devKind = pScreenPix->devKind;
76 pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
77 pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
78 pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
81 pPriv->offscreenArea = area;
87 pGC = GetScratchGC(pPix->drawable.depth, pScreen);
88 ValidateGC((DrawablePtr)pPix, pGC);
90 (*pGC->ops->CopyArea)((DrawablePtr)tmpPix, (DrawablePtr)pPix, pGC,
91 0, 0, pPix->drawable.width, pPix->drawable.height, 0, 0);
94 tmpPix->devPrivate.ptr = NULL;
97 FreeScratchPixmapHeader(tmpPix);
99 pPriv->offscreenArea = area;
107 XAARemoveAreaCallback(FBAreaPtr area)
109 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
110 PixmapPtr pPix = (PixmapPtr)area->devPrivate.ptr;
111 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
113 XAAMoveOutOffscreenPixmap(pPix);
115 pPriv->flags &= ~OFFSCREEN;
117 DELIST_OFFSCREEN_PIXMAP(pPix);
121 XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
123 ScreenPtr pScreen = pPix->drawable.pScreen;
124 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
125 int width, height, devKind, bitsPerPixel;
130 width = pPix->drawable.width;
131 height = pPix->drawable.height;
132 bitsPerPixel = pPix->drawable.bitsPerPixel;
134 devKind = BitmapBytePad(width * bitsPerPixel);
135 if(!(data = malloc(devKind * height)))
136 FatalError("Out of memory\n");
138 tmpPix = GetScratchPixmapHeader(pScreen, width, height,
139 pPix->drawable.depth, bitsPerPixel, devKind, data);
142 FatalError("Out of memory\n");
145 pGC = GetScratchGC(pPix->drawable.depth, pScreen);
146 ValidateGC((DrawablePtr)tmpPix, pGC);
148 (*pGC->ops->CopyArea)((DrawablePtr)pPix, (DrawablePtr)tmpPix,
149 pGC, 0, 0, width, height, 0, 0);
152 FreeScratchPixmapHeader(tmpPix);
154 pPix->drawable.x = 0;
155 pPix->drawable.y = 0;
156 pPix->devKind = devKind;
157 pPix->devPrivate.ptr = data;
158 pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
160 pPriv->offscreenArea = NULL;
161 pPriv->freeData = TRUE;