aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/fb
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-07-01 14:21:21 +0200
committermarha <marha@users.sourceforge.net>2011-07-01 14:21:21 +0200
commitd9f970a847e1af706f07560ef163b229bb592307 (patch)
tree2fe2204f673487f3a8d7150f14cc456c6eb48d62 /xorg-server/fb
parent0feab87a4300a3e204e259d14a0a63e58e4a3c8f (diff)
downloadvcxsrv-d9f970a847e1af706f07560ef163b229bb592307.tar.gz
vcxsrv-d9f970a847e1af706f07560ef163b229bb592307.tar.bz2
vcxsrv-d9f970a847e1af706f07560ef163b229bb592307.zip
xwininfo libX11 mesa mkfontscale xserver xkeyboard-config git update 1 Juli
2011
Diffstat (limited to 'xorg-server/fb')
-rw-r--r--xorg-server/fb/fb24_32.c1270
-rw-r--r--xorg-server/fb/fbarc.c9
-rw-r--r--xorg-server/fb/fbfill.c460
-rw-r--r--xorg-server/fb/fbgc.c4
-rw-r--r--xorg-server/fb/fbpush.c490
5 files changed, 1115 insertions, 1118 deletions
diff --git a/xorg-server/fb/fb24_32.c b/xorg-server/fb/fb24_32.c
index 748a0ec04..033fa46c5 100644
--- a/xorg-server/fb/fb24_32.c
+++ b/xorg-server/fb/fb24_32.c
@@ -1,635 +1,635 @@
-/*
- * Copyright © 2000 SuSE, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "fb.h"
-
-/* X apps don't like 24bpp images, this code exposes 32bpp images */
-
-/*
- * These two functions do a full CopyArea while reformatting
- * the data between 24 and 32bpp. They try to go a bit faster
- * by reading/writing aligned CARD32s where it's easy
- */
-
-#define Get8(a) ((CARD32) READ(a))
-
-#if BITMAP_BIT_ORDER == MSBFirst
-#define Get24(a) ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2))
-#define Put24(a,p) ((WRITE((a+0), (CARD8) ((p) >> 16))), \
- (WRITE((a+1), (CARD8) ((p) >> 8))), \
- (WRITE((a+2), (CARD8) (p))))
-#else
-#define Get24(a) (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16))
-#define Put24(a,p) ((WRITE((a+0), (CARD8) (p))), \
- (WRITE((a+1), (CARD8) ((p) >> 8))), \
- (WRITE((a+2), (CARD8) ((p) >> 16))))
-#endif
-
-typedef void (*fb24_32BltFunc) (CARD8 *srcLine,
- FbStride srcStride,
- int srcX,
-
- CARD8 *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm);
-
-static void
-fb24_32BltDown (CARD8 *srcLine,
- FbStride srcStride,
- int srcX,
-
- CARD8 *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm)
-{
- CARD32 *src;
- CARD8 *dst;
- int w;
- Bool destInvarient;
- CARD32 pixel, dpixel;
- FbDeclareMergeRop ();
-
- srcLine += srcX * 4;
- dstLine += dstX * 3;
-
- FbInitializeMergeRop(alu, (pm | ~(FbBits) 0xffffff));
- destInvarient = FbDestInvarientMergeRop();
-
- while (height--)
- {
- src = (CARD32 *) srcLine;
- dst = dstLine;
- srcLine += srcStride;
- dstLine += dstStride;
- w = width;
- if (destInvarient)
- {
- while (((long) dst & 3) && w)
- {
- w--;
- pixel = READ(src++);
- pixel = FbDoDestInvarientMergeRop(pixel);
- Put24 (dst, pixel);
- dst += 3;
- }
- /* Do four aligned pixels at a time */
- while (w >= 4)
- {
- CARD32 s0, s1;
- s0 = READ(src++);
- s0 = FbDoDestInvarientMergeRop(s0);
- s1 = READ(src++);
- s1 = FbDoDestInvarientMergeRop(s1);
-#if BITMAP_BIT_ORDER == LSBFirst
- WRITE((CARD32 *)dst, (s0 & 0xffffff) | (s1 << 24));
-#else
- WRITE((CARD32 *)dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
-#endif
- s0 = READ(src++);
- s0 = FbDoDestInvarientMergeRop(s0);
-#if BITMAP_BIT_ORDER == LSBFirst
- WRITE((CARD32 *)(dst+4), ((s1 & 0xffffff) >> 8) | (s0 << 16));
-#else
- WRITE((CARD32 *)(dst+4), (s1 << 16) | ((s0 & 0xffffff) >> 8));
-#endif
- s1 = READ(src++);
- s1 = FbDoDestInvarientMergeRop(s1);
-#if BITMAP_BIT_ORDER == LSBFirst
- WRITE((CARD32 *)(dst+8), ((s0 & 0xffffff) >> 16) | (s1 << 8));
-#else
- WRITE((CARD32 *)(dst+8), (s0 << 24) | (s1 & 0xffffff));
-#endif
- dst += 12;
- w -= 4;
- }
- while (w--)
- {
- pixel = READ(src++);
- pixel = FbDoDestInvarientMergeRop(pixel);
- Put24 (dst, pixel);
- dst += 3;
- }
- }
- else
- {
- while (w--)
- {
- pixel = READ(src++);
- dpixel = Get24 (dst);
- pixel = FbDoMergeRop(pixel, dpixel);
- Put24 (dst, pixel);
- dst += 3;
- }
- }
- }
-}
-
-static void
-fb24_32BltUp (CARD8 *srcLine,
- FbStride srcStride,
- int srcX,
-
- CARD8 *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm)
-{
- CARD8 *src;
- CARD32 *dst;
- int w;
- Bool destInvarient;
- CARD32 pixel;
- FbDeclareMergeRop ();
-
- FbInitializeMergeRop(alu, (pm | (~(FbBits) 0xffffff)));
- destInvarient = FbDestInvarientMergeRop();
-
- srcLine += srcX * 3;
- dstLine += dstX * 4;
-
- while (height--)
- {
- w = width;
- src = srcLine;
- dst = (CARD32 *) dstLine;
- srcLine += srcStride;
- dstLine += dstStride;
- if (destInvarient)
- {
- while (((long) src & 3) && w)
- {
- w--;
- pixel = Get24(src);
- src += 3;
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- }
- /* Do four aligned pixels at a time */
- while (w >= 4)
- {
- CARD32 s0, s1;
-
- s0 = READ((CARD32 *)src);
-#if BITMAP_BIT_ORDER == LSBFirst
- pixel = s0 & 0xffffff;
-#else
- pixel = s0 >> 8;
-#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- s1 = READ((CARD32 *)(src+4));
-#if BITMAP_BIT_ORDER == LSBFirst
- pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
-#else
- pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
-#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- s0 = READ((CARD32 *)(src+8));
-#if BITMAP_BIT_ORDER == LSBFirst
- pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
-#else
- pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
-#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
-#if BITMAP_BIT_ORDER == LSBFirst
- pixel = s0 >> 8;
-#else
- pixel = s0 & 0xffffff;
-#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- src += 12;
- w -= 4;
- }
- while (w)
- {
- w--;
- pixel = Get24(src);
- src += 3;
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- }
- }
- else
- {
- while (w--)
- {
- pixel = Get24(src);
- src += 3;
- WRITE(dst, FbDoMergeRop(pixel, READ(dst)));
- dst++;
- }
- }
- }
-}
-
-/*
- * Spans functions; probably unused.
- */
-void
-fb24_32GetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart)
-{
- FbBits *srcBits;
- CARD8 *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- CARD8 *dst;
-
- fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
- src = (CARD8 *) srcBits;
- srcStride *= sizeof (FbBits);
-
- while (nspans--)
- {
- dst = (CARD8 *) pchardstStart;
- fb24_32BltUp (src + (ppt->y + srcYoff) * srcStride, srcStride,
- ppt->x + srcXoff,
-
- dst,
- 1,
- 0,
-
- *pwidth,
- 1,
-
- GXcopy,
- FB_ALLONES);
-
- pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
- }
-
- fbFinishAccess (pDrawable);
-}
-
-void
-fb24_32SetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted)
-{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- FbBits *dstBits;
- CARD8 *dst, *d, *s;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxPtr pbox;
- int n;
- int x1, x2;
-
- fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
- dst = (CARD8 *) dstBits;
- dstStride *= sizeof (FbBits);
- while (nspans--)
- {
- d = dst + (ppt->y + dstYoff) * dstStride;
- s = (CARD8 *) src;
- n = RegionNumRects(pClip);
- pbox = RegionRects (pClip);
- while (n--)
- {
- if (pbox->y1 > ppt->y)
- break;
- if (pbox->y2 > ppt->y)
- {
- x1 = ppt->x;
- x2 = x1 + *pwidth;
- if (pbox->x1 > x1)
- x1 = pbox->x1;
- if (pbox->x2 < x2)
- x2 = pbox->x2;
- if (x1 < x2)
- fb24_32BltDown (s,
- 0,
- (x1 - ppt->x),
- d,
- dstStride,
- x1 + dstXoff,
-
- (x2 - x1),
- 1,
- pGC->alu,
- pPriv->pm);
- }
- }
- src += PixmapBytePad (*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
- }
-
- fbFinishAccess (pDrawable);
-}
-
-/*
- * Clip and put 32bpp Z-format images to a 24bpp drawable
- */
-void
-fb24_32PutZImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- int alu,
- FbBits pm,
- int x,
- int y,
- int width,
- int height,
- CARD8 *src,
- FbStride srcStride)
-{
- FbBits *dstBits;
- CARD8 *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int nbox;
- BoxPtr pbox;
- int x1, y1, x2, y2;
-
- fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
- dstStride *= sizeof(FbBits);
- dst = (CARD8 *) dstBits;
-
- for (nbox = RegionNumRects (pClip),
- pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- x1 = x;
- y1 = y;
- x2 = x + width;
- y2 = y + height;
- if (x1 < pbox->x1)
- x1 = pbox->x1;
- if (y1 < pbox->y1)
- y1 = pbox->y1;
- if (x2 > pbox->x2)
- x2 = pbox->x2;
- if (y2 > pbox->y2)
- y2 = pbox->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
- fb24_32BltDown (src + (y1 - y) * srcStride,
- srcStride,
- (x1 - x),
-
- dst + (y1 + dstYoff) * dstStride,
- dstStride,
- x1 + dstXoff,
-
- (x2 - x1),
- (y2 - y1),
-
- alu,
- pm);
- }
-
- fbFinishAccess (pDrawable);
-}
-
-void
-fb24_32GetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d)
-{
- FbBits *srcBits;
- CARD8 *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbStride dstStride;
- FbBits pm;
-
- fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
- src = (CARD8 *) srcBits;
- srcStride *= sizeof (FbBits);
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- pm = fbReplicatePixel (planeMask, 32);
- dstStride = PixmapBytePad(w, pDrawable->depth);
- if (pm != FB_ALLONES)
- memset (d, 0, dstStride * h);
- fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
- (CARD8 *) d, dstStride, 0,
- w, h, GXcopy, pm);
-
- fbFinishAccess (pDrawable);
-}
-
-void
-fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- FbBits *srcBits;
- CARD8 *src;
- FbStride srcStride;
- int srcBpp;
- FbBits *dstBits;
- CARD8 *dst;
- FbStride dstStride;
- int dstBpp;
- fb24_32BltFunc blt;
- int srcXoff, srcYoff;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
- src = (CARD8 *) srcBits;
- srcStride *= sizeof (FbBits);
- fbGetDrawable (pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
- dst = (CARD8 *) dstBits;
- dstStride *= sizeof (FbBits);
- if (srcBpp == 24)
- blt = fb24_32BltUp;
- else
- blt = fb24_32BltDown;
-
- while (nbox--)
- {
- (*blt) (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff),
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff),
-
- (pbox->x2 - pbox->x1),
- (pbox->y2 - pbox->y1),
-
- pGC->alu,
- pPriv->pm);
- pbox++;
- }
-
- fbFinishAccess (pSrcDrawable);
- fbFinishAccess (pDstDrawable);
-}
-
-PixmapPtr
-fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
-{
- ScreenPtr pScreen = pOldTile->drawable.pScreen;
- PixmapPtr pNewTile;
- FbBits *old, *new;
- FbStride oldStride, newStride;
- int oldBpp, newBpp;
- fb24_32BltFunc blt;
- int oldXoff, oldYoff;
- int newXoff, newYoff;
-
- pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width,
- pOldTile->drawable.height,
- pOldTile->drawable.depth,
- pOldTile->usage_hint);
- if (!pNewTile)
- return 0;
- fbGetDrawable (&pOldTile->drawable,
- old, oldStride, oldBpp, oldXoff, oldYoff);
- fbGetDrawable (&pNewTile->drawable,
- new, newStride, newBpp, newXoff, newYoff);
- if (oldBpp == 24)
- blt = fb24_32BltUp;
- else
- blt = fb24_32BltDown;
-
- (*blt) ((CARD8 *) old,
- oldStride * sizeof (FbBits),
- 0,
-
- (CARD8 *) new,
- newStride * sizeof (FbBits),
- 0,
-
- pOldTile->drawable.width,
- pOldTile->drawable.height,
-
- GXcopy,
- FB_ALLONES);
-
- fbFinishAccess (&pOldTile->drawable);
- fbFinishAccess (&pNewTile->drawable);
-
- return pNewTile;
-}
-
-typedef struct {
- pointer pbits;
- int width;
-} miScreenInitParmsRec, *miScreenInitParmsPtr;
-
-Bool
-fb24_32CreateScreenResources(ScreenPtr pScreen)
-{
- miScreenInitParmsPtr pScrInitParms;
- int pitch;
- Bool retval;
-
- /* get the pitch before mi destroys it */
- pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
- pitch = BitmapBytePad(pScrInitParms->width * 24);
-
- if((retval = miCreateScreenResources(pScreen))) {
- /* fix the screen pixmap */
- PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate;
- pPix->drawable.bitsPerPixel = 24;
- pPix->devKind = pitch;
- }
-
- return retval;
-}
-
-Bool
-fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
- int width,
- int height,
- int depth,
- int bitsPerPixel,
- int devKind,
- pointer pPixData)
-{
- int bpp, w;
-
- if (!pPixmap)
- return FALSE;
- bpp = bitsPerPixel;
- if (bpp <= 0)
- bpp = pPixmap->drawable.bitsPerPixel;
- if (bpp == 24)
- {
- if (devKind < 0)
- {
- w = width;
- if (w <= 0)
- w = pPixmap->drawable.width;
- devKind = BitmapBytePad(w * 24);
- }
- }
- return miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
- devKind, pPixData);
-}
+/*
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "fb.h"
+
+/* X apps don't like 24bpp images, this code exposes 32bpp images */
+
+/*
+ * These two functions do a full CopyArea while reformatting
+ * the data between 24 and 32bpp. They try to go a bit faster
+ * by reading/writing aligned CARD32s where it's easy
+ */
+
+#define Get8(a) ((CARD32) READ(a))
+
+#if BITMAP_BIT_ORDER == MSBFirst
+#define Get24(a) ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2))
+#define Put24(a,p) ((WRITE((a+0), (CARD8) ((p) >> 16))), \
+ (WRITE((a+1), (CARD8) ((p) >> 8))), \
+ (WRITE((a+2), (CARD8) (p))))
+#else
+#define Get24(a) (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16))
+#define Put24(a,p) ((WRITE((a+0), (CARD8) (p))), \
+ (WRITE((a+1), (CARD8) ((p) >> 8))), \
+ (WRITE((a+2), (CARD8) ((p) >> 16))))
+#endif
+
+typedef void (*fb24_32BltFunc) (CARD8 *srcLine,
+ FbStride srcStride,
+ int srcX,
+
+ CARD8 *dstLine,
+ FbStride dstStride,
+ int dstX,
+
+ int width,
+ int height,
+
+ int alu,
+ FbBits pm);
+
+static void
+fb24_32BltDown (CARD8 *srcLine,
+ FbStride srcStride,
+ int srcX,
+
+ CARD8 *dstLine,
+ FbStride dstStride,
+ int dstX,
+
+ int width,
+ int height,
+
+ int alu,
+ FbBits pm)
+{
+ CARD32 *src;
+ CARD8 *dst;
+ int w;
+ Bool destInvarient;
+ CARD32 pixel, dpixel;
+ FbDeclareMergeRop ();
+
+ srcLine += srcX * 4;
+ dstLine += dstX * 3;
+
+ FbInitializeMergeRop(alu, (pm | ~(FbBits) 0xffffff));
+ destInvarient = FbDestInvarientMergeRop();
+
+ while (height--)
+ {
+ src = (CARD32 *) srcLine;
+ dst = dstLine;
+ srcLine += srcStride;
+ dstLine += dstStride;
+ w = width;
+ if (destInvarient)
+ {
+ while (((long) dst & 3) && w)
+ {
+ w--;
+ pixel = READ(src++);
+ pixel = FbDoDestInvarientMergeRop(pixel);
+ Put24 (dst, pixel);
+ dst += 3;
+ }
+ /* Do four aligned pixels at a time */
+ while (w >= 4)
+ {
+ CARD32 s0, s1;
+ s0 = READ(src++);
+ s0 = FbDoDestInvarientMergeRop(s0);
+ s1 = READ(src++);
+ s1 = FbDoDestInvarientMergeRop(s1);
+#if BITMAP_BIT_ORDER == LSBFirst
+ WRITE((CARD32 *)dst, (s0 & 0xffffff) | (s1 << 24));
+#else
+ WRITE((CARD32 *)dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
+#endif
+ s0 = READ(src++);
+ s0 = FbDoDestInvarientMergeRop(s0);
+#if BITMAP_BIT_ORDER == LSBFirst
+ WRITE((CARD32 *)(dst+4), ((s1 & 0xffffff) >> 8) | (s0 << 16));
+#else
+ WRITE((CARD32 *)(dst+4), (s1 << 16) | ((s0 & 0xffffff) >> 8));
+#endif
+ s1 = READ(src++);
+ s1 = FbDoDestInvarientMergeRop(s1);
+#if BITMAP_BIT_ORDER == LSBFirst
+ WRITE((CARD32 *)(dst+8), ((s0 & 0xffffff) >> 16) | (s1 << 8));
+#else
+ WRITE((CARD32 *)(dst+8), (s0 << 24) | (s1 & 0xffffff));
+#endif
+ dst += 12;
+ w -= 4;
+ }
+ while (w--)
+ {
+ pixel = READ(src++);
+ pixel = FbDoDestInvarientMergeRop(pixel);
+ Put24 (dst, pixel);
+ dst += 3;
+ }
+ }
+ else
+ {
+ while (w--)
+ {
+ pixel = READ(src++);
+ dpixel = Get24 (dst);
+ pixel = FbDoMergeRop(pixel, dpixel);
+ Put24 (dst, pixel);
+ dst += 3;
+ }
+ }
+ }
+}
+
+static void
+fb24_32BltUp (CARD8 *srcLine,
+ FbStride srcStride,
+ int srcX,
+
+ CARD8 *dstLine,
+ FbStride dstStride,
+ int dstX,
+
+ int width,
+ int height,
+
+ int alu,
+ FbBits pm)
+{
+ CARD8 *src;
+ CARD32 *dst;
+ int w;
+ Bool destInvarient;
+ CARD32 pixel;
+ FbDeclareMergeRop ();
+
+ FbInitializeMergeRop(alu, (pm | (~(FbBits) 0xffffff)));
+ destInvarient = FbDestInvarientMergeRop();
+
+ srcLine += srcX * 3;
+ dstLine += dstX * 4;
+
+ while (height--)
+ {
+ w = width;
+ src = srcLine;
+ dst = (CARD32 *) dstLine;
+ srcLine += srcStride;
+ dstLine += dstStride;
+ if (destInvarient)
+ {
+ while (((long) src & 3) && w)
+ {
+ w--;
+ pixel = Get24(src);
+ src += 3;
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ }
+ /* Do four aligned pixels at a time */
+ while (w >= 4)
+ {
+ CARD32 s0, s1;
+
+ s0 = READ((CARD32 *)src);
+#if BITMAP_BIT_ORDER == LSBFirst
+ pixel = s0 & 0xffffff;
+#else
+ pixel = s0 >> 8;
+#endif
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ s1 = READ((CARD32 *)(src+4));
+#if BITMAP_BIT_ORDER == LSBFirst
+ pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
+#else
+ pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
+#endif
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ s0 = READ((CARD32 *)(src+8));
+#if BITMAP_BIT_ORDER == LSBFirst
+ pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
+#else
+ pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
+#endif
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+#if BITMAP_BIT_ORDER == LSBFirst
+ pixel = s0 >> 8;
+#else
+ pixel = s0 & 0xffffff;
+#endif
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ src += 12;
+ w -= 4;
+ }
+ while (w)
+ {
+ w--;
+ pixel = Get24(src);
+ src += 3;
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ }
+ }
+ else
+ {
+ while (w--)
+ {
+ pixel = Get24(src);
+ src += 3;
+ WRITE(dst, FbDoMergeRop(pixel, READ(dst)));
+ dst++;
+ }
+ }
+ }
+}
+
+/*
+ * Spans functions; probably unused.
+ */
+void
+fb24_32GetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pchardstStart)
+{
+ FbBits *srcBits;
+ CARD8 *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ CARD8 *dst;
+
+ fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
+ src = (CARD8 *) srcBits;
+ srcStride *= sizeof (FbBits);
+
+ while (nspans--)
+ {
+ dst = (CARD8 *) pchardstStart;
+ fb24_32BltUp (src + (ppt->y + srcYoff) * srcStride, srcStride,
+ ppt->x + srcXoff,
+
+ dst,
+ 1,
+ 0,
+
+ *pwidth,
+ 1,
+
+ GXcopy,
+ FB_ALLONES);
+
+ pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
+ }
+
+ fbFinishAccess (pDrawable);
+}
+
+void
+fb24_32SetSpans (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted)
+{
+ FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ FbBits *dstBits;
+ CARD8 *dst, *d, *s;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ BoxPtr pbox;
+ int n;
+ int x1, x2;
+
+ fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
+ dst = (CARD8 *) dstBits;
+ dstStride *= sizeof (FbBits);
+ while (nspans--)
+ {
+ d = dst + (ppt->y + dstYoff) * dstStride;
+ s = (CARD8 *) src;
+ n = RegionNumRects(pClip);
+ pbox = RegionRects (pClip);
+ while (n--)
+ {
+ if (pbox->y1 > ppt->y)
+ break;
+ if (pbox->y2 > ppt->y)
+ {
+ x1 = ppt->x;
+ x2 = x1 + *pwidth;
+ if (pbox->x1 > x1)
+ x1 = pbox->x1;
+ if (pbox->x2 < x2)
+ x2 = pbox->x2;
+ if (x1 < x2)
+ fb24_32BltDown (s,
+ 0,
+ (x1 - ppt->x),
+ d,
+ dstStride,
+ x1 + dstXoff,
+
+ (x2 - x1),
+ 1,
+ pGC->alu,
+ pPriv->pm);
+ }
+ }
+ src += PixmapBytePad (*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
+ }
+
+ fbFinishAccess (pDrawable);
+}
+
+/*
+ * Clip and put 32bpp Z-format images to a 24bpp drawable
+ */
+void
+fb24_32PutZImage (DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y,
+ int width,
+ int height,
+ CARD8 *src,
+ FbStride srcStride)
+{
+ FbBits *dstBits;
+ CARD8 *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int nbox;
+ BoxPtr pbox;
+ int x1, y1, x2, y2;
+
+ fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
+ dstStride *= sizeof(FbBits);
+ dst = (CARD8 *) dstBits;
+
+ for (nbox = RegionNumRects (pClip),
+ pbox = RegionRects(pClip);
+ nbox--;
+ pbox++)
+ {
+ x1 = x;
+ y1 = y;
+ x2 = x + width;
+ y2 = y + height;
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
+ if (y1 < pbox->y1)
+ y1 = pbox->y1;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
+ if (y2 > pbox->y2)
+ y2 = pbox->y2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
+ fb24_32BltDown (src + (y1 - y) * srcStride,
+ srcStride,
+ (x1 - x),
+
+ dst + (y1 + dstYoff) * dstStride,
+ dstStride,
+ x1 + dstXoff,
+
+ (x2 - x1),
+ (y2 - y1),
+
+ alu,
+ pm);
+ }
+
+ fbFinishAccess (pDrawable);
+}
+
+void
+fb24_32GetImage (DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w,
+ int h,
+ unsigned int format,
+ unsigned long planeMask,
+ char *d)
+{
+ FbBits *srcBits;
+ CARD8 *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbStride dstStride;
+ FbBits pm;
+
+ fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
+ src = (CARD8 *) srcBits;
+ srcStride *= sizeof (FbBits);
+
+ x += pDrawable->x;
+ y += pDrawable->y;
+
+ pm = fbReplicatePixel (planeMask, 32);
+ dstStride = PixmapBytePad(w, pDrawable->depth);
+ if (pm != FB_ALLONES)
+ memset (d, 0, dstStride * h);
+ fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
+ (CARD8 *) d, dstStride, 0,
+ w, h, GXcopy, pm);
+
+ fbFinishAccess (pDrawable);
+}
+
+void
+fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown,
+ Pixel bitplane,
+ void *closure)
+{
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbBits *srcBits;
+ CARD8 *src;
+ FbStride srcStride;
+ int srcBpp;
+ FbBits *dstBits;
+ CARD8 *dst;
+ FbStride dstStride;
+ int dstBpp;
+ fb24_32BltFunc blt;
+ int srcXoff, srcYoff;
+ int dstXoff, dstYoff;
+
+ fbGetDrawable (pSrcDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
+ src = (CARD8 *) srcBits;
+ srcStride *= sizeof (FbBits);
+ fbGetDrawable (pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
+ dst = (CARD8 *) dstBits;
+ dstStride *= sizeof (FbBits);
+ if (srcBpp == 24)
+ blt = fb24_32BltUp;
+ else
+ blt = fb24_32BltDown;
+
+ while (nbox--)
+ {
+ (*blt) (src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff),
+
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff),
+
+ (pbox->x2 - pbox->x1),
+ (pbox->y2 - pbox->y1),
+
+ pGC->alu,
+ pPriv->pm);
+ pbox++;
+ }
+
+ fbFinishAccess (pSrcDrawable);
+ fbFinishAccess (pDstDrawable);
+}
+
+PixmapPtr
+fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
+{
+ ScreenPtr pScreen = pOldTile->drawable.pScreen;
+ PixmapPtr pNewTile;
+ FbBits *old, *new;
+ FbStride oldStride, newStride;
+ int oldBpp, newBpp;
+ fb24_32BltFunc blt;
+ _X_UNUSED int oldXoff, oldYoff;
+ _X_UNUSED int newXoff, newYoff;
+
+ pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width,
+ pOldTile->drawable.height,
+ pOldTile->drawable.depth,
+ pOldTile->usage_hint);
+ if (!pNewTile)
+ return 0;
+ fbGetDrawable (&pOldTile->drawable,
+ old, oldStride, oldBpp, oldXoff, oldYoff);
+ fbGetDrawable (&pNewTile->drawable,
+ new, newStride, newBpp, newXoff, newYoff);
+ if (oldBpp == 24)
+ blt = fb24_32BltUp;
+ else
+ blt = fb24_32BltDown;
+
+ (*blt) ((CARD8 *) old,
+ oldStride * sizeof (FbBits),
+ 0,
+
+ (CARD8 *) new,
+ newStride * sizeof (FbBits),
+ 0,
+
+ pOldTile->drawable.width,
+ pOldTile->drawable.height,
+
+ GXcopy,
+ FB_ALLONES);
+
+ fbFinishAccess (&pOldTile->drawable);
+ fbFinishAccess (&pNewTile->drawable);
+
+ return pNewTile;
+}
+
+typedef struct {
+ pointer pbits;
+ int width;
+} miScreenInitParmsRec, *miScreenInitParmsPtr;
+
+Bool
+fb24_32CreateScreenResources(ScreenPtr pScreen)
+{
+ miScreenInitParmsPtr pScrInitParms;
+ int pitch;
+ Bool retval;
+
+ /* get the pitch before mi destroys it */
+ pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
+ pitch = BitmapBytePad(pScrInitParms->width * 24);
+
+ if((retval = miCreateScreenResources(pScreen))) {
+ /* fix the screen pixmap */
+ PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate;
+ pPix->drawable.bitsPerPixel = 24;
+ pPix->devKind = pitch;
+ }
+
+ return retval;
+}
+
+Bool
+fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel,
+ int devKind,
+ pointer pPixData)
+{
+ int bpp, w;
+
+ if (!pPixmap)
+ return FALSE;
+ bpp = bitsPerPixel;
+ if (bpp <= 0)
+ bpp = pPixmap->drawable.bitsPerPixel;
+ if (bpp == 24)
+ {
+ if (devKind < 0)
+ {
+ w = width;
+ if (w <= 0)
+ w = pPixmap->drawable.width;
+ devKind = BitmapBytePad(w * 24);
+ }
+ }
+ return miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
+ devKind, pPixData);
+}
diff --git a/xorg-server/fb/fbarc.c b/xorg-server/fb/fbarc.c
index a0c5343e0..e54c80491 100644
--- a/xorg-server/fb/fbarc.c
+++ b/xorg-server/fb/fbarc.c
@@ -68,15 +68,12 @@ fbPolyArc (DrawablePtr pDrawable,
BoxRec box;
int x2, y2;
RegionPtr cclip;
- int wrapped = 0;
+#ifdef FB_ACCESS_WRAPPER
+ int wrapped = 1;
+#endif
cclip = fbGetCompositeClip (pGC);
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-#ifdef FB_ACCESS_WRAPPER
- wrapped = 1;
-#else
- wrapped = 0;
-#endif
while (narcs--)
{
if (miCanZeroArc (parcs))
diff --git a/xorg-server/fb/fbfill.c b/xorg-server/fb/fbfill.c
index 664d6a82e..e62a48ae0 100644
--- a/xorg-server/fb/fbfill.c
+++ b/xorg-server/fb/fbfill.c
@@ -1,230 +1,230 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-
-void
-fbFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height)
-{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- switch (pGC->fillStyle) {
- case FillSolid:
-#ifndef FB_ACCESS_WRAPPER
- if (pPriv->and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
- x + dstXoff, y + dstYoff,
- width, height,
- pPriv->xor))
-#endif
- fbSolid (dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- dstBpp,
- width * dstBpp, height,
- pPriv->and, pPriv->xor);
- break;
- case FillStippled:
- case FillOpaqueStippled: {
- PixmapPtr pStip = pGC->stipple;
- int stipWidth = pStip->drawable.width;
- int stipHeight = pStip->drawable.height;
-
- if (dstBpp == 1)
- {
- int alu;
- FbBits *stip;
- FbStride stipStride;
- int stipBpp;
- int stipXoff, stipYoff; /* XXX assumed to be zero */
-
- if (pGC->fillStyle == FillStippled)
- alu = FbStipple1Rop(pGC->alu,pGC->fgPixel);
- else
- alu = FbOpaqueStipple1Rop(pGC->alu,pGC->fgPixel,pGC->bgPixel);
- fbGetDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
- fbTile (dst + (y + dstYoff) * dstStride,
- dstStride,
- x + dstXoff,
- width, height,
- stip,
- stipStride,
- stipWidth,
- stipHeight,
- alu,
- pPriv->pm,
- dstBpp,
-
- (pGC->patOrg.x + pDrawable->x + dstXoff),
- pGC->patOrg.y + pDrawable->y - y);
- fbFinishAccess (&pStip->drawable);
- }
- else
- {
- FbStip *stip;
- FbStride stipStride;
- int stipBpp;
- int stipXoff, stipYoff; /* XXX assumed to be zero */
- FbBits fgand, fgxor, bgand, bgxor;
-
- fgand = pPriv->and;
- fgxor = pPriv->xor;
- if (pGC->fillStyle == FillStippled)
- {
- bgand = fbAnd(GXnoop,(FbBits) 0,FB_ALLONES);
- bgxor = fbXor(GXnoop,(FbBits) 0,FB_ALLONES);
- }
- else
- {
- bgand = pPriv->bgand;
- bgxor = pPriv->bgxor;
- }
-
- fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
- fbStipple (dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- dstBpp,
- width * dstBpp, height,
- stip,
- stipStride,
- stipWidth,
- stipHeight,
- pPriv->evenStipple,
- fgand, fgxor,
- bgand, bgxor,
- pGC->patOrg.x + pDrawable->x + dstXoff,
- pGC->patOrg.y + pDrawable->y - y);
- fbFinishAccess (&pStip->drawable);
- }
- break;
- }
- case FillTiled: {
- PixmapPtr pTile = pGC->tile.pixmap;
- FbBits *tile;
- FbStride tileStride;
- int tileBpp;
- int tileWidth;
- int tileHeight;
- int tileXoff, tileYoff; /* XXX assumed to be zero */
-
- fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff);
- tileWidth = pTile->drawable.width;
- tileHeight = pTile->drawable.height;
- fbTile (dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- width * dstBpp, height,
- tile,
- tileStride,
- tileWidth * tileBpp,
- tileHeight,
- pGC->alu,
- pPriv->pm,
- dstBpp,
- (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
- pGC->patOrg.y + pDrawable->y - y);
- fbFinishAccess (&pTile->drawable);
- break;
- }
- }
- fbValidateDrawable (pDrawable);
- fbFinishAccess (pDrawable);
-}
-
-void
-fbSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- int x1,
- int y1,
- int x2,
- int y2,
- FbBits and,
- FbBits xor)
-{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxPtr pbox;
- int nbox;
- int partX1, partX2, partY1, partY2;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- partX1 = pbox->x1;
- if (partX1 < x1)
- partX1 = x1;
-
- partX2 = pbox->x2;
- if (partX2 > x2)
- partX2 = x2;
-
- if (partX2 <= partX1)
- continue;
-
- partY1 = pbox->y1;
- if (partY1 < y1)
- partY1 = y1;
-
- partY2 = pbox->y2;
- if (partY2 > y2)
- partY2 = y2;
-
- if (partY2 <= partY1)
- continue;
-
-#ifndef FB_ACCESS_WRAPPER
- if (and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
- partX1 + dstXoff, partY1 + dstYoff,
- (partX2 - partX1), (partY2 - partY1),
- xor))
-#endif
- fbSolid (dst + (partY1 + dstYoff) * dstStride,
- dstStride,
- (partX1 + dstXoff) * dstBpp,
- dstBpp,
-
- (partX2 - partX1) * dstBpp,
- (partY2 - partY1),
- and, xor);
- }
- fbFinishAccess (pDrawable);
-}
+/*
+ * Copyright © 1998 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "fb.h"
+
+void
+fbFill (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+
+ fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
+ switch (pGC->fillStyle) {
+ case FillSolid:
+#ifndef FB_ACCESS_WRAPPER
+ if (pPriv->and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
+ x + dstXoff, y + dstYoff,
+ width, height,
+ pPriv->xor))
+#endif
+ fbSolid (dst + (y + dstYoff) * dstStride,
+ dstStride,
+ (x + dstXoff) * dstBpp,
+ dstBpp,
+ width * dstBpp, height,
+ pPriv->and, pPriv->xor);
+ break;
+ case FillStippled:
+ case FillOpaqueStippled: {
+ PixmapPtr pStip = pGC->stipple;
+ int stipWidth = pStip->drawable.width;
+ int stipHeight = pStip->drawable.height;
+
+ if (dstBpp == 1)
+ {
+ int alu;
+ FbBits *stip;
+ FbStride stipStride;
+ int stipBpp;
+ _X_UNUSED int stipXoff, stipYoff;
+
+ if (pGC->fillStyle == FillStippled)
+ alu = FbStipple1Rop(pGC->alu,pGC->fgPixel);
+ else
+ alu = FbOpaqueStipple1Rop(pGC->alu,pGC->fgPixel,pGC->bgPixel);
+ fbGetDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
+ fbTile (dst + (y + dstYoff) * dstStride,
+ dstStride,
+ x + dstXoff,
+ width, height,
+ stip,
+ stipStride,
+ stipWidth,
+ stipHeight,
+ alu,
+ pPriv->pm,
+ dstBpp,
+
+ (pGC->patOrg.x + pDrawable->x + dstXoff),
+ pGC->patOrg.y + pDrawable->y - y);
+ fbFinishAccess (&pStip->drawable);
+ }
+ else
+ {
+ FbStip *stip;
+ FbStride stipStride;
+ int stipBpp;
+ _X_UNUSED int stipXoff, stipYoff;
+ FbBits fgand, fgxor, bgand, bgxor;
+
+ fgand = pPriv->and;
+ fgxor = pPriv->xor;
+ if (pGC->fillStyle == FillStippled)
+ {
+ bgand = fbAnd(GXnoop,(FbBits) 0,FB_ALLONES);
+ bgxor = fbXor(GXnoop,(FbBits) 0,FB_ALLONES);
+ }
+ else
+ {
+ bgand = pPriv->bgand;
+ bgxor = pPriv->bgxor;
+ }
+
+ fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
+ fbStipple (dst + (y + dstYoff) * dstStride,
+ dstStride,
+ (x + dstXoff) * dstBpp,
+ dstBpp,
+ width * dstBpp, height,
+ stip,
+ stipStride,
+ stipWidth,
+ stipHeight,
+ pPriv->evenStipple,
+ fgand, fgxor,
+ bgand, bgxor,
+ pGC->patOrg.x + pDrawable->x + dstXoff,
+ pGC->patOrg.y + pDrawable->y - y);
+ fbFinishAccess (&pStip->drawable);
+ }
+ break;
+ }
+ case FillTiled: {
+ PixmapPtr pTile = pGC->tile.pixmap;
+ FbBits *tile;
+ FbStride tileStride;
+ int tileBpp;
+ int tileWidth;
+ int tileHeight;
+ _X_UNUSED int tileXoff, tileYoff;
+
+ fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff);
+ tileWidth = pTile->drawable.width;
+ tileHeight = pTile->drawable.height;
+ fbTile (dst + (y + dstYoff) * dstStride,
+ dstStride,
+ (x + dstXoff) * dstBpp,
+ width * dstBpp, height,
+ tile,
+ tileStride,
+ tileWidth * tileBpp,
+ tileHeight,
+ pGC->alu,
+ pPriv->pm,
+ dstBpp,
+ (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
+ pGC->patOrg.y + pDrawable->y - y);
+ fbFinishAccess (&pTile->drawable);
+ break;
+ }
+ }
+ fbValidateDrawable (pDrawable);
+ fbFinishAccess (pDrawable);
+}
+
+void
+fbSolidBoxClipped (DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ FbBits and,
+ FbBits xor)
+{
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ BoxPtr pbox;
+ int nbox;
+ int partX1, partX2, partY1, partY2;
+
+ fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
+ for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip);
+ nbox--;
+ pbox++)
+ {
+ partX1 = pbox->x1;
+ if (partX1 < x1)
+ partX1 = x1;
+
+ partX2 = pbox->x2;
+ if (partX2 > x2)
+ partX2 = x2;
+
+ if (partX2 <= partX1)
+ continue;
+
+ partY1 = pbox->y1;
+ if (partY1 < y1)
+ partY1 = y1;
+
+ partY2 = pbox->y2;
+ if (partY2 > y2)
+ partY2 = y2;
+
+ if (partY2 <= partY1)
+ continue;
+
+#ifndef FB_ACCESS_WRAPPER
+ if (and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
+ partX1 + dstXoff, partY1 + dstYoff,
+ (partX2 - partX1), (partY2 - partY1),
+ xor))
+#endif
+ fbSolid (dst + (partY1 + dstYoff) * dstStride,
+ dstStride,
+ (partX1 + dstXoff) * dstBpp,
+ dstBpp,
+
+ (partX2 - partX1) * dstBpp,
+ (partY2 - partY1),
+ and, xor);
+ }
+ fbFinishAccess (pDrawable);
+}
diff --git a/xorg-server/fb/fbgc.c b/xorg-server/fb/fbgc.c
index cc504c1b8..8108c3acb 100644
--- a/xorg-server/fb/fbgc.c
+++ b/xorg-server/fb/fbgc.c
@@ -89,7 +89,7 @@ fbPadPixmap (PixmapPtr pPixmap)
int w;
int stride;
int bpp;
- int xOff, yOff;
+ _X_UNUSED int xOff, yOff;
fbGetDrawable (&pPixmap->drawable, bits, stride, bpp, xOff, yOff);
@@ -163,7 +163,7 @@ fbCanEvenStipple (PixmapPtr pStipple, int bpp)
FbBits *bits;
int stride;
int stip_bpp;
- int stipXoff, stipYoff;
+ _X_UNUSED int stipXoff, stipYoff;
int h;
/* can't even stipple 24bpp drawables */
diff --git a/xorg-server/fb/fbpush.c b/xorg-server/fb/fbpush.c
index cfb702483..8dd7c2b59 100644
--- a/xorg-server/fb/fbpush.c
+++ b/xorg-server/fb/fbpush.c
@@ -1,245 +1,245 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-
-void
-fbPushPattern (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
-
- int width,
- int height)
-{
- FbStip *s, bitsMask, bitsMask0, bits;
- int xspan;
- int w;
- int lenspan;
-
- src += srcX >> FB_STIP_SHIFT;
- srcX &= FB_STIP_MASK;
-
- bitsMask0 = FbStipMask (srcX, 1);
-
- while (height--)
- {
- bitsMask = bitsMask0;
- w = width;
- s = src;
- src += srcStride;
- bits = READ(s++);
- xspan = x;
- while (w)
- {
- if (bits & bitsMask)
- {
- lenspan = 0;
- do
- {
- lenspan++;
- if (lenspan == w)
- break;
- bitsMask = FbStipRight (bitsMask, 1);
- if (!bitsMask)
- {
- bits = READ(s++);
- bitsMask = FbBitsMask(0,1);
- }
- } while (bits & bitsMask);
- fbFill (pDrawable, pGC, xspan, y, lenspan, 1);
- xspan += lenspan;
- w -= lenspan;
- }
- else
- {
- do
- {
- w--;
- xspan++;
- if (!w)
- break;
- bitsMask = FbStipRight (bitsMask, 1);
- if (!bitsMask)
- {
- bits = READ(s++);
- bitsMask = FbBitsMask(0,1);
- }
- } while (!(bits & bitsMask));
- }
- }
- y++;
- }
-}
-
-void
-fbPushFill (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
- int width,
- int height)
-{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
-
- if (pGC->fillStyle == FillSolid)
- {
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int dstX;
- int dstWidth;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- dst = dst + (y + dstYoff) * dstStride;
- dstX = (x + dstXoff) * dstBpp;
- dstWidth = width * dstBpp;
- if (dstBpp == 1)
- {
- fbBltStip (src,
- srcStride,
- srcX,
-
- (FbStip *) dst,
- FbBitsStrideToStipStride (dstStride),
- dstX,
-
- dstWidth,
- height,
-
- FbStipple1Rop(pGC->alu,pGC->fgPixel),
- pPriv->pm,
- dstBpp);
- }
- else
- {
- fbBltOne (src,
- srcStride,
- srcX,
-
- dst,
- dstStride,
- dstX,
- dstBpp,
-
- dstWidth,
- height,
-
- pPriv->and, pPriv->xor,
- fbAnd(GXnoop,(FbBits) 0,FB_ALLONES),
- fbXor(GXnoop,(FbBits) 0,FB_ALLONES));
- }
- fbFinishAccess (pDrawable);
- }
- else
- {
- fbPushPattern (pDrawable, pGC, src, srcStride, srcX,
- x, y, width, height);
- }
-}
-
-void
-fbPushImage (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
- int width,
- int height)
-{
- RegionPtr pClip = fbGetCompositeClip (pGC);
- int nbox;
- BoxPtr pbox;
- int x1, y1, x2, y2;
-
- for (nbox = RegionNumRects (pClip),
- pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- x1 = x;
- y1 = y;
- x2 = x + width;
- y2 = y + height;
- if (x1 < pbox->x1)
- x1 = pbox->x1;
- if (y1 < pbox->y1)
- y1 = pbox->y1;
- if (x2 > pbox->x2)
- x2 = pbox->x2;
- if (y2 > pbox->y2)
- y2 = pbox->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
- fbPushFill (pDrawable,
- pGC,
-
- src + (y1 - y) * srcStride,
- srcStride,
- srcX + (x1 - x),
-
- x1,
- y1,
- x2 - x1,
- y2 - y1);
- }
-}
-
-void
-fbPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int dx,
- int dy,
- int xOrg,
- int yOrg)
-{
- FbStip *stip;
- FbStride stipStride;
- int stipBpp;
- int stipXoff, stipYoff; /* Assumed to be zero */
-
- fbGetStipDrawable (&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
-
- fbPushImage (pDrawable, pGC,
- stip, stipStride, 0,
- xOrg, yOrg, dx, dy);
-}
+/*
+ * Copyright © 1998 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "fb.h"
+
+void
+fbPushPattern (DrawablePtr pDrawable,
+ GCPtr pGC,
+
+ FbStip *src,
+ FbStride srcStride,
+ int srcX,
+
+ int x,
+ int y,
+
+ int width,
+ int height)
+{
+ FbStip *s, bitsMask, bitsMask0, bits;
+ int xspan;
+ int w;
+ int lenspan;
+
+ src += srcX >> FB_STIP_SHIFT;
+ srcX &= FB_STIP_MASK;
+
+ bitsMask0 = FbStipMask (srcX, 1);
+
+ while (height--)
+ {
+ bitsMask = bitsMask0;
+ w = width;
+ s = src;
+ src += srcStride;
+ bits = READ(s++);
+ xspan = x;
+ while (w)
+ {
+ if (bits & bitsMask)
+ {
+ lenspan = 0;
+ do
+ {
+ lenspan++;
+ if (lenspan == w)
+ break;
+ bitsMask = FbStipRight (bitsMask, 1);
+ if (!bitsMask)
+ {
+ bits = READ(s++);
+ bitsMask = FbBitsMask(0,1);
+ }
+ } while (bits & bitsMask);
+ fbFill (pDrawable, pGC, xspan, y, lenspan, 1);
+ xspan += lenspan;
+ w -= lenspan;
+ }
+ else
+ {
+ do
+ {
+ w--;
+ xspan++;
+ if (!w)
+ break;
+ bitsMask = FbStipRight (bitsMask, 1);
+ if (!bitsMask)
+ {
+ bits = READ(s++);
+ bitsMask = FbBitsMask(0,1);
+ }
+ } while (!(bits & bitsMask));
+ }
+ }
+ y++;
+ }
+}
+
+void
+fbPushFill (DrawablePtr pDrawable,
+ GCPtr pGC,
+
+ FbStip *src,
+ FbStride srcStride,
+ int srcX,
+
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+
+ if (pGC->fillStyle == FillSolid)
+ {
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int dstX;
+ int dstWidth;
+
+ fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ dst = dst + (y + dstYoff) * dstStride;
+ dstX = (x + dstXoff) * dstBpp;
+ dstWidth = width * dstBpp;
+ if (dstBpp == 1)
+ {
+ fbBltStip (src,
+ srcStride,
+ srcX,
+
+ (FbStip *) dst,
+ FbBitsStrideToStipStride (dstStride),
+ dstX,
+
+ dstWidth,
+ height,
+
+ FbStipple1Rop(pGC->alu,pGC->fgPixel),
+ pPriv->pm,
+ dstBpp);
+ }
+ else
+ {
+ fbBltOne (src,
+ srcStride,
+ srcX,
+
+ dst,
+ dstStride,
+ dstX,
+ dstBpp,
+
+ dstWidth,
+ height,
+
+ pPriv->and, pPriv->xor,
+ fbAnd(GXnoop,(FbBits) 0,FB_ALLONES),
+ fbXor(GXnoop,(FbBits) 0,FB_ALLONES));
+ }
+ fbFinishAccess (pDrawable);
+ }
+ else
+ {
+ fbPushPattern (pDrawable, pGC, src, srcStride, srcX,
+ x, y, width, height);
+ }
+}
+
+void
+fbPushImage (DrawablePtr pDrawable,
+ GCPtr pGC,
+
+ FbStip *src,
+ FbStride srcStride,
+ int srcX,
+
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ RegionPtr pClip = fbGetCompositeClip (pGC);
+ int nbox;
+ BoxPtr pbox;
+ int x1, y1, x2, y2;
+
+ for (nbox = RegionNumRects (pClip),
+ pbox = RegionRects(pClip);
+ nbox--;
+ pbox++)
+ {
+ x1 = x;
+ y1 = y;
+ x2 = x + width;
+ y2 = y + height;
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
+ if (y1 < pbox->y1)
+ y1 = pbox->y1;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
+ if (y2 > pbox->y2)
+ y2 = pbox->y2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
+ fbPushFill (pDrawable,
+ pGC,
+
+ src + (y1 - y) * srcStride,
+ srcStride,
+ srcX + (x1 - x),
+
+ x1,
+ y1,
+ x2 - x1,
+ y2 - y1);
+ }
+}
+
+void
+fbPushPixels (GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int dx,
+ int dy,
+ int xOrg,
+ int yOrg)
+{
+ FbStip *stip;
+ FbStride stipStride;
+ int stipBpp;
+ _X_UNUSED int stipXoff, stipYoff;
+
+ fbGetStipDrawable (&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
+
+ fbPushImage (pDrawable, pGC,
+ stip, stipStride, 0,
+ xOrg, yOrg, dx, dy);
+}