2 * Copyright © 1998 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 #ifdef HAVE_DIX_CONFIG_H
24 #include <dix-config.h>
32 fbCreateWindow(WindowPtr pWin
)
34 #ifndef FB_NO_WINDOW_PIXMAPS
35 pWin
->devPrivates
[fbWinPrivateIndex
].ptr
=
36 (pointer
) fbGetScreenPixmap(pWin
->drawable
.pScreen
);
38 #ifdef FB_SCREEN_PRIVATE
39 if (pWin
->drawable
.bitsPerPixel
== 32)
40 pWin
->drawable
.bitsPerPixel
= fbGetScreenPrivate(pWin
->drawable
.pScreen
)->win32bpp
;
46 fbDestroyWindow(WindowPtr pWin
)
52 fbMapWindow(WindowPtr pWindow
)
58 fbPositionWindow(WindowPtr pWin
, int x
, int y
)
64 fbUnmapWindow(WindowPtr pWindow
)
70 fbCopyWindowProc (DrawablePtr pSrcDrawable
,
71 DrawablePtr pDstDrawable
,
91 fbGetDrawable (pSrcDrawable
, src
, srcStride
, srcBpp
, srcXoff
, srcYoff
);
92 fbGetDrawable (pDstDrawable
, dst
, dstStride
, dstBpp
, dstXoff
, dstYoff
);
96 fbBlt (src
+ (pbox
->y1
+ dy
+ srcYoff
) * srcStride
,
98 (pbox
->x1
+ dx
+ srcXoff
) * srcBpp
,
100 dst
+ (pbox
->y1
+ dstYoff
) * dstStride
,
102 (pbox
->x1
+ dstXoff
) * dstBpp
,
104 (pbox
->x2
- pbox
->x1
) * dstBpp
,
105 (pbox
->y2
- pbox
->y1
),
116 fbFinishAccess (pDstDrawable
);
117 fbFinishAccess (pSrcDrawable
);
121 fbCopyWindow(WindowPtr pWin
,
122 DDXPointRec ptOldOrg
,
128 PixmapPtr pPixmap
= fbGetWindowPixmap (pWin
);
129 DrawablePtr pDrawable
= &pPixmap
->drawable
;
131 dx
= ptOldOrg
.x
- pWin
->drawable
.x
;
132 dy
= ptOldOrg
.y
- pWin
->drawable
.y
;
133 REGION_TRANSLATE(pWin
->drawable
.pScreen
, prgnSrc
, -dx
, -dy
);
135 REGION_NULL (pWin
->drawable
.pScreen
, &rgnDst
);
137 REGION_INTERSECT(pWin
->drawable
.pScreen
, &rgnDst
, &pWin
->borderClip
, prgnSrc
);
140 if (pPixmap
->screen_x
|| pPixmap
->screen_y
)
141 REGION_TRANSLATE (pWin
->drawable
.pScreen
, &rgnDst
,
142 -pPixmap
->screen_x
, -pPixmap
->screen_y
);
145 fbCopyRegion (pDrawable
, pDrawable
,
147 &rgnDst
, dx
, dy
, fbCopyWindowProc
, 0, 0);
149 REGION_UNINIT(pWin
->drawable
.pScreen
, &rgnDst
);
150 fbValidateDrawable (&pWin
->drawable
);
154 fbChangeWindowAttributes(WindowPtr pWin
, unsigned long mask
)
158 if (mask
& CWBackPixmap
)
160 if (pWin
->backgroundState
== BackgroundPixmap
)
162 pPixmap
= pWin
->background
.pixmap
;
164 if (pPixmap
->drawable
.bitsPerPixel
!= pWin
->drawable
.bitsPerPixel
)
166 pPixmap
= fb24_32ReformatTile (pPixmap
,
167 pWin
->drawable
.bitsPerPixel
);
170 (*pWin
->drawable
.pScreen
->DestroyPixmap
) (pWin
->background
.pixmap
);
171 pWin
->background
.pixmap
= pPixmap
;
175 if (FbEvenTile (pPixmap
->drawable
.width
*
176 pPixmap
->drawable
.bitsPerPixel
))
177 fbPadPixmap (pPixmap
);
180 if (mask
& CWBorderPixmap
)
182 if (pWin
->borderIsPixel
== FALSE
)
184 pPixmap
= pWin
->border
.pixmap
;
186 if (pPixmap
->drawable
.bitsPerPixel
!=
187 pWin
->drawable
.bitsPerPixel
)
189 pPixmap
= fb24_32ReformatTile (pPixmap
,
190 pWin
->drawable
.bitsPerPixel
);
193 (*pWin
->drawable
.pScreen
->DestroyPixmap
) (pWin
->border
.pixmap
);
194 pWin
->border
.pixmap
= pPixmap
;
198 if (FbEvenTile (pPixmap
->drawable
.width
*
199 pPixmap
->drawable
.bitsPerPixel
))
200 fbPadPixmap (pPixmap
);
207 fbFillRegionSolid (DrawablePtr pDrawable
,
215 int dstXoff
, dstYoff
;
216 int n
= REGION_NUM_RECTS(pRegion
);
217 BoxPtr pbox
= REGION_RECTS(pRegion
);
219 #ifndef FB_ACCESS_WRAPPER
225 fbGetDrawable (pDrawable
, dst
, dstStride
, dstBpp
, dstXoff
, dstYoff
);
229 #ifndef FB_ACCESS_WRAPPER
230 if (!try_mmx
|| !pixman_fill (dst
, dstStride
, dstBpp
,
231 pbox
->x1
+ dstXoff
, pbox
->y1
+ dstYoff
,
232 (pbox
->x2
- pbox
->x1
),
233 (pbox
->y2
- pbox
->y1
),
237 fbSolid (dst
+ (pbox
->y1
+ dstYoff
) * dstStride
,
239 (pbox
->x1
+ dstXoff
) * dstBpp
,
241 (pbox
->x2
- pbox
->x1
) * dstBpp
,
244 #ifndef FB_ACCESS_WRAPPER
247 fbValidateDrawable (pDrawable
);
251 fbFinishAccess (pDrawable
);
255 #include "panoramiX.h"
256 #include "panoramiXsrv.h"
260 fbFillRegionTiled (DrawablePtr pDrawable
,
267 int dstXoff
, dstYoff
;
271 int tileXoff
, tileYoff
; /* XXX assumed to be zero */
272 int tileWidth
, tileHeight
;
273 int n
= REGION_NUM_RECTS(pRegion
);
274 BoxPtr pbox
= REGION_RECTS(pRegion
);
275 int xRot
= pDrawable
->x
;
276 int yRot
= pDrawable
->y
;
279 if(!noPanoramiXExtension
)
281 int index
= pDrawable
->pScreen
->myNum
;
282 if(&WindowTable
[index
]->drawable
== pDrawable
)
284 xRot
-= panoramiXdataPtr
[index
].x
;
285 yRot
-= panoramiXdataPtr
[index
].y
;
289 fbGetDrawable (pDrawable
, dst
, dstStride
, dstBpp
, dstXoff
, dstYoff
);
290 fbGetDrawable (&pTile
->drawable
, tile
, tileStride
, tileBpp
, tileXoff
, tileYoff
);
291 tileWidth
= pTile
->drawable
.width
;
292 tileHeight
= pTile
->drawable
.height
;
298 fbTile (dst
+ (pbox
->y1
+ dstYoff
) * dstStride
,
300 (pbox
->x1
+ dstXoff
) * dstBpp
,
301 (pbox
->x2
- pbox
->x1
) * dstBpp
,
311 yRot
- (pbox
->y1
+ dstYoff
));
315 fbFinishAccess (&pTile
->drawable
);
316 fbFinishAccess (pDrawable
);
320 fbPaintWindow(WindowPtr pWin
, RegionPtr pRegion
, int what
)
326 switch (pWin
->backgroundState
) {
332 } while (pWin
->backgroundState
== ParentRelative
);
333 (*pWin
->drawable
.pScreen
->PaintWindowBackground
)(pWin
, pRegion
,
336 case BackgroundPixmap
:
337 fbFillRegionTiled (&pWin
->drawable
,
339 pWin
->background
.pixmap
);
341 case BackgroundPixel
:
342 fbFillRegionSolid (&pWin
->drawable
,
345 fbReplicatePixel (pWin
->background
.pixel
,
346 pWin
->drawable
.bitsPerPixel
));
351 if (pWin
->borderIsPixel
)
353 fbFillRegionSolid (&pWin
->drawable
,
356 fbReplicatePixel (pWin
->border
.pixel
,
357 pWin
->drawable
.bitsPerPixel
));
362 pBgWin
->backgroundState
== ParentRelative
;
363 pBgWin
= pBgWin
->parent
);
365 fbFillRegionTiled (&pBgWin
->drawable
,
367 pWin
->border
.pixmap
);
371 fbValidateDrawable (&pWin
->drawable
);