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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "windowstr.h"
#include "regionstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#define PSZ 8
#include "cfb.h"
#undef PSZ
#include "cfb32.h"
#include "cfb8_32.h"
#include "mi.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
void
cfb8_32PaintWindow(
WindowPtr pWin,
RegionPtr pRegion,
int what
){
WindowPtr pBgWin;
int xorg, yorg;
switch (what) {
case PW_BACKGROUND:
switch (pWin->backgroundState) {
case None:
break;
case ParentRelative:
do {
pWin = pWin->parent;
} while (pWin->backgroundState == ParentRelative);
(*pWin->drawable.pScreen->PaintWindowBackground)(
pWin, pRegion, what);
break;
case BackgroundPixmap:
xorg = pWin->drawable.x;
yorg = pWin->drawable.y;
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
int index = pWin->drawable.pScreen->myNum;
if(WindowTable[index] == pWin) {
xorg -= panoramiXdataPtr[index].x;
yorg -= panoramiXdataPtr[index].y;
}
}
#endif
cfb32FillBoxTileOddGeneral ((DrawablePtr)pWin,
(int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion),
pWin->background.pixmap, xorg, yorg, GXcopy,
(pWin->drawable.depth == 24) ? 0x00ffffff : 0xff000000);
break;
case BackgroundPixel:
if(pWin->drawable.depth == 24)
cfb8_32FillBoxSolid32 ((DrawablePtr)pWin,
(int)REGION_NUM_RECTS(pRegion),
REGION_RECTS(pRegion),
pWin->background.pixel);
else
cfb8_32FillBoxSolid8 ((DrawablePtr)pWin,
(int)REGION_NUM_RECTS(pRegion),
REGION_RECTS(pRegion),
pWin->background.pixel);
break;
}
break;
case PW_BORDER:
if (pWin->borderIsPixel) {
if(pWin->drawable.depth == 24) {
cfb8_32FillBoxSolid32 ((DrawablePtr)pWin,
(int)REGION_NUM_RECTS(pRegion),
REGION_RECTS(pRegion),
pWin->border.pixel);
} else
cfb8_32FillBoxSolid8 ((DrawablePtr)pWin,
(int)REGION_NUM_RECTS(pRegion),
REGION_RECTS(pRegion),
pWin->border.pixel);
} else {
for (pBgWin = pWin;
pBgWin->backgroundState == ParentRelative;
pBgWin = pBgWin->parent);
xorg = pBgWin->drawable.x;
yorg = pBgWin->drawable.y;
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
int index = pWin->drawable.pScreen->myNum;
if(WindowTable[index] == pBgWin) {
xorg -= panoramiXdataPtr[index].x;
yorg -= panoramiXdataPtr[index].y;
}
}
#endif
cfb32FillBoxTileOddGeneral ((DrawablePtr)pWin,
(int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion),
pWin->border.pixmap, xorg, yorg, GXcopy,
(pWin->drawable.depth == 24) ? 0x00ffffff : 0xff000000);
}
break;
}
}
void
cfb8_32FillBoxSolid8(
DrawablePtr pDraw,
int nbox,
BoxPtr pbox,
unsigned long color
){
CARD8 *ptr, *data;
int pitch, height, width, i;
CARD8 c = (CARD8)color;
cfbGetByteWidthAndPointer(pDraw, pitch, ptr);
ptr += 3; /* point to the top byte */
while(nbox--) {
data = ptr + (pbox->y1 * pitch) + (pbox->x1 << 2);
width = (pbox->x2 - pbox->x1) << 2;
height = pbox->y2 - pbox->y1;
while(height--) {
for(i = 0; i < width; i+=4)
data[i] = c;
data += pitch;
}
pbox++;
}
}
void
cfb8_32FillBoxSolid32(
DrawablePtr pDraw,
int nbox,
BoxPtr pbox,
unsigned long color
){
CARD8 *ptr, *data;
CARD16 *ptr2, *data2;
int pitch, pitch2;
int height, width, i;
CARD8 c = (CARD8)(color >> 16);
CARD16 c2 = (CARD16)color;
cfbGetByteWidthAndPointer(pDraw, pitch, ptr);
cfbGetTypedWidthAndPointer(pDraw, pitch2, ptr2, CARD16, CARD16);
ptr += 2; /* point to the third byte */
while(nbox--) {
data = ptr + (pbox->y1 * pitch) + (pbox->x1 << 2);
data2 = ptr2 + (pbox->y1 * pitch2) + (pbox->x1 << 1);
width = (pbox->x2 - pbox->x1) << 1;
height = pbox->y2 - pbox->y1;
while(height--) {
for(i = 0; i < width; i+=2) {
data[i << 1] = c;
data2[i] = c2;
}
data += pitch;
data2 += pitch2;
}
pbox++;
}
}
|