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
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin),
35
fbGetScreenPixmap(pWin->drawable.pScreen));
36
if (pWin->drawable.bitsPerPixel == 32)
37
pWin->drawable.bitsPerPixel =
38
fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
43
fbDestroyWindow(WindowPtr pWin)
49
fbMapWindow(WindowPtr pWindow)
55
fbPositionWindow(WindowPtr pWin, int x, int y)
61
fbUnmapWindow(WindowPtr pWindow)
67
fbCopyWindowProc(DrawablePtr pSrcDrawable,
68
DrawablePtr pDstDrawable,
74
Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
85
fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
86
fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
89
fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride,
91
(pbox->x1 + dx + srcXoff) * srcBpp,
92
dst + (pbox->y1 + dstYoff) * dstStride,
94
(pbox->x1 + dstXoff) * dstBpp,
95
(pbox->x2 - pbox->x1) * dstBpp,
96
(pbox->y2 - pbox->y1),
97
GXcopy, FB_ALLONES, dstBpp, reverse, upsidedown);
101
fbFinishAccess(pDstDrawable);
102
fbFinishAccess(pSrcDrawable);
106
fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
111
PixmapPtr pPixmap = fbGetWindowPixmap(pWin);
112
DrawablePtr pDrawable = &pPixmap->drawable;
114
dx = ptOldOrg.x - pWin->drawable.x;
115
dy = ptOldOrg.y - pWin->drawable.y;
116
RegionTranslate(prgnSrc, -dx, -dy);
120
RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
123
if (pPixmap->screen_x || pPixmap->screen_y)
124
RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
127
miCopyRegion(pDrawable, pDrawable,
128
0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
130
RegionUninit(&rgnDst);
131
fbValidateDrawable(&pWin->drawable);
135
fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
137
PixmapPtr pPixmap = *ppPixmap;
139
if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
140
pPixmap = fb24_32ReformatTile(pPixmap, pDrawable->bitsPerPixel);
143
(*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
146
if (FbEvenTile(pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel))
147
fbPadPixmap(pPixmap);
151
fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
153
if (mask & CWBackPixmap) {
154
if (pWin->backgroundState == BackgroundPixmap)
155
fbFixupWindowPixmap(&pWin->drawable, &pWin->background.pixmap);
157
if (mask & CWBorderPixmap) {
158
if (pWin->borderIsPixel == FALSE)
159
fbFixupWindowPixmap(&pWin->drawable, &pWin->border.pixmap);
165
fbFillRegionSolid(DrawablePtr pDrawable,
166
RegionPtr pRegion, FbBits and, FbBits xor)
171
int dstXoff, dstYoff;
172
int n = RegionNumRects(pRegion);
173
BoxPtr pbox = RegionRects(pRegion);
175
#ifndef FB_ACCESS_WRAPPER
182
fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
185
#ifndef FB_ACCESS_WRAPPER
186
if (!try_mmx || !pixman_fill((uint32_t *) dst, dstStride, dstBpp,
187
pbox->x1 + dstXoff, pbox->y1 + dstYoff,
188
(pbox->x2 - pbox->x1),
189
(pbox->y2 - pbox->y1), xor)) {
191
fbSolid(dst + (pbox->y1 + dstYoff) * dstStride,
193
(pbox->x1 + dstXoff) * dstBpp,
195
(pbox->x2 - pbox->x1) * dstBpp,
196
pbox->y2 - pbox->y1, and, xor);
197
#ifndef FB_ACCESS_WRAPPER
200
fbValidateDrawable(pDrawable);
204
fbFinishAccess(pDrawable);