1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
/*
Copyright (c) 1999 - The XFree86 Project Inc.
Written by Mark Vojkovich
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include <X11/X.h>
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
#include "xf86str.h"
#include "mi.h"
#include "miline.h"
#include "xaa.h"
#include "xaalocal.h"
#include "xaawrap.h"
#include "xf86fbman.h"
#include "servermd.h"
void
XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
XAAPixmapPtr pPriv;
while(pLink) {
pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
pLink->area = pPriv->offscreenArea;
XAAMoveOutOffscreenPixmap(pLink->pPix);
pLink = pLink->next;
}
}
void
XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
PixmapPtr pPix, pScreenPix, tmpPix;
pointer data;
XAAPixmapPtr pPriv;
GCPtr pGC;
FBAreaPtr area;
pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
while(pLink) {
pPix = pLink->pPix;
pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
area = pLink->area;
data = pPix->devPrivate.ptr;
tmpPix = GetScratchPixmapHeader(pScreen,
pPix->drawable.width, pPix->drawable.height,
pPix->drawable.depth, pPix->drawable.bitsPerPixel,
pPix->devKind, data);
pPriv->freeData = FALSE;
pPix->drawable.x = area->box.x1;
pPix->drawable.y = area->box.y1;
pPix->devKind = pScreenPix->devKind;
pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
if(!tmpPix) {
pPriv->offscreenArea = area;
free(data);
pLink = pLink->next;
continue;
}
pGC = GetScratchGC(pPix->drawable.depth, pScreen);
ValidateGC((DrawablePtr)pPix, pGC);
(*pGC->ops->CopyArea)((DrawablePtr)tmpPix, (DrawablePtr)pPix, pGC,
0, 0, pPix->drawable.width, pPix->drawable.height, 0, 0);
free(data);
tmpPix->devPrivate.ptr = NULL;
FreeScratchGC(pGC);
FreeScratchPixmapHeader(tmpPix);
pPriv->offscreenArea = area;
pLink->area = NULL;
pLink = pLink->next;
}
}
void
XAARemoveAreaCallback(FBAreaPtr area)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
PixmapPtr pPix = (PixmapPtr)area->devPrivate.ptr;
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
XAAMoveOutOffscreenPixmap(pPix);
pPriv->flags &= ~OFFSCREEN;
DELIST_OFFSCREEN_PIXMAP(pPix);
}
void
XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
int width, height, devKind, bitsPerPixel;
PixmapPtr tmpPix;
unsigned char *data;
GCPtr pGC;
width = pPix->drawable.width;
height = pPix->drawable.height;
bitsPerPixel = pPix->drawable.bitsPerPixel;
devKind = BitmapBytePad(width * bitsPerPixel);
if(!(data = malloc(devKind * height)))
FatalError("Out of memory\n");
tmpPix = GetScratchPixmapHeader(pScreen, width, height,
pPix->drawable.depth, bitsPerPixel, devKind, data);
if(!tmpPix) {
free(data);
FatalError("Out of memory\n");
}
pGC = GetScratchGC(pPix->drawable.depth, pScreen);
ValidateGC((DrawablePtr)tmpPix, pGC);
(*pGC->ops->CopyArea)((DrawablePtr)pPix, (DrawablePtr)tmpPix,
pGC, 0, 0, width, height, 0, 0);
FreeScratchGC(pGC);
FreeScratchPixmapHeader(tmpPix);
pPix->drawable.x = 0;
pPix->drawable.y = 0;
pPix->devKind = devKind;
pPix->devPrivate.ptr = data;
pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPriv->offscreenArea = NULL;
pPriv->freeData = TRUE;
}
|