1
/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaOffscreen.c,v 1.6 2001/07/19 18:50:16 mvojkovi Exp $ */
4
Copyright (c) 1999 - The XFree86 Project Inc.
6
Written by Mark Vojkovich
12
#include "xf86_ansic.h"
13
#include "xf86_OSproc.h"
16
#include "scrnintstr.h"
17
#include "pixmapstr.h"
18
#include "windowstr.h"
25
#include "xf86fbman.h"
29
XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
31
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
32
PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
36
pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
37
pLink->area = pPriv->offscreenArea;
38
XAAMoveOutOffscreenPixmap(pLink->pPix);
46
XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
48
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
49
PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
50
PixmapPtr pPix, pScreenPix, tmpPix;
56
pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
60
pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
63
data = pPix->devPrivate.ptr;
64
tmpPix = GetScratchPixmapHeader(pScreen,
65
pPix->drawable.width, pPix->drawable.height,
66
pPix->drawable.depth, pPix->drawable.bitsPerPixel,
69
pPriv->freeData = FALSE;
71
pPix->drawable.x = area->box.x1;
72
pPix->drawable.y = area->box.y1;
73
pPix->devKind = pScreenPix->devKind;
74
pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
75
pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
76
pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
79
pPriv->offscreenArea = area;
85
pGC = GetScratchGC(pPix->drawable.depth, pScreen);
86
ValidateGC((DrawablePtr)pPix, pGC);
88
(*pGC->ops->CopyArea)((DrawablePtr)tmpPix, (DrawablePtr)pPix, pGC,
89
0, 0, pPix->drawable.width, pPix->drawable.height, 0, 0);
92
tmpPix->devPrivate.ptr = NULL;
95
FreeScratchPixmapHeader(tmpPix);
97
pPriv->offscreenArea = area;
105
XAARemoveAreaCallback(FBAreaPtr area)
107
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
108
PixmapPtr pPix = (PixmapPtr)area->devPrivate.ptr;
109
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
111
XAAMoveOutOffscreenPixmap(pPix);
113
pPriv->flags &= ~OFFSCREEN;
115
DELIST_OFFSCREEN_PIXMAP(pPix);
119
XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
121
ScreenPtr pScreen = pPix->drawable.pScreen;
122
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
123
int width, height, devKind, bitsPerPixel;
128
width = pPix->drawable.width;
129
height = pPix->drawable.height;
130
bitsPerPixel = pPix->drawable.bitsPerPixel;
132
devKind = BitmapBytePad(width * bitsPerPixel);
133
if(!(data = xalloc(devKind * height)))
134
FatalError("Out of memory\n");
136
tmpPix = GetScratchPixmapHeader(pScreen, width, height,
137
pPix->drawable.depth, bitsPerPixel, devKind, data);
140
FatalError("Out of memory\n");
143
pGC = GetScratchGC(pPix->drawable.depth, pScreen);
144
ValidateGC((DrawablePtr)tmpPix, pGC);
146
(*pGC->ops->CopyArea)((DrawablePtr)pPix, (DrawablePtr)tmpPix,
147
pGC, 0, 0, width, height, 0, 0);
150
FreeScratchPixmapHeader(tmpPix);
152
pPix->drawable.x = 0;
153
pPix->drawable.y = 0;
154
pPix->devKind = devKind;
155
pPix->devPrivate.ptr = data;
156
pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
158
pPriv->offscreenArea = NULL;
159
pPriv->freeData = TRUE;