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(),
35 fbGetScreenPixmap(pWin->drawable.pScreen));
36 #ifdef FB_SCREEN_PRIVATE
37 if (pWin->drawable.bitsPerPixel == 32)
38 pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
44 fbDestroyWindow(WindowPtr pWin)
50 fbMapWindow(WindowPtr pWindow)
56 fbPositionWindow(WindowPtr pWin, int x, int y)
62 fbUnmapWindow(WindowPtr pWindow)
68 fbCopyWindowProc (DrawablePtr pSrcDrawable,
69 DrawablePtr pDstDrawable,
89 fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
90 fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
94 fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
96 (pbox->x1 + dx + srcXoff) * srcBpp,
98 dst + (pbox->y1 + dstYoff) * dstStride,
100 (pbox->x1 + dstXoff) * dstBpp,
102 (pbox->x2 - pbox->x1) * dstBpp,
103 (pbox->y2 - pbox->y1),
114 fbFinishAccess (pDstDrawable);
115 fbFinishAccess (pSrcDrawable);
119 fbCopyWindow(WindowPtr pWin,
120 DDXPointRec ptOldOrg,
126 PixmapPtr pPixmap = fbGetWindowPixmap (pWin);
127 DrawablePtr pDrawable = &pPixmap->drawable;
129 dx = ptOldOrg.x - pWin->drawable.x;
130 dy = ptOldOrg.y - pWin->drawable.y;
131 RegionTranslate(prgnSrc, -dx, -dy);
135 RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
138 if (pPixmap->screen_x || pPixmap->screen_y)
139 RegionTranslate(&rgnDst,
140 -pPixmap->screen_x, -pPixmap->screen_y);
143 miCopyRegion (pDrawable, pDrawable,
145 &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
147 RegionUninit(&rgnDst);
148 fbValidateDrawable (&pWin->drawable);
152 fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
156 if (mask & CWBackPixmap)
158 if (pWin->backgroundState == BackgroundPixmap)
160 pPixmap = pWin->background.pixmap;
162 if (pPixmap->drawable.bitsPerPixel != pWin->drawable.bitsPerPixel)
164 pPixmap = fb24_32ReformatTile (pPixmap,
165 pWin->drawable.bitsPerPixel);
168 (*pWin->drawable.pScreen->DestroyPixmap) (pWin->background.pixmap);
169 pWin->background.pixmap = pPixmap;
173 if (FbEvenTile (pPixmap->drawable.width *
174 pPixmap->drawable.bitsPerPixel))
175 fbPadPixmap (pPixmap);
178 if (mask & CWBorderPixmap)
180 if (pWin->borderIsPixel == FALSE)
182 pPixmap = pWin->border.pixmap;
184 if (pPixmap->drawable.bitsPerPixel !=
185 pWin->drawable.bitsPerPixel)
187 pPixmap = fb24_32ReformatTile (pPixmap,
188 pWin->drawable.bitsPerPixel);
191 (*pWin->drawable.pScreen->DestroyPixmap) (pWin->border.pixmap);
192 pWin->border.pixmap = pPixmap;
196 if (FbEvenTile (pPixmap->drawable.width *
197 pPixmap->drawable.bitsPerPixel))
198 fbPadPixmap (pPixmap);
205 fbFillRegionSolid (DrawablePtr pDrawable,
213 int dstXoff, dstYoff;
214 int n = RegionNumRects(pRegion);
215 BoxPtr pbox = RegionRects(pRegion);
217 #ifndef FB_ACCESS_WRAPPER
223 fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
227 #ifndef FB_ACCESS_WRAPPER
228 if (!try_mmx || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
229 pbox->x1 + dstXoff, pbox->y1 + dstYoff,
230 (pbox->x2 - pbox->x1),
231 (pbox->y2 - pbox->y1),
235 fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
237 (pbox->x1 + dstXoff) * dstBpp,
239 (pbox->x2 - pbox->x1) * dstBpp,
242 #ifndef FB_ACCESS_WRAPPER
245 fbValidateDrawable (pDrawable);
249 fbFinishAccess (pDrawable);