First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xfree86 / xf8_32bpp / cfbpntwin.c
bloba1b9887162d754ff7c407e31e4a4a8d75e856a93
2 #ifdef HAVE_XORG_CONFIG_H
3 #include <xorg-config.h>
4 #endif
6 #include <X11/X.h>
8 #include "windowstr.h"
9 #include "regionstr.h"
10 #include "pixmapstr.h"
11 #include "scrnintstr.h"
13 #define PSZ 8
14 #include "cfb.h"
15 #undef PSZ
16 #include "cfb32.h"
17 #include "cfb8_32.h"
18 #include "mi.h"
20 #ifdef PANORAMIX
21 #include "panoramiX.h"
22 #include "panoramiXsrv.h"
23 #endif
25 void
26 cfb8_32PaintWindow(
27 WindowPtr pWin,
28 RegionPtr pRegion,
29 int what
31 WindowPtr pBgWin;
32 int xorg, yorg;
34 switch (what) {
35 case PW_BACKGROUND:
36 switch (pWin->backgroundState) {
37 case None:
38 break;
39 case ParentRelative:
40 do {
41 pWin = pWin->parent;
42 } while (pWin->backgroundState == ParentRelative);
43 (*pWin->drawable.pScreen->PaintWindowBackground)(
44 pWin, pRegion, what);
45 break;
46 case BackgroundPixmap:
47 xorg = pWin->drawable.x;
48 yorg = pWin->drawable.y;
49 #ifdef PANORAMIX
50 if(!noPanoramiXExtension) {
51 int index = pWin->drawable.pScreen->myNum;
52 if(WindowTable[index] == pWin) {
53 xorg -= panoramiXdataPtr[index].x;
54 yorg -= panoramiXdataPtr[index].y;
57 #endif
58 cfb32FillBoxTileOddGeneral ((DrawablePtr)pWin,
59 (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion),
60 pWin->background.pixmap, xorg, yorg, GXcopy,
61 (pWin->drawable.depth == 24) ? 0x00ffffff : 0xff000000);
62 break;
63 case BackgroundPixel:
64 if(pWin->drawable.depth == 24)
65 cfb8_32FillBoxSolid32 ((DrawablePtr)pWin,
66 (int)REGION_NUM_RECTS(pRegion),
67 REGION_RECTS(pRegion),
68 pWin->background.pixel);
69 else
70 cfb8_32FillBoxSolid8 ((DrawablePtr)pWin,
71 (int)REGION_NUM_RECTS(pRegion),
72 REGION_RECTS(pRegion),
73 pWin->background.pixel);
74 break;
76 break;
77 case PW_BORDER:
78 if (pWin->borderIsPixel) {
79 if(pWin->drawable.depth == 24) {
80 cfb8_32FillBoxSolid32 ((DrawablePtr)pWin,
81 (int)REGION_NUM_RECTS(pRegion),
82 REGION_RECTS(pRegion),
83 pWin->border.pixel);
84 } else
85 cfb8_32FillBoxSolid8 ((DrawablePtr)pWin,
86 (int)REGION_NUM_RECTS(pRegion),
87 REGION_RECTS(pRegion),
88 pWin->border.pixel);
89 } else {
90 for (pBgWin = pWin;
91 pBgWin->backgroundState == ParentRelative;
92 pBgWin = pBgWin->parent);
94 xorg = pBgWin->drawable.x;
95 yorg = pBgWin->drawable.y;
97 #ifdef PANORAMIX
98 if(!noPanoramiXExtension) {
99 int index = pWin->drawable.pScreen->myNum;
100 if(WindowTable[index] == pBgWin) {
101 xorg -= panoramiXdataPtr[index].x;
102 yorg -= panoramiXdataPtr[index].y;
105 #endif
106 cfb32FillBoxTileOddGeneral ((DrawablePtr)pWin,
107 (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion),
108 pWin->border.pixmap, xorg, yorg, GXcopy,
109 (pWin->drawable.depth == 24) ? 0x00ffffff : 0xff000000);
111 break;
116 void
117 cfb8_32FillBoxSolid8(
118 DrawablePtr pDraw,
119 int nbox,
120 BoxPtr pbox,
121 unsigned long color
123 CARD8 *ptr, *data;
124 int pitch, height, width, i;
125 CARD8 c = (CARD8)color;
127 cfbGetByteWidthAndPointer(pDraw, pitch, ptr);
128 ptr += 3; /* point to the top byte */
130 while(nbox--) {
131 data = ptr + (pbox->y1 * pitch) + (pbox->x1 << 2);
132 width = (pbox->x2 - pbox->x1) << 2;
133 height = pbox->y2 - pbox->y1;
135 while(height--) {
136 for(i = 0; i < width; i+=4)
137 data[i] = c;
138 data += pitch;
140 pbox++;
145 void
146 cfb8_32FillBoxSolid32(
147 DrawablePtr pDraw,
148 int nbox,
149 BoxPtr pbox,
150 unsigned long color
152 CARD8 *ptr, *data;
153 CARD16 *ptr2, *data2;
154 int pitch, pitch2;
155 int height, width, i;
156 CARD8 c = (CARD8)(color >> 16);
157 CARD16 c2 = (CARD16)color;
159 cfbGetByteWidthAndPointer(pDraw, pitch, ptr);
160 cfbGetTypedWidthAndPointer(pDraw, pitch2, ptr2, CARD16, CARD16);
161 ptr += 2; /* point to the third byte */
163 while(nbox--) {
164 data = ptr + (pbox->y1 * pitch) + (pbox->x1 << 2);
165 data2 = ptr2 + (pbox->y1 * pitch2) + (pbox->x1 << 1);
166 width = (pbox->x2 - pbox->x1) << 1;
167 height = pbox->y2 - pbox->y1;
169 while(height--) {
170 for(i = 0; i < width; i+=2) {
171 data[i << 1] = c;
172 data2[i] = c2;
174 data += pitch;
175 data2 += pitch2;
177 pbox++;