summaryrefslogtreecommitdiff
path: root/fb
diff options
context:
space:
mode:
Diffstat (limited to 'fb')
-rw-r--r--fb/fb.h1801
-rw-r--r--fb/fb24_32.c803
-rw-r--r--fb/fb24_32.h25
-rw-r--r--fb/fballpriv.c31
-rw-r--r--fb/fbarc.c189
-rw-r--r--fb/fbbits.c2
-rw-r--r--fb/fbbits.h1430
-rw-r--r--fb/fbblt.c1372
-rw-r--r--fb/fbbltone.c964
-rw-r--r--fb/fbcmap_mi.c37
-rw-r--r--fb/fbcopy.c522
-rw-r--r--fb/fbfill.c326
-rw-r--r--fb/fbfillrect.c127
-rw-r--r--fb/fbfillsp.c111
-rw-r--r--fb/fbgc.c303
-rw-r--r--fb/fbgetsp.c73
-rw-r--r--fb/fbglyph.c583
-rw-r--r--fb/fbimage.c492
-rw-r--r--fb/fbline.c184
-rw-r--r--fb/fboverlay.c444
-rw-r--r--fb/fboverlay.h109
-rw-r--r--fb/fbpict.c380
-rw-r--r--fb/fbpict.h75
-rw-r--r--fb/fbpixmap.c408
-rw-r--r--fb/fbpoint.c200
-rw-r--r--fb/fbpush.c331
-rw-r--r--fb/fbrop.h21
-rw-r--r--fb/fbscreen.c238
-rw-r--r--fb/fbseg.c1053
-rw-r--r--fb/fbsetsp.c118
-rw-r--r--fb/fbsolid.c252
-rw-r--r--fb/fbstipple.c348
-rw-r--r--fb/fbtile.c246
-rw-r--r--fb/fbtrap.c244
-rw-r--r--fb/fbutil.c483
-rw-r--r--fb/fbwindow.c200
36 files changed, 6499 insertions, 8026 deletions
diff --git a/fb/fb.h b/fb/fb.h
index eaa21ad75..b327ce653 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -21,7 +21,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-
#ifndef _FB_H_
#define _FB_H_
@@ -86,75 +85,67 @@
#endif
#if FB_SHIFT < LOG2_BITMAP_PAD
- error FB_SHIFT must be >= LOG2_BITMAP_PAD
+error FB_SHIFT must be >= LOG2_BITMAP_PAD
#endif
-
#define FB_UNIT (1 << FB_SHIFT)
#define FB_HALFUNIT (1 << (FB_SHIFT-1))
#define FB_MASK (FB_UNIT - 1)
#define FB_ALLONES ((FbBits) -1)
-
#if GLYPHPADBYTES != 4
#error "GLYPHPADBYTES must be 4"
#endif
-
/* for driver compat - intel UXA needs the second one at least */
#define FB_24BIT
#define FB_24_32BIT
-
#define FB_STIP_SHIFT LOG2_BITMAP_PAD
#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
#define FB_STIP_MASK (FB_STIP_UNIT - 1)
#define FB_STIP_ALLONES ((FbStip) -1)
-
#define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0)
#define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0)
-
#define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT)))
#define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT)))
-
#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1))
-
#if FB_SHIFT == 6
-# ifdef WIN32
-typedef unsigned __int64 FbBits;
-# else
-# if defined(__alpha__) || defined(__alpha) || \
+#ifdef WIN32
+typedef unsigned __int64 FbBits;
+#else
+#if defined(__alpha__) || defined(__alpha) || \
defined(ia64) || defined(__ia64__) || \
defined(__sparc64__) || defined(_LP64) || \
defined(__s390x__) || \
defined(amd64) || defined (__amd64__) || \
defined (__powerpc64__)
-typedef unsigned long FbBits;
-# else
-typedef unsigned long long FbBits;
-# endif
-# endif
+typedef unsigned long FbBits;
+#else
+typedef unsigned long long FbBits;
+#endif
+#endif
#endif
#if FB_SHIFT == 5
-typedef CARD32 FbBits;
+typedef CARD32 FbBits;
#endif
#if FB_SHIFT == 4
-typedef CARD16 FbBits;
+typedef CARD16 FbBits;
#endif
#if LOG2_BITMAP_PAD == FB_SHIFT
-typedef FbBits FbStip;
+typedef FbBits FbStip;
#else
-# if LOG2_BITMAP_PAD == 5
-typedef CARD32 FbStip;
-# endif
+#if LOG2_BITMAP_PAD == 5
+typedef CARD32 FbStip;
+#endif
#endif
-typedef int FbStride;
-
+typedef int FbStride;
#ifdef FB_DEBUG
extern _X_EXPORT void fbValidateDrawable(DrawablePtr d);
extern _X_EXPORT void fbInitializeDrawable(DrawablePtr d);
-extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
+extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
+
#define FB_HEAD_BITS (FbStip) (0xbaadf00d)
#define FB_TAIL_BITS (FbStip) (0xbaddf0ad)
#else
@@ -207,7 +198,6 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
-
#define FbMaskBits(x,w,l,n,r) { \
n = (w); \
r = FbRightMask((x)+n); \
@@ -223,7 +213,6 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
n >>= FB_SHIFT; \
}
-
#define FbByteMaskInvalid 0x10
#define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1)))
@@ -416,7 +405,6 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
} \
}
-
#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
switch (rb) { \
case 1: \
@@ -543,7 +531,7 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
#define FbDashDeclare \
unsigned char *__dash, *__firstDash, *__lastDash
-
+
#define FbDashInit(pGC,pPriv,dashOffset,dashlen,even) { \
(even) = TRUE; \
__firstDash = (pGC)->dash; \
@@ -583,22 +571,21 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
}
extern _X_EXPORT DevPrivateKey
-fbGetGCPrivateKey (void);
+ fbGetGCPrivateKey(void);
extern _X_EXPORT DevPrivateKey
-fbGetWinPrivateKey (void);
-
-extern _X_EXPORT const GCOps fbGCOps;
-extern _X_EXPORT const GCFuncs fbGCFuncs;
+ fbGetWinPrivateKey(void);
+extern _X_EXPORT const GCOps fbGCOps;
+extern _X_EXPORT const GCFuncs fbGCFuncs;
/* Framebuffer access wrapper */
-typedef FbBits (*ReadMemoryProcPtr)(const void *src, int size);
-typedef void (*WriteMemoryProcPtr)(void *dst, FbBits value, int size);
-typedef void (*SetupWrapProcPtr)(ReadMemoryProcPtr *pRead,
- WriteMemoryProcPtr *pWrite,
- DrawablePtr pDraw);
-typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
+typedef FbBits(*ReadMemoryProcPtr) (const void *src, int size);
+typedef void (*WriteMemoryProcPtr) (void *dst, FbBits value, int size);
+typedef void (*SetupWrapProcPtr) (ReadMemoryProcPtr * pRead,
+ WriteMemoryProcPtr * pWrite,
+ DrawablePtr pDraw);
+typedef void (*FinishWrapProcPtr) (DrawablePtr pDraw);
#ifdef FB_ACCESS_WRAPPER
@@ -617,17 +604,16 @@ typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
#endif
-
extern _X_EXPORT DevPrivateKey
-fbGetScreenPrivateKey(void);
+ fbGetScreenPrivateKey(void);
/* private field of a screen */
typedef struct {
- unsigned char win32bpp; /* window bpp for 32-bpp images */
- unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
+ unsigned char win32bpp; /* window bpp for 32-bpp images */
+ unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
#ifdef FB_ACCESS_WRAPPER
- SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */
- FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */
+ SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */
+ FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */
#endif
} FbScreenPrivRec, *FbScreenPrivPtr;
@@ -636,12 +622,12 @@ typedef struct {
/* private field of GC */
typedef struct {
- FbBits and, xor; /* reduced rop values */
- FbBits bgand, bgxor; /* for stipples */
- FbBits fg, bg, pm; /* expanded and filled */
- unsigned int dashLength; /* total of all dash elements */
- unsigned char evenStipple; /* stipple is even */
- unsigned char bpp; /* current drawable bpp */
+ FbBits and, xor; /* reduced rop values */
+ FbBits bgand, bgxor; /* for stipples */
+ FbBits fg, bg, pm; /* expanded and filled */
+ unsigned int dashLength; /* total of all dash elements */
+ unsigned char evenStipple; /* stipple is even */
+ unsigned char bpp; /* current drawable bpp */
} FbGCPrivRec, *FbGCPrivPtr;
#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
@@ -738,689 +724,496 @@ typedef struct {
* fb24_32.c
*/
extern _X_EXPORT void
-fb24_32GetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart);
-
-extern _X_EXPORT void
-fb24_32SetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted);
-
-extern _X_EXPORT void
-fb24_32PutZImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- int alu,
- FbBits pm,
- int x,
- int y,
- int width,
- int height,
- CARD8 *src,
- FbStride srcStride);
-
-extern _X_EXPORT void
-fb24_32GetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d);
-
-extern _X_EXPORT 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);
+
+fb24_32GetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart);
+
+extern _X_EXPORT void
+
+fb24_32SetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
+
+extern _X_EXPORT void
+
+fb24_32PutZImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y, int width, int height, CARD8 *src, FbStride srcStride);
+
+extern _X_EXPORT void
+
+fb24_32GetImage(DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w,
+ int h, unsigned int format, unsigned long planeMask, char *d);
+
+extern _X_EXPORT 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);
extern _X_EXPORT PixmapPtr
-fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
-
+ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
+
extern _X_EXPORT Bool
-fb24_32CreateScreenResources(ScreenPtr pScreen);
+ fb24_32CreateScreenResources(ScreenPtr pScreen);
extern _X_EXPORT Bool
-fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
- int width,
- int height,
- int depth,
- int bitsPerPixel,
- int devKind,
- pointer pPixData);
+
+fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel, int devKind, pointer pPixData);
/*
* fballpriv.c
*/
extern _X_EXPORT Bool
-fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex);
-
+ fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex);
+
/*
* fbarc.c
*/
extern _X_EXPORT void
-fbPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *parcs);
+ fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs);
/*
* fbbits.c
*/
extern _X_EXPORT void
-fbBresSolid8(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbBresDash8 (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbDots8 (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbArc8 (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbGlyph8 (FbBits *dstLine,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int height,
- int shift);
-
-extern _X_EXPORT void
-fbPolyline8 (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig);
-
-extern _X_EXPORT void
-fbPolySegment8 (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
-
-extern _X_EXPORT void
-fbBresSolid16(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbBresDash16(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbDots16(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbArc16(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbGlyph16(FbBits *dstLine,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int height,
- int shift);
-
-extern _X_EXPORT void
-fbPolyline16 (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig);
-
-extern _X_EXPORT void
-fbPolySegment16 (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
-
-
-extern _X_EXPORT void
-fbBresSolid24(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbBresDash24(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbDots24(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbArc24(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbGlyph24(FbBits *dstLine,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int height,
- int shift);
-
-extern _X_EXPORT void
-fbPolyline24 (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig);
-
-extern _X_EXPORT void
-fbPolySegment24 (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
-
-
-extern _X_EXPORT void
-fbBresSolid32(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbBresDash32(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbDots32(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbArc32(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbGlyph32(FbBits *dstLine,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int height,
- int shift);
-extern _X_EXPORT void
-fbPolyline32 (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig);
-
-extern _X_EXPORT void
-fbPolySegment32 (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
+
+fbBresSolid8(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbBresDash8(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbDots8(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbArc8(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbGlyph8(FbBits * dstLine,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
+
+extern _X_EXPORT void
+
+fbPolyline8(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
+
+extern _X_EXPORT void
+ fbPolySegment8(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
+
+extern _X_EXPORT void
+
+fbBresSolid16(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbBresDash16(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbDots16(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbArc16(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbGlyph16(FbBits * dstLine,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
+
+extern _X_EXPORT void
+
+fbPolyline16(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
+
+extern _X_EXPORT void
+ fbPolySegment16(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
+
+extern _X_EXPORT void
+
+fbBresSolid24(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbBresDash24(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbDots24(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbArc24(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbGlyph24(FbBits * dstLine,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
+
+extern _X_EXPORT void
+
+fbPolyline24(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
+
+extern _X_EXPORT void
+ fbPolySegment24(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
+
+extern _X_EXPORT void
+
+fbBresSolid32(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbBresDash32(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbDots32(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbArc32(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbGlyph32(FbBits * dstLine,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
+extern _X_EXPORT void
+
+fbPolyline32(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
+
+extern _X_EXPORT void
+ fbPolySegment32(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
/*
* fbblt.c
*/
extern _X_EXPORT void
-fbBlt (FbBits *src,
- FbStride srcStride,
- int srcX,
-
- FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp,
-
- Bool reverse,
- Bool upsidedown);
-
-extern _X_EXPORT void
-fbBlt24 (FbBits *srcLine,
- FbStride srcStride,
- int srcX,
-
- FbBits *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
-
- Bool reverse,
- Bool upsidedown);
-
-extern _X_EXPORT void
-fbBltStip (FbStip *src,
- FbStride srcStride, /* in FbStip units, not FbBits units */
- int srcX,
-
- FbStip *dst,
- FbStride dstStride, /* in FbStip units, not FbBits units */
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp);
-
+
+fbBlt(FbBits * src,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown);
+
+extern _X_EXPORT void
+
+fbBlt24(FbBits * srcLine,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dstLine,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height, int alu, FbBits pm, Bool reverse, Bool upsidedown);
+
+extern _X_EXPORT void
+ fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */
+ int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */
+ int dstX, int width, int height, int alu, FbBits pm, int bpp);
+
/*
* fbbltone.c
*/
extern _X_EXPORT void
-fbBltOne (FbStip *src,
- FbStride srcStride,
- int srcX,
- FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbBits fgand,
- FbBits fbxor,
- FbBits bgand,
- FbBits bgxor);
-
-extern _X_EXPORT void
-fbBltOne24 (FbStip *src,
- FbStride srcStride, /* FbStip units per scanline */
- int srcX, /* bit position of source */
- FbBits *dst,
- FbStride dstStride, /* FbBits units per scanline */
- int dstX, /* bit position of dest */
- int dstBpp, /* bits per destination unit */
-
- int width, /* width in bits of destination */
- int height, /* height in scanlines */
-
- FbBits fgand, /* rrop values */
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor);
-
-extern _X_EXPORT void
-fbBltPlane (FbBits *src,
- FbStride srcStride,
- int srcX,
- int srcBpp,
-
- FbStip *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbStip fgand,
- FbStip fgxor,
- FbStip bgand,
- FbStip bgxor,
- Pixel planeMask);
+
+fbBltOne(FbStip * src,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height, FbBits fgand, FbBits fbxor, FbBits bgand, FbBits bgxor);
+
+extern _X_EXPORT void
+ fbBltOne24(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
+ int srcX, /* bit position of source */
+ FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
+ int dstX, /* bit position of dest */
+ int dstBpp, /* bits per destination unit */
+ int width, /* width in bits of destination */
+ int height, /* height in scanlines */
+ FbBits fgand, /* rrop values */
+ FbBits fgxor, FbBits bgand, FbBits bgxor);
+
+extern _X_EXPORT void
+
+fbBltPlane(FbBits * src,
+ FbStride srcStride,
+ int srcX,
+ int srcBpp,
+ FbStip * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbStip fgand,
+ FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask);
/*
* fbcmap_mi.c
*/
extern _X_EXPORT int
-fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
+ fbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps);
extern _X_EXPORT void
-fbInstallColormap(ColormapPtr pmap);
+ fbInstallColormap(ColormapPtr pmap);
extern _X_EXPORT void
-fbUninstallColormap(ColormapPtr pmap);
+ fbUninstallColormap(ColormapPtr pmap);
extern _X_EXPORT void
-fbResolveColor(unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual);
+
+fbResolveColor(unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue, VisualPtr pVisual);
extern _X_EXPORT Bool
-fbInitializeColormap(ColormapPtr pmap);
+ fbInitializeColormap(ColormapPtr pmap);
extern _X_EXPORT int
-fbExpandDirectColors (ColormapPtr pmap,
- int ndef,
- xColorItem *indefs,
- xColorItem *outdefs);
+
+fbExpandDirectColors(ColormapPtr pmap,
+ int ndef, xColorItem * indefs, xColorItem * outdefs);
extern _X_EXPORT Bool
-fbCreateDefColormap(ScreenPtr pScreen);
+ fbCreateDefColormap(ScreenPtr pScreen);
extern _X_EXPORT void
-fbClearVisualTypes(void);
+ fbClearVisualTypes(void);
extern _X_EXPORT Bool
-fbHasVisualTypes (int depth);
+ fbHasVisualTypes(int depth);
extern _X_EXPORT Bool
-fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);
+ fbSetVisualTypes(int depth, int visuals, int bitsPerRGB);
extern _X_EXPORT Bool
-fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
- Pixel redMask, Pixel greenMask, Pixel blueMask);
+
+fbSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
+ Pixel redMask, Pixel greenMask, Pixel blueMask);
extern _X_EXPORT Bool
-fbInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB);
+
+fbInitVisuals(VisualPtr * visualp,
+ DepthPtr * depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB);
/*
* fbcopy.c
*/
/* Compatibility definition, to be removed at next ABI change. */
-typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pDstBox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-fbCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
+typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pDstBox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown, Pixel bitplane, void *closure);
+
+extern _X_EXPORT void
+
+fbCopyNtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
/* Compatibility wrapper, to be removed at next ABI change. */
extern _X_EXPORT void
-fbCopyRegion (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- RegionPtr pDstRegion,
- int dx,
- int dy,
- fbCopyProc copyProc,
- Pixel bitPlane,
- void *closure);
+
+fbCopyRegion(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ RegionPtr pDstRegion,
+ int dx,
+ int dy, fbCopyProc copyProc, Pixel bitPlane, void *closure);
/* Compatibility wrapper, to be removed at next ABI change. */
extern _X_EXPORT RegionPtr
-fbDoCopy (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- fbCopyProc copyProc,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-fbCopy1toN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-fbCopyNto1 (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
+
+fbDoCopy(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc,
+ int xOut,
+ int yOut, fbCopyProc copyProc, Pixel bitplane, void *closure);
+
+extern _X_EXPORT void
+
+fbCopy1toN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
+
+extern _X_EXPORT void
+
+fbCopyNto1(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
extern _X_EXPORT RegionPtr
-fbCopyArea (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut);
+
+fbCopyArea(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut);
extern _X_EXPORT RegionPtr
-fbCopyPlane (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- unsigned long bitplane);
+
+fbCopyPlane(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc, int xOut, int yOut, unsigned long bitplane);
/*
* fbfill.c
*/
extern _X_EXPORT void
-fbFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height);
+ fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height);
extern _X_EXPORT void
-fbSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- int xa,
- int ya,
- int xb,
- int yb,
- FbBits and,
- FbBits xor);
+
+fbSolidBoxClipped(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int xa, int ya, int xb, int yb, FbBits and, FbBits xor);
/*
* fbfillrect.c
*/
extern _X_EXPORT void
-fbPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrectInit,
- xRectangle *prectInit);
+
+fbPolyFillRect(DrawablePtr pDrawable,
+ GCPtr pGC, int nrectInit, xRectangle *prectInit);
#define fbPolyFillArc miPolyFillArc
@@ -1430,155 +1223,117 @@ fbPolyFillRect(DrawablePtr pDrawable,
* fbfillsp.c
*/
extern _X_EXPORT void
-fbFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted);
+fbFillSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted);
/*
* fbgc.c
*/
extern _X_EXPORT Bool
-fbCreateGC(GCPtr pGC);
+ fbCreateGC(GCPtr pGC);
extern _X_EXPORT void
-fbPadPixmap (PixmapPtr pPixmap);
-
+ fbPadPixmap(PixmapPtr pPixmap);
+
extern _X_EXPORT void
-fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
+ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
/*
* fbgetsp.c
*/
extern _X_EXPORT void
-fbGetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart);
+
+fbGetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart);
/*
* fbglyph.c
*/
extern _X_EXPORT Bool
-fbGlyphIn (RegionPtr pRegion,
- int x,
- int y,
- int width,
- int height);
-
-extern _X_EXPORT void
-fbPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-
-extern _X_EXPORT void
-fbImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
+ fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height);
+
+extern _X_EXPORT void
+
+fbPolyGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase);
+
+extern _X_EXPORT void
+
+fbImageGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase);
/*
* fbimage.c
*/
extern _X_EXPORT void
-fbPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage);
-
-extern _X_EXPORT void
-fbPutZImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- int alu,
- FbBits pm,
- int x,
- int y,
- int width,
- int height,
- FbStip *src,
- FbStride srcStride);
-
-extern _X_EXPORT void
-fbPutXYImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- FbBits fg,
- FbBits bg,
- FbBits pm,
- int alu,
- Bool opaque,
-
- int x,
- int y,
- int width,
- int height,
-
- FbStip *src,
- FbStride srcStride,
- int srcX);
-
-extern _X_EXPORT void
-fbGetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d);
+
+fbPutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage);
+
+extern _X_EXPORT void
+
+fbPutZImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y, int width, int height, FbStip * src, FbStride srcStride);
+
+extern _X_EXPORT void
+
+fbPutXYImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ FbBits fg,
+ FbBits bg,
+ FbBits pm,
+ int alu,
+ Bool opaque,
+ int x,
+ int y,
+ int width, int height, FbStip * src, FbStride srcStride, int srcX);
+
+extern _X_EXPORT void
+
+fbGetImage(DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w, int h, unsigned int format, unsigned long planeMask, char *d);
/*
* fbline.c
*/
extern _X_EXPORT void
-fbZeroLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
+
+fbZeroLine(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
extern _X_EXPORT void
-fbZeroSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSegs);
+ fbZeroSegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs);
extern _X_EXPORT void
-fbPolyLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
+
+fbPolyLine(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
extern _X_EXPORT void
-fbFixCoordModePrevious (int npt,
- DDXPointPtr ppt);
+ fbFixCoordModePrevious(int npt, DDXPointPtr ppt);
extern _X_EXPORT void
-fbPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
+ fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
#define fbPolyRectangle miPolyRectangle
@@ -1587,415 +1342,299 @@ fbPolySegment (DrawablePtr pDrawable,
*/
extern _X_EXPORT Bool
-fbPictureInit (ScreenPtr pScreen,
- PictFormatPtr formats,
- int nformats);
+ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
/*
* fbpixmap.c
*/
extern _X_EXPORT PixmapPtr
-fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
- unsigned usage_hint);
+
+fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
+ unsigned usage_hint);
extern _X_EXPORT PixmapPtr
-fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
+
+fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
extern _X_EXPORT Bool
-fbDestroyPixmap (PixmapPtr pPixmap);
+ fbDestroyPixmap(PixmapPtr pPixmap);
extern _X_EXPORT RegionPtr
-fbPixmapToRegion(PixmapPtr pPix);
+ fbPixmapToRegion(PixmapPtr pPix);
/*
* fbpoint.c
*/
extern _X_EXPORT void
-fbDots (FbBits *dstOrig,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits andOrig,
- FbBits xorOrig);
+
+fbDots(FbBits * dstOrig,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig);
extern _X_EXPORT void
-fbPolyPoint (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit);
+
+fbPolyPoint(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, xPoint * pptInit);
/*
* fbpush.c
*/
extern _X_EXPORT void
-fbPushPattern (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
- int width,
- int height);
+fbPushPattern(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride,
+ int srcX, int x, int y, int width, int height);
extern _X_EXPORT void
-fbPushFill (DrawablePtr pDrawable,
- GCPtr pGC,
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
- int width,
- int height);
+fbPushFill(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride, int srcX, int x, int y, int width, int height);
extern _X_EXPORT void
-fbPushImage (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
- int x,
- int y,
- int width,
- int height);
+fbPushImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride, int srcX, int x, int y, int width, int height);
extern _X_EXPORT void
-fbPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int dx,
- int dy,
- int xOrg,
- int yOrg);
+fbPushPixels(GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg);
/*
* fbscreen.c
*/
extern _X_EXPORT Bool
-fbCloseScreen (int indx, ScreenPtr pScreen);
+ fbCloseScreen(int indx, ScreenPtr pScreen);
extern _X_EXPORT Bool
-fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
+ fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
extern _X_EXPORT Bool
-fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
+ fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
extern _X_EXPORT void
-fbQueryBestSize (int class,
- unsigned short *width, unsigned short *height,
- ScreenPtr pScreen);
+
+fbQueryBestSize(int class,
+ unsigned short *width, unsigned short *height,
+ ScreenPtr pScreen);
extern _X_EXPORT PixmapPtr
-_fbGetWindowPixmap (WindowPtr pWindow);
+ _fbGetWindowPixmap(WindowPtr pWindow);
extern _X_EXPORT void
-_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap);
+ _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap);
extern _X_EXPORT Bool
-fbSetupScreen(ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, /* in pixels */
- int ysize,
- int dpix, /* dots per inch */
- int dpiy,
- int width, /* pixel width of frame buffer */
- int bpp); /* bits per pixel of frame buffer */
+ fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */
+ int xsize, /* in pixels */
+ int ysize, int dpix, /* dots per inch */
+ int dpiy, int width, /* pixel width of frame buffer */
+ int bpp); /* bits per pixel of frame buffer */
extern _X_EXPORT Bool
-wfbFinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp,
- SetupWrapProcPtr setupWrap,
- FinishWrapProcPtr finishWrap);
+
+wfbFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int bpp,
+ SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap);
extern _X_EXPORT Bool
-wfbScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp,
- SetupWrapProcPtr setupWrap,
- FinishWrapProcPtr finishWrap);
+
+wfbScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int bpp,
+ SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap);
extern _X_EXPORT Bool
-fbFinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp);
+
+fbFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize, int dpix, int dpiy, int width, int bpp);
extern _X_EXPORT Bool
-fbScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp);
-
+
+fbScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize, int dpix, int dpiy, int width, int bpp);
+
/*
* fbseg.c
*/
-typedef void FbBres (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
+typedef void FbBres(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
extern _X_EXPORT FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash;
+
/*
* fbsetsp.c
*/
extern _X_EXPORT void
-fbSetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted);
-extern _X_EXPORT FbBres *
-fbSelectBres (DrawablePtr pDrawable,
- GCPtr pGC);
+fbSetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
+
+extern _X_EXPORT FbBres *fbSelectBres(DrawablePtr pDrawable, GCPtr pGC);
extern _X_EXPORT void
-fbBres (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
+
+fbBres(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x, int y, int e, int e1, int e3, int len);
extern _X_EXPORT void
-fbSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int xa,
- int ya,
- int xb,
- int yb,
- Bool drawLast,
- int *dashOffset);
+fbSegment(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xa, int ya, int xb, int yb, Bool drawLast, int *dashOffset);
/*
* fbsolid.c
*/
extern _X_EXPORT void
-fbSolid (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int bpp,
-
- int width,
- int height,
- FbBits and,
- FbBits xor);
+fbSolid(FbBits * dst,
+ FbStride dstStride,
+ int dstX, int bpp, int width, int height, FbBits and, FbBits xor);
extern _X_EXPORT void
-fbSolid24 (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int width,
- int height,
-
- FbBits and,
- FbBits xor);
+fbSolid24(FbBits * dst,
+ FbStride dstStride,
+ int dstX, int width, int height, FbBits and, FbBits xor);
/*
* fbstipple.c
*/
extern _X_EXPORT void
-fbTransparentSpan (FbBits *dst,
- FbBits stip,
- FbBits fgxor,
- int n);
+ fbTransparentSpan(FbBits * dst, FbBits stip, FbBits fgxor, int n);
extern _X_EXPORT void
-fbEvenStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipHeight,
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot);
+fbEvenStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipHeight,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
extern _X_EXPORT void
-fbOddStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipWidth,
- int stipHeight,
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot);
+fbOddStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipWidth,
+ int stipHeight,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
extern _X_EXPORT void
-fbStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipWidth,
- int stipHeight,
- Bool even,
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot);
+fbStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipWidth,
+ int stipHeight,
+ Bool even,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
/*
* fbtile.c
*/
extern _X_EXPORT void
-fbEvenTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbBits *tile,
- FbStride tileStride,
- int tileHeight,
- int alu,
- FbBits pm,
- int xRot,
- int yRot);
+fbEvenTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileHeight, int alu, FbBits pm, int xRot, int yRot);
extern _X_EXPORT void
-fbOddTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int width,
- int height,
-
- FbBits *tile,
- FbStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int bpp,
-
- int xRot,
- int yRot);
+fbOddTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileWidth,
+ int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
extern _X_EXPORT void
-fbTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
- FbBits *tile,
- FbStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int bpp,
-
- int xRot,
- int yRot);
+fbTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileWidth,
+ int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
/*
* fbutil.c
*/
-extern _X_EXPORT FbBits
-fbReplicatePixel (Pixel p, int bpp);
+extern _X_EXPORT FbBits fbReplicatePixel(Pixel p, int bpp);
extern _X_EXPORT void
-fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
+ fbReduceRasterOp(int rop, FbBits fg, FbBits pm, FbBits * andp, FbBits * xorp);
#ifdef FB_ACCESS_WRAPPER
extern _X_EXPORT ReadMemoryProcPtr wfbReadMemory;
@@ -2007,54 +1646,46 @@ extern _X_EXPORT WriteMemoryProcPtr wfbWriteMemory;
*/
extern _X_EXPORT Bool
-fbCreateWindow(WindowPtr pWin);
+ fbCreateWindow(WindowPtr pWin);
extern _X_EXPORT Bool
-fbDestroyWindow(WindowPtr pWin);
+ fbDestroyWindow(WindowPtr pWin);
extern _X_EXPORT Bool
-fbMapWindow(WindowPtr pWindow);
+ fbMapWindow(WindowPtr pWindow);
extern _X_EXPORT Bool
-fbPositionWindow(WindowPtr pWin, int x, int y);
+ fbPositionWindow(WindowPtr pWin, int x, int y);
extern _X_EXPORT Bool
-fbUnmapWindow(WindowPtr pWindow);
-
-extern _X_EXPORT void
-fbCopyWindowProc (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-fbCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
+ fbUnmapWindow(WindowPtr pWindow);
+
+extern _X_EXPORT void
+
+fbCopyWindowProc(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
+
+extern _X_EXPORT void
+ fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
extern _X_EXPORT Bool
-fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
+ fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
extern _X_EXPORT void
-fbFillRegionSolid (DrawablePtr pDrawable,
- RegionPtr pRegion,
- FbBits and,
- FbBits xor);
-extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff);
+fbFillRegionSolid(DrawablePtr pDrawable,
+ RegionPtr pRegion, FbBits and, FbBits xor);
-extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
+extern _X_EXPORT pixman_image_t *image_from_pict(PicturePtr pict,
+ Bool has_clip,
+ int *xoff, int *yoff);
-#endif /* _FB_H_ */
+extern _X_EXPORT void free_pixman_pict(PicturePtr, pixman_image_t *);
+#endif /* _FB_H_ */
diff --git a/fb/fb24_32.c b/fb/fb24_32.c
index 033fa46c5..5eb81e8f0 100644
--- a/fb/fb24_32.c
+++ b/fb/fb24_32.c
@@ -51,214 +51,186 @@
(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);
+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,
+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;
- int width,
- int height,
+ FbDeclareMergeRop();
- 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);
+ 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));
+ WRITE((CARD32 *) dst, (s0 & 0xffffff) | (s1 << 24));
#else
- WRITE((CARD32 *)dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
+ WRITE((CARD32 *) dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
#endif
- s0 = READ(src++);
- s0 = FbDoDestInvarientMergeRop(s0);
+ s0 = READ(src++);
+ s0 = FbDoDestInvarientMergeRop(s0);
#if BITMAP_BIT_ORDER == LSBFirst
- WRITE((CARD32 *)(dst+4), ((s1 & 0xffffff) >> 8) | (s0 << 16));
+ WRITE((CARD32 *) (dst + 4),
+ ((s1 & 0xffffff) >> 8) | (s0 << 16));
#else
- WRITE((CARD32 *)(dst+4), (s1 << 16) | ((s0 & 0xffffff) >> 8));
+ WRITE((CARD32 *) (dst + 4),
+ (s1 << 16) | ((s0 & 0xffffff) >> 8));
#endif
- s1 = READ(src++);
- s1 = FbDoDestInvarientMergeRop(s1);
+ s1 = READ(src++);
+ s1 = FbDoDestInvarientMergeRop(s1);
#if BITMAP_BIT_ORDER == LSBFirst
- WRITE((CARD32 *)(dst+8), ((s0 & 0xffffff) >> 16) | (s1 << 8));
+ WRITE((CARD32 *) (dst + 8),
+ ((s0 & 0xffffff) >> 16) | (s1 << 8));
#else
- WRITE((CARD32 *)(dst+8), (s0 << 24) | (s1 & 0xffffff));
+ 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;
- }
- }
+ 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,
+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;
- int width,
- int height,
+ FbDeclareMergeRop();
- 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);
+ 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;
+ pixel = s0 & 0xffffff;
#else
- pixel = s0 >> 8;
+ pixel = s0 >> 8;
#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- s1 = READ((CARD32 *)(src+4));
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ s1 = READ((CARD32 *) (src + 4));
#if BITMAP_BIT_ORDER == LSBFirst
- pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
+ pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
#else
- pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
+ pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- s0 = READ((CARD32 *)(src+8));
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ s0 = READ((CARD32 *) (src + 8));
#if BITMAP_BIT_ORDER == LSBFirst
- pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
+ pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
#else
- pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
+ pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
#if BITMAP_BIT_ORDER == LSBFirst
- pixel = s0 >> 8;
+ pixel = s0 >> 8;
#else
- pixel = s0 & 0xffffff;
+ 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++;
- }
- }
+ 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++;
+ }
+ }
}
}
@@ -266,321 +238,265 @@ fb24_32BltUp (CARD8 *srcLine,
* Spans functions; probably unused.
*/
void
-fb24_32GetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart)
+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);
+ 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++;
+ 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);
+ fbFinishAccess(pDrawable);
}
void
-fb24_32SetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted)
+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);
+ 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++;
+ 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);
+ 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)
+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);
+ 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);
+ 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);
+ fbFinishAccess(pDrawable);
}
void
-fb24_32GetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d)
+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);
+ 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);
+ srcStride *= sizeof(FbBits);
x += pDrawable->x;
y += pDrawable->y;
-
- pm = fbReplicatePixel (planeMask, 32);
+
+ 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);
+ memset(d, 0, dstStride * h);
+ fb24_32BltUp(src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
+ (CARD8 *) d, dstStride, 0, w, h, GXcopy, pm);
- fbFinishAccess (pDrawable);
+ 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)
+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);
+ 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);
+ srcStride *= sizeof(FbBits);
+ fbGetDrawable(pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
dst = (CARD8 *) dstBits;
- dstStride *= sizeof (FbBits);
+ dstStride *= sizeof(FbBits);
if (srcBpp == 24)
- blt = fb24_32BltUp;
+ 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++;
+ 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);
+ 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;
+ 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);
+ 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);
+ return 0;
+ fbGetDrawable(&pOldTile->drawable,
+ old, oldStride, oldBpp, oldXoff, oldYoff);
+ fbGetDrawable(&pNewTile->drawable,
+ new, newStride, newBpp, newXoff, newYoff);
if (oldBpp == 24)
- blt = fb24_32BltUp;
+ blt = fb24_32BltUp;
else
- blt = fb24_32BltDown;
+ blt = fb24_32BltDown;
(*blt) ((CARD8 *) old,
- oldStride * sizeof (FbBits),
- 0,
-
- (CARD8 *) new,
- newStride * sizeof (FbBits),
- 0,
+ oldStride * sizeof(FbBits),
+ 0,
+ (CARD8 *) new,
+ newStride * sizeof(FbBits),
+ 0,
+ pOldTile->drawable.width,
+ pOldTile->drawable.height, GXcopy, FB_ALLONES);
- pOldTile->drawable.width,
- pOldTile->drawable.height,
-
- GXcopy,
- FB_ALLONES);
-
- fbFinishAccess (&pOldTile->drawable);
- fbFinishAccess (&pNewTile->drawable);
+ fbFinishAccess(&pOldTile->drawable);
+ fbFinishAccess(&pNewTile->drawable);
return pNewTile;
}
typedef struct {
- pointer pbits;
- int width;
+ pointer pbits;
+ int width;
} miScreenInitParmsRec, *miScreenInitParmsPtr;
Bool
@@ -591,45 +507,42 @@ fb24_32CreateScreenResources(ScreenPtr pScreen)
Bool retval;
/* get the pitch before mi destroys it */
- pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
+ 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;
+ 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)
+fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
{
- int bpp, w;
+ int bpp, w;
if (!pPixmap)
- return FALSE;
+ 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);
- }
+ 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);
-}
+ devKind, pPixData);
+}
diff --git a/fb/fb24_32.h b/fb/fb24_32.h
index 7c9819eba..1bec00b80 100644
--- a/fb/fb24_32.h
+++ b/fb/fb24_32.h
@@ -29,23 +29,16 @@
#define _FB24_32_H_
Bool
-fb24_32FinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp);
+
+fb24_32FinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize, int dpix, int dpiy, int width, int bpp);
Bool
-fb24_32ScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp);
+
+fb24_32ScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize, int dpix, int dpiy, int width, int bpp);
#endif
diff --git a/fb/fballpriv.c b/fb/fballpriv.c
index 321903628..c6504f915 100644
--- a/fb/fballpriv.c
+++ b/fb/fballpriv.c
@@ -28,28 +28,39 @@
static DevPrivateKeyRec fbScreenPrivateKeyRec;
DevPrivateKey
-fbGetScreenPrivateKey(void) { return &fbScreenPrivateKeyRec; }
+fbGetScreenPrivateKey(void)
+{
+ return &fbScreenPrivateKeyRec;
+}
static DevPrivateKeyRec fbGCPrivateKeyRec;
DevPrivateKey
-fbGetGCPrivateKey (void) { return &fbGCPrivateKeyRec; }
+fbGetGCPrivateKey(void)
+{
+ return &fbGCPrivateKeyRec;
+}
static DevPrivateKeyRec fbWinPrivateKeyRec;
DevPrivateKey
-fbGetWinPrivateKey (void) { return &fbWinPrivateKeyRec; }
+fbGetWinPrivateKey(void)
+{
+ return &fbWinPrivateKeyRec;
+}
Bool
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
if (pGCKey)
- *pGCKey = &fbGCPrivateKeyRec;
-
- if (!dixRegisterPrivateKey(&fbGCPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec)))
- return FALSE;
- if (!dixRegisterPrivateKey(&fbScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof (FbScreenPrivRec)))
- return FALSE;
+ *pGCKey = &fbGCPrivateKeyRec;
+
+ if (!dixRegisterPrivateKey
+ (&fbGCPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec)))
+ return FALSE;
+ if (!dixRegisterPrivateKey
+ (&fbScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof(FbScreenPrivRec)))
+ return FALSE;
if (!dixRegisterPrivateKey(&fbWinPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
return TRUE;
}
diff --git a/fb/fbarc.c b/fb/fbarc.c
index e54c80491..c1b7f7785 100644
--- a/fb/fbarc.c
+++ b/fb/fbarc.c
@@ -28,115 +28,112 @@
#include "mizerarc.h"
#include <limits.h>
-typedef void (*FbArc) (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
+typedef void (*FbArc) (FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ xArc * arc, int dx, int dy, FbBits and, FbBits xor);
void
-fbPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *parcs)
+fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
{
- FbArc arc;
-
- if (pGC->lineWidth == 0)
- {
- arc = 0;
- if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid)
- {
- switch (pDrawable->bitsPerPixel)
- {
- case 8: arc = fbArc8; break;
- case 16: arc = fbArc16; break;
- case 24: arc = fbArc24; break;
- case 32: arc = fbArc32; break;
- }
- }
- if (arc)
- {
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxRec box;
- int x2, y2;
- RegionPtr cclip;
+ FbArc arc;
+
+ if (pGC->lineWidth == 0) {
+ arc = 0;
+ if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid) {
+ switch (pDrawable->bitsPerPixel) {
+ case 8:
+ arc = fbArc8;
+ break;
+ case 16:
+ arc = fbArc16;
+ break;
+ case 24:
+ arc = fbArc24;
+ break;
+ case 32:
+ arc = fbArc32;
+ break;
+ }
+ }
+ if (arc) {
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ BoxRec box;
+ int x2, y2;
+ RegionPtr cclip;
+
#ifdef FB_ACCESS_WRAPPER
- int wrapped = 1;
+ int wrapped = 1;
#endif
-
- cclip = fbGetCompositeClip (pGC);
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- while (narcs--)
- {
- if (miCanZeroArc (parcs))
- {
- box.x1 = parcs->x + pDrawable->x;
- box.y1 = parcs->y + pDrawable->y;
- /*
- * Because box.x2 and box.y2 get truncated to 16 bits, and the
- * RECT_IN_REGION test treats the resulting number as a signed
- * integer, the RECT_IN_REGION test alone can go the wrong way.
- * This can result in a server crash because the rendering
- * routines in this file deal directly with cpu addresses
- * of pixels to be stored, and do not clip or otherwise check
- * that all such addresses are within their respective pixmaps.
- * So we only allow the RECT_IN_REGION test to be used for
- * values that can be expressed correctly in a signed short.
- */
- x2 = box.x1 + (int)parcs->width + 1;
- box.x2 = x2;
- y2 = box.y1 + (int)parcs->height + 1;
- box.y2 = y2;
- if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
- (RegionContainsRect(cclip, &box) == rgnIN) ) {
+
+ cclip = fbGetCompositeClip(pGC);
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ while (narcs--) {
+ if (miCanZeroArc(parcs)) {
+ box.x1 = parcs->x + pDrawable->x;
+ box.y1 = parcs->y + pDrawable->y;
+ /*
+ * Because box.x2 and box.y2 get truncated to 16 bits, and the
+ * RECT_IN_REGION test treats the resulting number as a signed
+ * integer, the RECT_IN_REGION test alone can go the wrong way.
+ * This can result in a server crash because the rendering
+ * routines in this file deal directly with cpu addresses
+ * of pixels to be stored, and do not clip or otherwise check
+ * that all such addresses are within their respective pixmaps.
+ * So we only allow the RECT_IN_REGION test to be used for
+ * values that can be expressed correctly in a signed short.
+ */
+ x2 = box.x1 + (int) parcs->width + 1;
+ box.x2 = x2;
+ y2 = box.y1 + (int) parcs->height + 1;
+ box.y2 = y2;
+ if ((x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
+ (RegionContainsRect(cclip, &box) == rgnIN)) {
#ifdef FB_ACCESS_WRAPPER
- if (!wrapped) {
- fbPrepareAccess (pDrawable);
- wrapped = 1;
- }
+ if (!wrapped) {
+ fbPrepareAccess(pDrawable);
+ wrapped = 1;
+ }
#endif
- (*arc) (dst, dstStride, dstBpp,
- parcs, pDrawable->x + dstXoff, pDrawable->y + dstYoff,
- pPriv->and, pPriv->xor);
- } else {
+ (*arc) (dst, dstStride, dstBpp,
+ parcs, pDrawable->x + dstXoff,
+ pDrawable->y + dstYoff, pPriv->and, pPriv->xor);
+ }
+ else {
#ifdef FB_ACCESS_WRAPPER
- if (wrapped) {
- fbFinishAccess (pDrawable);
- wrapped = 0;
- }
+ if (wrapped) {
+ fbFinishAccess(pDrawable);
+ wrapped = 0;
+ }
#endif
- miZeroPolyArc(pDrawable, pGC, 1, parcs);
- }
- }
- else {
+ miZeroPolyArc(pDrawable, pGC, 1, parcs);
+ }
+ }
+ else {
#ifdef FB_ACCESS_WRAPPER
- if (wrapped) {
- fbFinishAccess (pDrawable);
- wrapped = 0;
- }
+ if (wrapped) {
+ fbFinishAccess(pDrawable);
+ wrapped = 0;
+ }
#endif
- miPolyArc(pDrawable, pGC, 1, parcs);
- }
- parcs++;
- }
+ miPolyArc(pDrawable, pGC, 1, parcs);
+ }
+ parcs++;
+ }
#ifdef FB_ACCESS_WRAPPER
- if (wrapped) {
- fbFinishAccess (pDrawable);
- wrapped = 0;
- }
+ if (wrapped) {
+ fbFinishAccess(pDrawable);
+ wrapped = 0;
+ }
#endif
- }
- else
- miZeroPolyArc (pDrawable, pGC, narcs, parcs);
+ }
+ else
+ miZeroPolyArc(pDrawable, pGC, narcs, parcs);
}
else
- miPolyArc (pDrawable, pGC, narcs, parcs);
+ miPolyArc(pDrawable, pGC, narcs, parcs);
}
diff --git a/fb/fbbits.c b/fb/fbbits.c
index 850d1632e..ac44f3e67 100644
--- a/fb/fbbits.c
+++ b/fb/fbbits.c
@@ -139,7 +139,7 @@
#undef BITSMUL
#undef BITSUNIT
#undef BITS
-
+
#undef BRESSOLID
#undef BRESDASH
#undef DOTS
diff --git a/fb/fbbits.h b/fb/fbbits.h
index 2dec84b42..be32d8cf0 100644
--- a/fb/fbbits.h
+++ b/fb/fbbits.h
@@ -68,258 +68,217 @@
#ifdef BRESSOLID
void
-BRESSOLID (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+BRESSOLID(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- UNIT *bits;
- FbStride bitsStride;
- FbStride majorStep, minorStep;
- BITS xor = (BITS) pPriv->xor;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ UNIT *bits;
+ FbStride bitsStride;
+ FbStride majorStep, minorStep;
+ BITS xor = (BITS) pPriv->xor;
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ bits =
+ ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
if (signdy < 0)
- bitsStride = -bitsStride;
- if (axis == X_AXIS)
- {
- majorStep = signdx * MUL;
- minorStep = bitsStride;
+ bitsStride = -bitsStride;
+ if (axis == X_AXIS) {
+ majorStep = signdx * MUL;
+ minorStep = bitsStride;
}
- else
- {
- majorStep = bitsStride;
- minorStep = signdx * MUL;
+ else {
+ majorStep = bitsStride;
+ minorStep = signdx * MUL;
}
- while (len--)
- {
- STORE(bits,xor);
- bits += majorStep;
- e += e1;
- if (e >= 0)
- {
- bits += minorStep;
- e += e3;
- }
+ while (len--) {
+ STORE(bits, xor);
+ bits += majorStep;
+ e += e1;
+ if (e >= 0) {
+ bits += minorStep;
+ e += e3;
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
#endif
#ifdef BRESDASH
void
-BRESDASH (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+BRESDASH(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- UNIT *bits;
- FbStride bitsStride;
- FbStride majorStep, minorStep;
- BITS xorfg, xorbg;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ UNIT *bits;
+ FbStride bitsStride;
+ FbStride majorStep, minorStep;
+ BITS xorfg, xorbg;
+
FbDashDeclare;
- int dashlen;
- Bool even;
- Bool doOdd;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ int dashlen;
+ Bool even;
+ Bool doOdd;
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
doOdd = pGC->lineStyle == LineDoubleDash;
xorfg = (BITS) pPriv->xor;
xorbg = (BITS) pPriv->bgxor;
-
- FbDashInit (pGC, pPriv, dashOffset, dashlen, even);
-
- bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
+
+ FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
+
+ bits =
+ ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
if (signdy < 0)
- bitsStride = -bitsStride;
- if (axis == X_AXIS)
- {
- majorStep = signdx * MUL;
- minorStep = bitsStride;
+ bitsStride = -bitsStride;
+ if (axis == X_AXIS) {
+ majorStep = signdx * MUL;
+ minorStep = bitsStride;
}
- else
- {
- majorStep = bitsStride;
- minorStep = signdx * MUL;
+ else {
+ majorStep = bitsStride;
+ minorStep = signdx * MUL;
}
if (dashlen >= len)
- dashlen = len;
- if (doOdd)
- {
- if (!even)
- goto doubleOdd;
- for (;;)
- {
- len -= dashlen;
- while (dashlen--)
- {
- STORE(bits,xorfg);
- bits += majorStep;
- if ((e += e1) >= 0)
- {
- e += e3;
- bits += minorStep;
- }
- }
- if (!len)
- break;
-
- FbDashNextEven(dashlen);
-
- if (dashlen >= len)
- dashlen = len;
-doubleOdd:
- len -= dashlen;
- while (dashlen--)
- {
- STORE(bits,xorbg);
- bits += majorStep;
- if ((e += e1) >= 0)
- {
- e += e3;
- bits += minorStep;
- }
- }
- if (!len)
- break;
-
- FbDashNextOdd(dashlen);
-
- if (dashlen >= len)
- dashlen = len;
- }
+ dashlen = len;
+ if (doOdd) {
+ if (!even)
+ goto doubleOdd;
+ for (;;) {
+ len -= dashlen;
+ while (dashlen--) {
+ STORE(bits, xorfg);
+ bits += majorStep;
+ if ((e += e1) >= 0) {
+ e += e3;
+ bits += minorStep;
+ }
+ }
+ if (!len)
+ break;
+
+ FbDashNextEven(dashlen);
+
+ if (dashlen >= len)
+ dashlen = len;
+ doubleOdd:
+ len -= dashlen;
+ while (dashlen--) {
+ STORE(bits, xorbg);
+ bits += majorStep;
+ if ((e += e1) >= 0) {
+ e += e3;
+ bits += minorStep;
+ }
+ }
+ if (!len)
+ break;
+
+ FbDashNextOdd(dashlen);
+
+ if (dashlen >= len)
+ dashlen = len;
+ }
}
- else
- {
- if (!even)
- goto onOffOdd;
- for (;;)
- {
- len -= dashlen;
- while (dashlen--)
- {
- STORE(bits,xorfg);
- bits += majorStep;
- if ((e += e1) >= 0)
- {
- e += e3;
- bits += minorStep;
- }
- }
- if (!len)
- break;
-
- FbDashNextEven (dashlen);
-
- if (dashlen >= len)
- dashlen = len;
-onOffOdd:
- len -= dashlen;
- while (dashlen--)
- {
- bits += majorStep;
- if ((e += e1) >= 0)
- {
- e += e3;
- bits += minorStep;
- }
- }
- if (!len)
- break;
-
- FbDashNextOdd (dashlen);
-
- if (dashlen >= len)
- dashlen = len;
- }
+ else {
+ if (!even)
+ goto onOffOdd;
+ for (;;) {
+ len -= dashlen;
+ while (dashlen--) {
+ STORE(bits, xorfg);
+ bits += majorStep;
+ if ((e += e1) >= 0) {
+ e += e3;
+ bits += minorStep;
+ }
+ }
+ if (!len)
+ break;
+
+ FbDashNextEven(dashlen);
+
+ if (dashlen >= len)
+ dashlen = len;
+ onOffOdd:
+ len -= dashlen;
+ while (dashlen--) {
+ bits += majorStep;
+ if ((e += e1) >= 0) {
+ e += e3;
+ bits += minorStep;
+ }
+ }
+ if (!len)
+ break;
+
+ FbDashNextOdd(dashlen);
+
+ if (dashlen >= len)
+ dashlen = len;
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
#endif
#ifdef DOTS
void
-DOTS (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *ptsOrig,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor)
+DOTS(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * ptsOrig,
+ int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor)
{
- INT32 *pts = (INT32 *) ptsOrig;
- UNIT *bits = (UNIT *) dst;
- UNIT *point;
- BITS bxor = (BITS) xor;
- BITS band = (BITS) and;
- FbStride bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- INT32 ul, lr;
- INT32 pt;
-
- ul = coordToInt(pBox->x1 - xorg, pBox->y1 - yorg);
+ INT32 *pts = (INT32 *) ptsOrig;
+ UNIT *bits = (UNIT *) dst;
+ UNIT *point;
+ BITS bxor = (BITS) xor;
+ BITS band = (BITS) and;
+ FbStride bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ INT32 ul, lr;
+ INT32 pt;
+
+ ul = coordToInt(pBox->x1 - xorg, pBox->y1 - yorg);
lr = coordToInt(pBox->x2 - xorg - 1, pBox->y2 - yorg - 1);
bits += bitsStride * (yorg + yoff) + (xorg + xoff) * MUL;
-
- if (and == 0)
- {
- while (npt--)
- {
- pt = *pts++;
- if (!isClipped(pt,ul,lr))
- {
- point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
- STORE(point,bxor);
- }
- }
+
+ if (and == 0) {
+ while (npt--) {
+ pt = *pts++;
+ if (!isClipped(pt, ul, lr)) {
+ point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
+ STORE(point, bxor);
+ }
+ }
}
- else
- {
- while (npt--)
- {
- pt = *pts++;
- if (!isClipped(pt,ul,lr))
- {
- point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
- RROP(point,band,bxor);
- }
- }
+ else {
+ while (npt--) {
+ pt = *pts++;
+ if (!isClipped(pt, ul, lr)) {
+ point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
+ RROP(point, band, bxor);
+ }
+ }
}
}
#endif
@@ -330,28 +289,23 @@ DOTS (FbBits *dst,
#define ARCRROP(d) RROP(d,andBits,xorBits)
void
-ARC (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int drawX,
- int drawY,
- FbBits and,
- FbBits xor)
+ARC(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int drawX, int drawY, FbBits and, FbBits xor)
{
- UNIT *bits;
- FbStride bitsStride;
- miZeroArcRec info;
- Bool do360;
- int x;
- UNIT *yorgp, *yorgop;
- BITS andBits, xorBits;
- int yoffset, dyoffset;
- int y, a, b, d, mask;
- int k1, k3, dx, dy;
-
+ UNIT *bits;
+ FbStride bitsStride;
+ miZeroArcRec info;
+ Bool do360;
+ int x;
+ UNIT *yorgp, *yorgop;
+ BITS andBits, xorBits;
+ int yoffset, dyoffset;
+ int y, a, b, d, mask;
+ int k1, k3, dx, dy;
+
bits = (UNIT *) dst;
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
andBits = (BITS) and;
xorBits = (BITS) xor;
do360 = miZeroArcSetup(arc, &info, TRUE);
@@ -363,292 +317,271 @@ ARC (FbBits *dst,
yoffset = y ? bitsStride : 0;
dyoffset = 0;
mask = info.initialMask;
-
- if (!(arc->width & 1))
- {
- if (andBits == 0)
- {
- if (mask & 2)
- ARCCOPY(yorgp + info.xorgo);
- if (mask & 8)
- ARCCOPY(yorgop + info.xorgo);
- }
- else
- {
- if (mask & 2)
- ARCRROP(yorgp + info.xorgo);
- if (mask & 8)
- ARCRROP(yorgop + info.xorgo);
- }
+
+ if (!(arc->width & 1)) {
+ if (andBits == 0) {
+ if (mask & 2)
+ ARCCOPY(yorgp + info.xorgo);
+ if (mask & 8)
+ ARCCOPY(yorgop + info.xorgo);
+ }
+ else {
+ if (mask & 2)
+ ARCRROP(yorgp + info.xorgo);
+ if (mask & 8)
+ ARCRROP(yorgop + info.xorgo);
+ }
}
- if (!info.end.x || !info.end.y)
- {
- mask = info.end.mask;
- info.end = info.altend;
+ if (!info.end.x || !info.end.y) {
+ mask = info.end.mask;
+ info.end = info.altend;
}
- if (do360 && (arc->width == arc->height) && !(arc->width & 1))
- {
- int xoffset = bitsStride;
- UNIT *yorghb = yorgp + (info.h * bitsStride) + info.xorg;
- UNIT *yorgohb = yorghb - info.h * MUL;
-
- yorgp += info.xorg;
- yorgop += info.xorg;
- yorghb += info.h * MUL;
- while (1)
- {
- if (andBits == 0)
- {
- ARCCOPY(yorgp + yoffset + x * MUL);
- ARCCOPY(yorgp + yoffset - x * MUL);
- ARCCOPY(yorgop - yoffset - x * MUL);
- ARCCOPY(yorgop - yoffset + x * MUL);
- }
- else
- {
- ARCRROP(yorgp + yoffset + x * MUL);
- ARCRROP(yorgp + yoffset - x * MUL);
- ARCRROP(yorgop - yoffset - x * MUL);
- ARCRROP(yorgop - yoffset + x * MUL);
- }
- if (a < 0)
- break;
- if (andBits == 0)
- {
- ARCCOPY(yorghb - xoffset - y * MUL);
- ARCCOPY(yorgohb - xoffset + y * MUL);
- ARCCOPY(yorgohb + xoffset + y * MUL);
- ARCCOPY(yorghb + xoffset - y * MUL);
- }
- else
- {
- ARCRROP(yorghb - xoffset - y * MUL);
- ARCRROP(yorgohb - xoffset + y * MUL);
- ARCRROP(yorgohb + xoffset + y * MUL);
- ARCRROP(yorghb + xoffset - y * MUL);
- }
- xoffset += bitsStride;
- MIARCCIRCLESTEP(yoffset += bitsStride;);
- }
- yorgp -= info.xorg;
- yorgop -= info.xorg;
- x = info.w;
- yoffset = info.h * bitsStride;
+ if (do360 && (arc->width == arc->height) && !(arc->width & 1)) {
+ int xoffset = bitsStride;
+ UNIT *yorghb = yorgp + (info.h * bitsStride) + info.xorg;
+ UNIT *yorgohb = yorghb - info.h * MUL;
+
+ yorgp += info.xorg;
+ yorgop += info.xorg;
+ yorghb += info.h * MUL;
+ while (1) {
+ if (andBits == 0) {
+ ARCCOPY(yorgp + yoffset + x * MUL);
+ ARCCOPY(yorgp + yoffset - x * MUL);
+ ARCCOPY(yorgop - yoffset - x * MUL);
+ ARCCOPY(yorgop - yoffset + x * MUL);
+ }
+ else {
+ ARCRROP(yorgp + yoffset + x * MUL);
+ ARCRROP(yorgp + yoffset - x * MUL);
+ ARCRROP(yorgop - yoffset - x * MUL);
+ ARCRROP(yorgop - yoffset + x * MUL);
+ }
+ if (a < 0)
+ break;
+ if (andBits == 0) {
+ ARCCOPY(yorghb - xoffset - y * MUL);
+ ARCCOPY(yorgohb - xoffset + y * MUL);
+ ARCCOPY(yorgohb + xoffset + y * MUL);
+ ARCCOPY(yorghb + xoffset - y * MUL);
+ }
+ else {
+ ARCRROP(yorghb - xoffset - y * MUL);
+ ARCRROP(yorgohb - xoffset + y * MUL);
+ ARCRROP(yorgohb + xoffset + y * MUL);
+ ARCRROP(yorghb + xoffset - y * MUL);
+ }
+ xoffset += bitsStride;
+ MIARCCIRCLESTEP(yoffset += bitsStride;
+ );
+ }
+ yorgp -= info.xorg;
+ yorgop -= info.xorg;
+ x = info.w;
+ yoffset = info.h * bitsStride;
}
- else if (do360)
- {
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(dyoffset = bitsStride;);
- if (andBits == 0)
- {
- ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
- ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
- ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
- ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
- }
- else
- {
- ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
- ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
- ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
- ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
- }
- MIARCSTEP(yoffset += dyoffset;, yoffset += bitsStride;);
- }
+ else if (do360) {
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(dyoffset = bitsStride;
+ );
+ if (andBits == 0) {
+ ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
+ ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
+ ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
+ ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ else {
+ ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
+ ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
+ ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
+ ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ MIARCSTEP(yoffset += dyoffset;
+ , yoffset += bitsStride;
+ );
+ }
}
- else
- {
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(dyoffset = bitsStride;);
- if ((x == info.start.x) || (y == info.start.y))
- {
- mask = info.start.mask;
- info.start = info.altstart;
- }
- if (andBits == 0)
- {
- if (mask & 1)
- ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
- if (mask & 2)
- ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
- if (mask & 4)
- ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
- if (mask & 8)
- ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
- }
- else
- {
- if (mask & 1)
- ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
- if (mask & 2)
- ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
- if (mask & 4)
- ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
- if (mask & 8)
- ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
- }
- if ((x == info.end.x) || (y == info.end.y))
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- MIARCSTEP(yoffset += dyoffset;, yoffset += bitsStride;);
- }
+ else {
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(dyoffset = bitsStride;
+ );
+ if ((x == info.start.x) || (y == info.start.y)) {
+ mask = info.start.mask;
+ info.start = info.altstart;
+ }
+ if (andBits == 0) {
+ if (mask & 1)
+ ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
+ if (mask & 2)
+ ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
+ if (mask & 4)
+ ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
+ if (mask & 8)
+ ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ else {
+ if (mask & 1)
+ ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
+ if (mask & 2)
+ ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
+ if (mask & 4)
+ ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
+ if (mask & 8)
+ ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ if ((x == info.end.x) || (y == info.end.y)) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ MIARCSTEP(yoffset += dyoffset;
+ , yoffset += bitsStride;
+ );
+ }
}
if ((x == info.start.x) || (y == info.start.y))
- mask = info.start.mask;
- if (andBits == 0)
- {
- if (mask & 1)
- ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
- if (mask & 4)
- ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
- if (arc->height & 1)
- {
- if (mask & 2)
- ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
- if (mask & 8)
- ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
- }
+ mask = info.start.mask;
+ if (andBits == 0) {
+ if (mask & 1)
+ ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
+ if (mask & 4)
+ ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
+ if (arc->height & 1) {
+ if (mask & 2)
+ ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
+ if (mask & 8)
+ ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
+ }
}
- else
- {
- if (mask & 1)
- ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
- if (mask & 4)
- ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
- if (arc->height & 1)
- {
- if (mask & 2)
- ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
- if (mask & 8)
- ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
- }
+ else {
+ if (mask & 1)
+ ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
+ if (mask & 4)
+ ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
+ if (arc->height & 1) {
+ if (mask & 2)
+ ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
+ if (mask & 8)
+ ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
+ }
}
}
+
#undef ARCCOPY
#undef ARCRROP
#endif
#ifdef GLYPH
#if BITMAP_BIT_ORDER == LSBFirst
-# define WRITE_ADDR1(n) (n)
-# define WRITE_ADDR2(n) (n)
-# define WRITE_ADDR4(n) (n)
+#define WRITE_ADDR1(n) (n)
+#define WRITE_ADDR2(n) (n)
+#define WRITE_ADDR4(n) (n)
#else
-# define WRITE_ADDR1(n) ((n) ^ 3)
-# define WRITE_ADDR2(n) ((n) ^ 2)
-# define WRITE_ADDR4(n) ((n))
+#define WRITE_ADDR1(n) ((n) ^ 3)
+#define WRITE_ADDR2(n) ((n) ^ 2)
+#define WRITE_ADDR4(n) ((n))
#endif
#define WRITE1(d,n,fg) WRITE(d + WRITE_ADDR1(n), (BITS) (fg))
#ifdef BITS2
-# define WRITE2(d,n,fg) WRITE((BITS2 *) &((d)[WRITE_ADDR2(n)]), (BITS2) (fg))
+#define WRITE2(d,n,fg) WRITE((BITS2 *) &((d)[WRITE_ADDR2(n)]), (BITS2) (fg))
#else
-# define WRITE2(d,n,fg) (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg))
+#define WRITE2(d,n,fg) (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg))
#endif
#ifdef BITS4
-# define WRITE4(d,n,fg) WRITE((BITS4 *) &((d)[WRITE_ADDR4(n)]), (BITS4) (fg))
+#define WRITE4(d,n,fg) WRITE((BITS4 *) &((d)[WRITE_ADDR4(n)]), (BITS4) (fg))
#else
-# define WRITE4(d,n,fg) (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg))
+#define WRITE4(d,n,fg) (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg))
#endif
void
-GLYPH (FbBits *dstBits,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int x,
- int height)
+GLYPH(FbBits * dstBits,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int x, int height)
{
- int lshift;
- FbStip bits;
- BITS *dstLine;
- BITS *dst;
- int n;
- int shift;
+ int lshift;
+ FbStip bits;
+ BITS *dstLine;
+ BITS *dst;
+ int n;
+ int shift;
dstLine = (BITS *) dstBits;
dstLine += x & ~3;
- dstStride *= (sizeof (FbBits) / sizeof (BITS));
+ dstStride *= (sizeof(FbBits) / sizeof(BITS));
shift = x & 3;
lshift = 4 - shift;
- while (height--)
- {
- bits = *stipple++;
- dst = (BITS *) dstLine;
- n = lshift;
- while (bits)
- {
- switch (FbStipMoveLsb (FbLeftStipBits (bits, n), 4, n)) {
- case 0:
- break;
- case 1:
- WRITE1(dst,0,fg);
- break;
- case 2:
- WRITE1(dst,1,fg);
- break;
- case 3:
- WRITE2(dst,0,fg);
- break;
- case 4:
- WRITE1(dst,2,fg);
- break;
- case 5:
- WRITE1(dst,0,fg);
- WRITE1(dst,2,fg);
- break;
- case 6:
- WRITE1(dst,1,fg);
- WRITE1(dst,2,fg);
- break;
- case 7:
- WRITE2(dst,0,fg);
- WRITE1(dst,2,fg);
- break;
- case 8:
- WRITE1(dst,3,fg);
- break;
- case 9:
- WRITE1(dst,0,fg);
- WRITE1(dst,3,fg);
- break;
- case 10:
- WRITE1(dst,1,fg);
- WRITE1(dst,3,fg);
- break;
- case 11:
- WRITE2(dst,0,fg);
- WRITE1(dst,3,fg);
- break;
- case 12:
- WRITE2(dst,2,fg);
- break;
- case 13:
- WRITE1(dst,0,fg);
- WRITE2(dst,2,fg);
- break;
- case 14:
- WRITE1(dst,1,fg);
- WRITE2(dst,2,fg);
- break;
- case 15:
- WRITE4(dst,0,fg);
- break;
- }
- bits = FbStipLeft (bits, n);
- n = 4;
- dst += 4;
- }
- dstLine += dstStride;
+ while (height--) {
+ bits = *stipple++;
+ dst = (BITS *) dstLine;
+ n = lshift;
+ while (bits) {
+ switch (FbStipMoveLsb(FbLeftStipBits(bits, n), 4, n)) {
+ case 0:
+ break;
+ case 1:
+ WRITE1(dst, 0, fg);
+ break;
+ case 2:
+ WRITE1(dst, 1, fg);
+ break;
+ case 3:
+ WRITE2(dst, 0, fg);
+ break;
+ case 4:
+ WRITE1(dst, 2, fg);
+ break;
+ case 5:
+ WRITE1(dst, 0, fg);
+ WRITE1(dst, 2, fg);
+ break;
+ case 6:
+ WRITE1(dst, 1, fg);
+ WRITE1(dst, 2, fg);
+ break;
+ case 7:
+ WRITE2(dst, 0, fg);
+ WRITE1(dst, 2, fg);
+ break;
+ case 8:
+ WRITE1(dst, 3, fg);
+ break;
+ case 9:
+ WRITE1(dst, 0, fg);
+ WRITE1(dst, 3, fg);
+ break;
+ case 10:
+ WRITE1(dst, 1, fg);
+ WRITE1(dst, 3, fg);
+ break;
+ case 11:
+ WRITE2(dst, 0, fg);
+ WRITE1(dst, 3, fg);
+ break;
+ case 12:
+ WRITE2(dst, 2, fg);
+ break;
+ case 13:
+ WRITE1(dst, 0, fg);
+ WRITE2(dst, 2, fg);
+ break;
+ case 14:
+ WRITE1(dst, 1, fg);
+ WRITE2(dst, 2, fg);
+ break;
+ case 15:
+ WRITE4(dst, 0, fg);
+ break;
+ }
+ bits = FbStipLeft(bits, n);
+ n = 4;
+ dst += 4;
+ }
+ dstLine += dstStride;
}
}
+
#undef WRITE_ADDR1
#undef WRITE_ADDR2
#undef WRITE_ADDR4
@@ -660,305 +593,276 @@ GLYPH (FbBits *dstBits,
#ifdef POLYLINE
void
-POLYLINE (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig)
+POLYLINE(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig)
{
- INT32 *pts = (INT32 *) ptsOrig;
- int xoff = pDrawable->x;
- int yoff = pDrawable->y;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC));
-
- FbBits *dst;
- int dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- UNIT *bits, *bitsBase;
- FbStride bitsStride;
- BITS xor = fbGetGCPrivate(pGC)->xor;
- BITS and = fbGetGCPrivate(pGC)->and;
- int dashoffset = 0;
-
- INT32 ul, lr;
- INT32 pt1, pt2;
-
- int e, e1, e3, len;
- int stepmajor, stepminor;
- int octant;
+ INT32 *pts = (INT32 *) ptsOrig;
+ int xoff = pDrawable->x;
+ int yoff = pDrawable->y;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ BoxPtr pBox = RegionExtents(fbGetCompositeClip(pGC));
+
+ FbBits *dst;
+ int dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ UNIT *bits, *bitsBase;
+ FbStride bitsStride;
+ BITS xor = fbGetGCPrivate(pGC)->xor;
+ BITS and = fbGetGCPrivate(pGC)->and;
+ int dashoffset = 0;
+
+ INT32 ul, lr;
+ INT32 pt1, pt2;
+
+ int e, e1, e3, len;
+ int stepmajor, stepminor;
+ int octant;
if (mode == CoordModePrevious)
- fbFixCoordModePrevious (npt, ptsOrig);
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
- ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
+ fbFixCoordModePrevious(npt, ptsOrig);
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ bitsBase =
+ ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
+ ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
pt1 = *pts++;
npt--;
pt2 = *pts++;
npt--;
- for (;;)
- {
- if (isClipped (pt1, ul, lr) | isClipped (pt2, ul, lr))
- {
- fbSegment (pDrawable, pGC,
- intToX(pt1) + xoff, intToY(pt1) + yoff,
- intToX(pt2) + xoff, intToY(pt2) + yoff,
- npt == 0 && pGC->capStyle != CapNotLast,
- &dashoffset);
- if (!npt) {
- fbFinishAccess (pDrawable);
- return;
- }
- pt1 = pt2;
- pt2 = *pts++;
- npt--;
- }
- else
- {
- bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
- for (;;)
- {
- CalcLineDeltas (intToX(pt1), intToY(pt1),
- intToX(pt2), intToY(pt2),
- len, e1, stepmajor, stepminor, 1, bitsStride,
- octant);
- stepmajor *= MUL;
- if (len < e1)
- {
- e3 = len;
- len = e1;
- e1 = e3;
-
- e3 = stepminor;
- stepminor = stepmajor;
- stepmajor = e3;
- SetYMajorOctant(octant);
- }
- e = -len;
- e1 <<= 1;
- e3 = e << 1;
- FIXUP_ERROR (e, octant, bias);
- if (and == 0)
- {
- while (len--)
- {
- STORE(bits,xor);
- bits += stepmajor;
- e += e1;
- if (e >= 0)
- {
- bits += stepminor;
- e += e3;
- }
- }
- }
- else
- {
- while (len--)
- {
- RROP(bits,and,xor);
- bits += stepmajor;
- e += e1;
- if (e >= 0)
- {
- bits += stepminor;
- e += e3;
- }
- }
- }
- if (!npt)
- {
- if (pGC->capStyle != CapNotLast &&
- pt2 != *((INT32 *) ptsOrig))
- {
- RROP(bits,and,xor);
- }
- fbFinishAccess (pDrawable);
- return;
- }
- pt1 = pt2;
- pt2 = *pts++;
- --npt;
- if (isClipped (pt2, ul, lr))
- break;
- }
- }
+ for (;;) {
+ if (isClipped(pt1, ul, lr) | isClipped(pt2, ul, lr)) {
+ fbSegment(pDrawable, pGC,
+ intToX(pt1) + xoff, intToY(pt1) + yoff,
+ intToX(pt2) + xoff, intToY(pt2) + yoff,
+ npt == 0 && pGC->capStyle != CapNotLast, &dashoffset);
+ if (!npt) {
+ fbFinishAccess(pDrawable);
+ return;
+ }
+ pt1 = pt2;
+ pt2 = *pts++;
+ npt--;
+ }
+ else {
+ bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
+ for (;;) {
+ CalcLineDeltas(intToX(pt1), intToY(pt1),
+ intToX(pt2), intToY(pt2),
+ len, e1, stepmajor, stepminor, 1, bitsStride,
+ octant);
+ stepmajor *= MUL;
+ if (len < e1) {
+ e3 = len;
+ len = e1;
+ e1 = e3;
+
+ e3 = stepminor;
+ stepminor = stepmajor;
+ stepmajor = e3;
+ SetYMajorOctant(octant);
+ }
+ e = -len;
+ e1 <<= 1;
+ e3 = e << 1;
+ FIXUP_ERROR(e, octant, bias);
+ if (and == 0) {
+ while (len--) {
+ STORE(bits, xor);
+ bits += stepmajor;
+ e += e1;
+ if (e >= 0) {
+ bits += stepminor;
+ e += e3;
+ }
+ }
+ }
+ else {
+ while (len--) {
+ RROP(bits, and, xor);
+ bits += stepmajor;
+ e += e1;
+ if (e >= 0) {
+ bits += stepminor;
+ e += e3;
+ }
+ }
+ }
+ if (!npt) {
+ if (pGC->capStyle != CapNotLast &&
+ pt2 != *((INT32 *) ptsOrig)) {
+ RROP(bits, and, xor);
+ }
+ fbFinishAccess(pDrawable);
+ return;
+ }
+ pt1 = pt2;
+ pt2 = *pts++;
+ --npt;
+ if (isClipped(pt2, ul, lr))
+ break;
+ }
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
#endif
#ifdef POLYSEGMENT
void
-POLYSEGMENT (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg)
+POLYSEGMENT(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
{
- INT32 *pts = (INT32 *) pseg;
- int xoff = pDrawable->x;
- int yoff = pDrawable->y;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC));
-
- FbBits *dst;
- int dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- UNIT *bits, *bitsBase;
- FbStride bitsStride;
- FbBits xorBits = fbGetGCPrivate(pGC)->xor;
- FbBits andBits = fbGetGCPrivate(pGC)->and;
- BITS xor = xorBits;
- BITS and = andBits;
- int dashoffset = 0;
-
- INT32 ul, lr;
- INT32 pt1, pt2;
-
- int e, e1, e3, len;
- int stepmajor, stepminor;
- int octant;
- Bool capNotLast;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
- ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
+ INT32 *pts = (INT32 *) pseg;
+ int xoff = pDrawable->x;
+ int yoff = pDrawable->y;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ BoxPtr pBox = RegionExtents(fbGetCompositeClip(pGC));
+
+ FbBits *dst;
+ int dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ UNIT *bits, *bitsBase;
+ FbStride bitsStride;
+ FbBits xorBits = fbGetGCPrivate(pGC)->xor;
+ FbBits andBits = fbGetGCPrivate(pGC)->and;
+ BITS xor = xorBits;
+ BITS and = andBits;
+ int dashoffset = 0;
+
+ INT32 ul, lr;
+ INT32 pt1, pt2;
+
+ int e, e1, e3, len;
+ int stepmajor, stepminor;
+ int octant;
+ Bool capNotLast;
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ bitsBase =
+ ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
+ ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
capNotLast = pGC->capStyle == CapNotLast;
-
- while (nseg--)
- {
- pt1 = *pts++;
- pt2 = *pts++;
- if (isClipped (pt1, ul, lr) | isClipped (pt2, ul, lr))
- {
- fbSegment (pDrawable, pGC,
- intToX(pt1) + xoff, intToY(pt1) + yoff,
- intToX(pt2) + xoff, intToY(pt2) + yoff,
- !capNotLast, &dashoffset);
- }
- else
- {
- CalcLineDeltas (intToX(pt1), intToY(pt1),
- intToX(pt2), intToY(pt2),
- len, e1, stepmajor, stepminor, 1, bitsStride,
- octant);
- if (e1 == 0 && len > 3
+
+ while (nseg--) {
+ pt1 = *pts++;
+ pt2 = *pts++;
+ if (isClipped(pt1, ul, lr) | isClipped(pt2, ul, lr)) {
+ fbSegment(pDrawable, pGC,
+ intToX(pt1) + xoff, intToY(pt1) + yoff,
+ intToX(pt2) + xoff, intToY(pt2) + yoff,
+ !capNotLast, &dashoffset);
+ }
+ else {
+ CalcLineDeltas(intToX(pt1), intToY(pt1),
+ intToX(pt2), intToY(pt2),
+ len, e1, stepmajor, stepminor, 1, bitsStride,
+ octant);
+ if (e1 == 0 && len > 3
#if MUL != 1
- && FbCheck24Pix(and) && FbCheck24Pix(xor)
+ && FbCheck24Pix(and) && FbCheck24Pix(xor)
#endif
- )
- {
- int x1, x2;
- FbBits *dstLine;
- int dstX, width;
- FbBits startmask, endmask;
- int nmiddle;
-
- if (stepmajor < 0)
- {
- x1 = intToX(pt2);
- x2 = intToX(pt1) + 1;
- if (capNotLast)
- x1++;
- }
- else
- {
- x1 = intToX(pt1);
- x2 = intToX(pt2);
- if (!capNotLast)
- x2++;
- }
- dstX = (x1 + xoff + dstXoff) * (sizeof (UNIT) * 8 * MUL);
- width = (x2 - x1) * (sizeof (UNIT) * 8 * MUL);
-
- dstLine = dst + (intToY(pt1) + yoff + dstYoff) * dstStride;
- dstLine += dstX >> FB_SHIFT;
- dstX &= FB_MASK;
- FbMaskBits (dstX, width, startmask, nmiddle, endmask);
- if (startmask)
- {
- WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, startmask));
- dstLine++;
- }
- if (!andBits)
- while (nmiddle--)
- WRITE(dstLine++, xorBits);
- else
- while (nmiddle--)
- {
- WRITE(dstLine, FbDoRRop (READ(dstLine), andBits, xorBits));
- dstLine++;
- }
- if (endmask)
- WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, endmask));
- }
- else
- {
- stepmajor *= MUL;
- bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
- if (len < e1)
- {
- e3 = len;
- len = e1;
- e1 = e3;
-
- e3 = stepminor;
- stepminor = stepmajor;
- stepmajor = e3;
- SetYMajorOctant(octant);
- }
- e = -len;
- e1 <<= 1;
- e3 = e << 1;
- FIXUP_ERROR (e, octant, bias);
- if (!capNotLast)
- len++;
- if (and == 0)
- {
- while (len--)
- {
- STORE(bits,xor);
- bits += stepmajor;
- e += e1;
- if (e >= 0)
- {
- bits += stepminor;
- e += e3;
- }
- }
- }
- else
- {
- while (len--)
- {
- RROP(bits,and,xor);
- bits += stepmajor;
- e += e1;
- if (e >= 0)
- {
- bits += stepminor;
- e += e3;
- }
- }
- }
- }
- }
+ ) {
+ int x1, x2;
+ FbBits *dstLine;
+ int dstX, width;
+ FbBits startmask, endmask;
+ int nmiddle;
+
+ if (stepmajor < 0) {
+ x1 = intToX(pt2);
+ x2 = intToX(pt1) + 1;
+ if (capNotLast)
+ x1++;
+ }
+ else {
+ x1 = intToX(pt1);
+ x2 = intToX(pt2);
+ if (!capNotLast)
+ x2++;
+ }
+ dstX = (x1 + xoff + dstXoff) * (sizeof(UNIT) * 8 * MUL);
+ width = (x2 - x1) * (sizeof(UNIT) * 8 * MUL);
+
+ dstLine = dst + (intToY(pt1) + yoff + dstYoff) * dstStride;
+ dstLine += dstX >> FB_SHIFT;
+ dstX &= FB_MASK;
+ FbMaskBits(dstX, width, startmask, nmiddle, endmask);
+ if (startmask) {
+ WRITE(dstLine,
+ FbDoMaskRRop(READ(dstLine), andBits, xorBits,
+ startmask));
+ dstLine++;
+ }
+ if (!andBits)
+ while (nmiddle--)
+ WRITE(dstLine++, xorBits);
+ else
+ while (nmiddle--) {
+ WRITE(dstLine,
+ FbDoRRop(READ(dstLine), andBits, xorBits));
+ dstLine++;
+ }
+ if (endmask)
+ WRITE(dstLine,
+ FbDoMaskRRop(READ(dstLine), andBits, xorBits,
+ endmask));
+ }
+ else {
+ stepmajor *= MUL;
+ bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
+ if (len < e1) {
+ e3 = len;
+ len = e1;
+ e1 = e3;
+
+ e3 = stepminor;
+ stepminor = stepmajor;
+ stepmajor = e3;
+ SetYMajorOctant(octant);
+ }
+ e = -len;
+ e1 <<= 1;
+ e3 = e << 1;
+ FIXUP_ERROR(e, octant, bias);
+ if (!capNotLast)
+ len++;
+ if (and == 0) {
+ while (len--) {
+ STORE(bits, xor);
+ bits += stepmajor;
+ e += e1;
+ if (e >= 0) {
+ bits += stepminor;
+ e += e3;
+ }
+ }
+ }
+ else {
+ while (len--) {
+ RROP(bits, and, xor);
+ bits += stepmajor;
+ e += e1;
+ if (e >= 0) {
+ bits += stepminor;
+ e += e3;
+ }
+ }
+ }
+ }
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
#endif
diff --git a/fb/fbblt.c b/fb/fbblt.c
index 680940467..17bd6986b 100644
--- a/fb/fbblt.c
+++ b/fb/fbblt.c
@@ -40,47 +40,38 @@
}
void
-fbBlt (FbBits *srcLine,
- FbStride srcStride,
- int srcX,
-
- FbBits *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp,
-
- Bool reverse,
- Bool upsidedown)
+fbBlt(FbBits * srcLine,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dstLine,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown)
{
- FbBits *src, *dst;
- int leftShift, rightShift;
- FbBits startmask, endmask;
- FbBits bits, bits1;
- int n, nmiddle;
- Bool destInvarient;
- int startbyte, endbyte;
- int careful;
- FbDeclareMergeRop ();
-
- if (bpp == 24 && !FbCheck24Pix (pm))
- {
- fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX,
- width, height, alu, pm, reverse, upsidedown);
- return;
+ FbBits *src, *dst;
+ int leftShift, rightShift;
+ FbBits startmask, endmask;
+ FbBits bits, bits1;
+ int n, nmiddle;
+ Bool destInvarient;
+ int startbyte, endbyte;
+ int careful;
+
+ FbDeclareMergeRop();
+
+ if (bpp == 24 && !FbCheck24Pix(pm)) {
+ fbBlt24(srcLine, srcStride, srcX, dstLine, dstStride, dstX,
+ width, height, alu, pm, reverse, upsidedown);
+ return;
}
- careful = !((srcLine < dstLine && srcLine + width * (bpp>>3) > dstLine) ||
- (dstLine < srcLine && dstLine + width * (bpp>>3) > srcLine)) ||
- (bpp & 7);
+ careful = !((srcLine < dstLine && srcLine + width * (bpp >> 3) > dstLine) ||
+ (dstLine < srcLine && dstLine + width * (bpp >> 3) > srcLine))
+ || (bpp & 7);
if (alu == GXcopy && pm == FB_ALLONES && !careful &&
- !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
+ !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
int i;
CARD8 *src = (CARD8 *) srcLine;
CARD8 *dst = (CARD8 *) dstLine;
@@ -103,506 +94,423 @@ fbBlt (FbBits *srcLine,
FbInitializeMergeRop(alu, pm);
destInvarient = FbDestInvarientMergeRop();
- if (upsidedown)
- {
- srcLine += (height - 1) * (srcStride);
- dstLine += (height - 1) * (dstStride);
- srcStride = -srcStride;
- dstStride = -dstStride;
+ if (upsidedown) {
+ srcLine += (height - 1) * (srcStride);
+ dstLine += (height - 1) * (dstStride);
+ srcStride = -srcStride;
+ dstStride = -dstStride;
}
- FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte,
- nmiddle, endmask, endbyte);
- if (reverse)
- {
- srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1;
- dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1;
- srcX = (srcX + width - 1) & FB_MASK;
- dstX = (dstX + width - 1) & FB_MASK;
+ FbMaskBitsBytes(dstX, width, destInvarient, startmask, startbyte,
+ nmiddle, endmask, endbyte);
+ if (reverse) {
+ srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1;
+ dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1;
+ srcX = (srcX + width - 1) & FB_MASK;
+ dstX = (dstX + width - 1) & FB_MASK;
}
- else
- {
- srcLine += srcX >> FB_SHIFT;
- dstLine += dstX >> FB_SHIFT;
- srcX &= FB_MASK;
- dstX &= FB_MASK;
+ else {
+ srcLine += srcX >> FB_SHIFT;
+ dstLine += dstX >> FB_SHIFT;
+ srcX &= FB_MASK;
+ dstX &= FB_MASK;
}
- if (srcX == dstX)
- {
- while (height--)
- {
- src = srcLine;
- srcLine += srcStride;
- dst = dstLine;
- dstLine += dstStride;
- if (reverse)
- {
- if (endmask)
- {
- bits = READ(--src);
- --dst;
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src)));
- }
- else
- {
- while (n--)
- {
- bits = READ(--src);
- --dst;
- WRITE(dst, FbDoMergeRop (bits, READ(dst)));
- }
- }
- if (startmask)
- {
- bits = READ(--src);
- --dst;
- FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
- }
- }
- else
- {
- if (startmask)
- {
- bits = READ(src++);
- FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
+ if (srcX == dstX) {
+ while (height--) {
+ src = srcLine;
+ srcLine += srcStride;
+ dst = dstLine;
+ dstLine += dstStride;
+ if (reverse) {
+ if (endmask) {
+ bits = READ(--src);
+ --dst;
+ FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--)
+ WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src)));
+ }
+ else {
+ while (n--) {
+ bits = READ(--src);
+ --dst;
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ }
+ }
+ if (startmask) {
+ bits = READ(--src);
+ --dst;
+ FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
+ }
+ }
+ else {
+ if (startmask) {
+ bits = READ(src++);
+ FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
+ dst++;
+ }
+ n = nmiddle;
+ if (destInvarient) {
#if 0
- /*
- * This provides some speedup on screen->screen blts
- * over the PCI bus, usually about 10%. But fb
- * isn't usually used for this operation...
- */
- if (_ca2 + 1 == 0 && _cx2 == 0)
- {
- FbBits t1, t2, t3, t4;
- while (n >= 4)
- {
- t1 = *src++;
- t2 = *src++;
- t3 = *src++;
- t4 = *src++;
- *dst++ = t1;
- *dst++ = t2;
- *dst++ = t3;
- *dst++ = t4;
- n -= 4;
- }
- }
+ /*
+ * This provides some speedup on screen->screen blts
+ * over the PCI bus, usually about 10%. But fb
+ * isn't usually used for this operation...
+ */
+ if (_ca2 + 1 == 0 && _cx2 == 0) {
+ FbBits t1, t2, t3, t4;
+
+ while (n >= 4) {
+ t1 = *src++;
+ t2 = *src++;
+ t3 = *src++;
+ t4 = *src++;
+ *dst++ = t1;
+ *dst++ = t2;
+ *dst++ = t3;
+ *dst++ = t4;
+ n -= 4;
+ }
+ }
#endif
- while (n--)
- WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++)));
- }
- else
- {
- while (n--)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMergeRop (bits, READ(dst)));
- dst++;
- }
- }
- if (endmask)
- {
- bits = READ(src);
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- }
- }
+ while (n--)
+ WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++)));
+ }
+ else {
+ while (n--) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ dst++;
+ }
+ }
+ if (endmask) {
+ bits = READ(src);
+ FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
+ }
+ }
+ }
}
- else
- {
- if (srcX > dstX)
- {
- leftShift = srcX - dstX;
- rightShift = FB_UNIT - leftShift;
- }
- else
- {
- rightShift = dstX - srcX;
- leftShift = FB_UNIT - rightShift;
- }
- while (height--)
- {
- src = srcLine;
- srcLine += srcStride;
- dst = dstLine;
- dstLine += dstStride;
-
- bits1 = 0;
- if (reverse)
- {
- if (srcX < dstX)
- bits1 = READ(--src);
- if (endmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(endmask, leftShift))
- {
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits = FbScrRight(bits1, rightShift);
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- --dst;
- WRITE(dst, FbDoDestInvarientMergeRop(bits));
- }
- }
- else
- {
- while (n--)
- {
- bits = FbScrRight(bits1, rightShift);
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- --dst;
- WRITE(dst, FbDoMergeRop(bits, READ(dst)));
- }
- }
- if (startmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(startmask, leftShift))
- {
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
- }
- }
- else
- {
- if (srcX > dstX)
- bits1 = READ(src++);
- if (startmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- if (FbScrLeft(startmask, rightShift))
- {
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- }
- FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- WRITE(dst, FbDoDestInvarientMergeRop(bits));
- dst++;
- }
- }
- else
- {
- while (n--)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- WRITE(dst, FbDoMergeRop(bits, READ(dst)));
- dst++;
- }
- }
- if (endmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- if (FbScrLeft(endmask, rightShift))
- {
- bits1 = READ(src);
- bits |= FbScrRight(bits1, rightShift);
- }
- FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask);
- }
- }
- }
+ else {
+ if (srcX > dstX) {
+ leftShift = srcX - dstX;
+ rightShift = FB_UNIT - leftShift;
+ }
+ else {
+ rightShift = dstX - srcX;
+ leftShift = FB_UNIT - rightShift;
+ }
+ while (height--) {
+ src = srcLine;
+ srcLine += srcStride;
+ dst = dstLine;
+ dstLine += dstStride;
+
+ bits1 = 0;
+ if (reverse) {
+ if (srcX < dstX)
+ bits1 = READ(--src);
+ if (endmask) {
+ bits = FbScrRight(bits1, rightShift);
+ if (FbScrRight(endmask, leftShift)) {
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ }
+ --dst;
+ FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--) {
+ bits = FbScrRight(bits1, rightShift);
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ --dst;
+ WRITE(dst, FbDoDestInvarientMergeRop(bits));
+ }
+ }
+ else {
+ while (n--) {
+ bits = FbScrRight(bits1, rightShift);
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ --dst;
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ }
+ }
+ if (startmask) {
+ bits = FbScrRight(bits1, rightShift);
+ if (FbScrRight(startmask, leftShift)) {
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ }
+ --dst;
+ FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
+ }
+ }
+ else {
+ if (srcX > dstX)
+ bits1 = READ(src++);
+ if (startmask) {
+ bits = FbScrLeft(bits1, leftShift);
+ if (FbScrLeft(startmask, rightShift)) {
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ }
+ FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
+ dst++;
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--) {
+ bits = FbScrLeft(bits1, leftShift);
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ WRITE(dst, FbDoDestInvarientMergeRop(bits));
+ dst++;
+ }
+ }
+ else {
+ while (n--) {
+ bits = FbScrLeft(bits1, leftShift);
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ dst++;
+ }
+ }
+ if (endmask) {
+ bits = FbScrLeft(bits1, leftShift);
+ if (FbScrLeft(endmask, rightShift)) {
+ bits1 = READ(src);
+ bits |= FbScrRight(bits1, rightShift);
+ }
+ FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
+ }
+ }
+ }
}
}
-
#undef DEBUG_BLT24
#ifdef DEBUG_BLT24
static unsigned long
-getPixel (char *src, int x)
+getPixel(char *src, int x)
{
- unsigned long l;
+ unsigned long l;
l = 0;
- memcpy (&l, src + x * 3, 3);
+ memcpy(&l, src + x * 3, 3);
return l;
}
#endif
static void
-fbBlt24Line (FbBits *src,
- int srcX,
-
- FbBits *dst,
- int dstX,
-
- int width,
-
- int alu,
- FbBits pm,
-
- Bool reverse)
+fbBlt24Line(FbBits * src,
+ int srcX,
+ FbBits * dst, int dstX, int width, int alu, FbBits pm, Bool reverse)
{
#ifdef DEBUG_BLT24
- char *origDst = (char *) dst;
- FbBits *origLine = dst + ((dstX >> FB_SHIFT) - 1);
- int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3;
- int origX = dstX / 24;
+ char *origDst = (char *) dst;
+ FbBits *origLine = dst + ((dstX >> FB_SHIFT) - 1);
+ int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3;
+ int origX = dstX / 24;
#endif
-
- int leftShift, rightShift;
- FbBits startmask, endmask;
- int n;
-
- FbBits bits, bits1;
- FbBits mask;
-
- int rot;
- FbDeclareMergeRop ();
-
- FbInitializeMergeRop (alu, FB_ALLONES);
+
+ int leftShift, rightShift;
+ FbBits startmask, endmask;
+ int n;
+
+ FbBits bits, bits1;
+ FbBits mask;
+
+ int rot;
+
+ FbDeclareMergeRop();
+
+ FbInitializeMergeRop(alu, FB_ALLONES);
FbMaskBits(dstX, width, startmask, n, endmask);
#ifdef DEBUG_BLT24
- ErrorF ("dstX %d width %d reverse %d\n", dstX, width, reverse);
+ ErrorF("dstX %d width %d reverse %d\n", dstX, width, reverse);
#endif
- if (reverse)
- {
- src += ((srcX + width - 1) >> FB_SHIFT) + 1;
- dst += ((dstX + width - 1) >> FB_SHIFT) + 1;
- rot = FbFirst24Rot (((dstX + width - 8) & FB_MASK));
- rot = FbPrev24Rot(rot);
+ if (reverse) {
+ src += ((srcX + width - 1) >> FB_SHIFT) + 1;
+ dst += ((dstX + width - 1) >> FB_SHIFT) + 1;
+ rot = FbFirst24Rot(((dstX + width - 8) & FB_MASK));
+ rot = FbPrev24Rot(rot);
#ifdef DEBUG_BLT24
- ErrorF ("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK, rot);
+ ErrorF("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK,
+ rot);
#endif
- srcX = (srcX + width - 1) & FB_MASK;
- dstX = (dstX + width - 1) & FB_MASK;
+ srcX = (srcX + width - 1) & FB_MASK;
+ dstX = (dstX + width - 1) & FB_MASK;
}
- else
- {
- src += srcX >> FB_SHIFT;
- dst += dstX >> FB_SHIFT;
- srcX &= FB_MASK;
- dstX &= FB_MASK;
- rot = FbFirst24Rot (dstX);
+ else {
+ src += srcX >> FB_SHIFT;
+ dst += dstX >> FB_SHIFT;
+ srcX &= FB_MASK;
+ dstX &= FB_MASK;
+ rot = FbFirst24Rot(dstX);
#ifdef DEBUG_BLT24
- ErrorF ("dstX: %d rot: %d\n", dstX, rot);
+ ErrorF("dstX: %d rot: %d\n", dstX, rot);
#endif
}
- mask = FbRot24(pm,rot);
+ mask = FbRot24(pm, rot);
#ifdef DEBUG_BLT24
- ErrorF ("pm 0x%x mask 0x%x\n", pm, mask);
+ ErrorF("pm 0x%x mask 0x%x\n", pm, mask);
#endif
- if (srcX == dstX)
- {
- if (reverse)
- {
- if (endmask)
- {
- bits = READ(--src);
- --dst;
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
- mask = FbPrev24Pix (mask);
- }
- while (n--)
- {
- bits = READ(--src);
- --dst;
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask));
- mask = FbPrev24Pix (mask);
- }
- if (startmask)
- {
- bits = READ(--src);
- --dst;
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
- }
- }
- else
- {
- if (startmask)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
- dst++;
- mask = FbNext24Pix(mask);
- }
- while (n--)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask));
- dst++;
- mask = FbNext24Pix(mask);
- }
- if (endmask)
- {
- bits = READ(src);
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
- }
- }
+ if (srcX == dstX) {
+ if (reverse) {
+ if (endmask) {
+ bits = READ(--src);
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+ mask = FbPrev24Pix(mask);
+ }
+ while (n--) {
+ bits = READ(--src);
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+ mask = FbPrev24Pix(mask);
+ }
+ if (startmask) {
+ bits = READ(--src);
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+ }
+ }
+ else {
+ if (startmask) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+ dst++;
+ mask = FbNext24Pix(mask);
+ }
+ while (n--) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+ dst++;
+ mask = FbNext24Pix(mask);
+ }
+ if (endmask) {
+ bits = READ(src);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+ }
+ }
}
- else
- {
- if (srcX > dstX)
- {
- leftShift = srcX - dstX;
- rightShift = FB_UNIT - leftShift;
- }
- else
- {
- rightShift = dstX - srcX;
- leftShift = FB_UNIT - rightShift;
- }
-
- bits1 = 0;
- if (reverse)
- {
- if (srcX < dstX)
- bits1 = READ(--src);
- if (endmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(endmask, leftShift))
- {
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
- mask = FbPrev24Pix(mask);
- }
- while (n--)
- {
- bits = FbScrRight(bits1, rightShift);
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- --dst;
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
- mask = FbPrev24Pix(mask);
- }
- if (startmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(startmask, leftShift))
- {
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
- }
- }
- else
- {
- if (srcX > dstX)
- bits1 = READ(src++);
- if (startmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
- dst++;
- mask = FbNext24Pix(mask);
- }
- while (n--)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
- dst++;
- mask = FbNext24Pix(mask);
- }
- if (endmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- if (FbScrLeft(endmask, rightShift))
- {
- bits1 = READ(src);
- bits |= FbScrRight(bits1, rightShift);
- }
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
- }
- }
+ else {
+ if (srcX > dstX) {
+ leftShift = srcX - dstX;
+ rightShift = FB_UNIT - leftShift;
+ }
+ else {
+ rightShift = dstX - srcX;
+ leftShift = FB_UNIT - rightShift;
+ }
+
+ bits1 = 0;
+ if (reverse) {
+ if (srcX < dstX)
+ bits1 = READ(--src);
+ if (endmask) {
+ bits = FbScrRight(bits1, rightShift);
+ if (FbScrRight(endmask, leftShift)) {
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ }
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+ mask = FbPrev24Pix(mask);
+ }
+ while (n--) {
+ bits = FbScrRight(bits1, rightShift);
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+ mask = FbPrev24Pix(mask);
+ }
+ if (startmask) {
+ bits = FbScrRight(bits1, rightShift);
+ if (FbScrRight(startmask, leftShift)) {
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ }
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+ }
+ }
+ else {
+ if (srcX > dstX)
+ bits1 = READ(src++);
+ if (startmask) {
+ bits = FbScrLeft(bits1, leftShift);
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+ dst++;
+ mask = FbNext24Pix(mask);
+ }
+ while (n--) {
+ bits = FbScrLeft(bits1, leftShift);
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+ dst++;
+ mask = FbNext24Pix(mask);
+ }
+ if (endmask) {
+ bits = FbScrLeft(bits1, leftShift);
+ if (FbScrLeft(endmask, rightShift)) {
+ bits1 = READ(src);
+ bits |= FbScrRight(bits1, rightShift);
+ }
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+ }
+ }
}
#ifdef DEBUG_BLT24
{
- int firstx, lastx, x;
-
- firstx = origX;
- if (firstx)
- firstx--;
- lastx = origX + width/24 + 1;
- for (x = firstx; x <= lastx; x++)
- ErrorF ("%06x ", getPixel (origDst, x));
- ErrorF ("\n");
- while (origNlw--)
- ErrorF ("%08x ", *origLine++);
- ErrorF ("\n");
+ int firstx, lastx, x;
+
+ firstx = origX;
+ if (firstx)
+ firstx--;
+ lastx = origX + width / 24 + 1;
+ for (x = firstx; x <= lastx; x++)
+ ErrorF("%06x ", getPixel(origDst, x));
+ ErrorF("\n");
+ while (origNlw--)
+ ErrorF("%08x ", *origLine++);
+ ErrorF("\n");
}
#endif
}
void
-fbBlt24 (FbBits *srcLine,
- FbStride srcStride,
- int srcX,
-
- FbBits *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
-
- Bool reverse,
- Bool upsidedown)
+fbBlt24(FbBits * srcLine,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dstLine,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height, int alu, FbBits pm, Bool reverse, Bool upsidedown)
{
- if (upsidedown)
- {
- srcLine += (height-1) * srcStride;
- dstLine += (height-1) * dstStride;
- srcStride = -srcStride;
- dstStride = -dstStride;
+ if (upsidedown) {
+ srcLine += (height - 1) * srcStride;
+ dstLine += (height - 1) * dstStride;
+ srcStride = -srcStride;
+ dstStride = -dstStride;
}
- while (height--)
- {
- fbBlt24Line (srcLine, srcX, dstLine, dstX, width, alu, pm, reverse);
- srcLine += srcStride;
- dstLine += dstStride;
+ while (height--) {
+ fbBlt24Line(srcLine, srcX, dstLine, dstX, width, alu, pm, reverse);
+ srcLine += srcStride;
+ dstLine += dstStride;
}
#ifdef DEBUG_BLT24
- ErrorF ("\n");
+ ErrorF("\n");
#endif
}
@@ -614,49 +522,42 @@ fbBlt24 (FbBits *srcLine,
*/
void
-fbBltOdd (FbBits *srcLine,
- FbStride srcStrideEven,
- FbStride srcStrideOdd,
- int srcXEven,
- int srcXOdd,
-
- FbBits *dstLine,
- FbStride dstStrideEven,
- FbStride dstStrideOdd,
- int dstXEven,
- int dstXOdd,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp)
+fbBltOdd(FbBits * srcLine,
+ FbStride srcStrideEven,
+ FbStride srcStrideOdd,
+ int srcXEven,
+ int srcXOdd,
+ FbBits * dstLine,
+ FbStride dstStrideEven,
+ FbStride dstStrideOdd,
+ int dstXEven,
+ int dstXOdd, int width, int height, int alu, FbBits pm, int bpp)
{
- FbBits *src;
- int leftShiftEven, rightShiftEven;
- FbBits startmaskEven, endmaskEven;
- int nmiddleEven;
-
- FbBits *dst;
- int leftShiftOdd, rightShiftOdd;
- FbBits startmaskOdd, endmaskOdd;
- int nmiddleOdd;
-
- int leftShift, rightShift;
- FbBits startmask, endmask;
- int nmiddle;
-
- int srcX, dstX;
-
- FbBits bits, bits1;
- int n;
-
- Bool destInvarient;
- Bool even;
- FbDeclareMergeRop ();
-
- FbInitializeMergeRop (alu, pm);
+ FbBits *src;
+ int leftShiftEven, rightShiftEven;
+ FbBits startmaskEven, endmaskEven;
+ int nmiddleEven;
+
+ FbBits *dst;
+ int leftShiftOdd, rightShiftOdd;
+ FbBits startmaskOdd, endmaskOdd;
+ int nmiddleOdd;
+
+ int leftShift, rightShift;
+ FbBits startmask, endmask;
+ int nmiddle;
+
+ int srcX, dstX;
+
+ FbBits bits, bits1;
+ int n;
+
+ Bool destInvarient;
+ Bool even;
+
+ FbDeclareMergeRop();
+
+ FbInitializeMergeRop(alu, pm);
destInvarient = FbDestInvarientMergeRop();
srcLine += srcXEven >> FB_SHIFT;
@@ -668,162 +569,133 @@ fbBltOdd (FbBits *srcLine,
FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven);
FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd);
-
+
even = TRUE;
InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven);
InitializeShifts(srcXOdd, dstXOdd, leftShiftOdd, rightShiftOdd);
- while (height--)
- {
- src = srcLine;
- dst = dstLine;
- if (even)
- {
- srcX = srcXEven;
- dstX = dstXEven;
- startmask = startmaskEven;
- endmask = endmaskEven;
- nmiddle = nmiddleEven;
- leftShift = leftShiftEven;
- rightShift = rightShiftEven;
- srcLine += srcStrideEven;
- dstLine += dstStrideEven;
- even = FALSE;
- }
- else
- {
- srcX = srcXOdd;
- dstX = dstXOdd;
- startmask = startmaskOdd;
- endmask = endmaskOdd;
- nmiddle = nmiddleOdd;
- leftShift = leftShiftOdd;
- rightShift = rightShiftOdd;
- srcLine += srcStrideOdd;
- dstLine += dstStrideOdd;
- even = TRUE;
- }
- if (srcX == dstX)
- {
- if (startmask)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), startmask));
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits = READ(src++);
- WRITE(dst, FbDoDestInvarientMergeRop(bits));
- dst++;
- }
- }
- else
- {
- while (n--)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMergeRop (bits, READ(dst)));
- dst++;
- }
- }
- if (endmask)
- {
- bits = READ(src);
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask));
- }
- }
- else
- {
- bits = 0;
- if (srcX > dstX)
- bits = READ(src++);
- if (startmask)
- {
- bits1 = FbScrLeft(bits, leftShift);
- bits = READ(src++);
- bits1 |= FbScrRight(bits, rightShift);
- WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), startmask));
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits1 = FbScrLeft(bits, leftShift);
- bits = READ(src++);
- bits1 |= FbScrRight(bits, rightShift);
- WRITE(dst, FbDoDestInvarientMergeRop(bits1));
- dst++;
- }
- }
- else
- {
- while (n--)
- {
- bits1 = FbScrLeft(bits, leftShift);
- bits = READ(src++);
- bits1 |= FbScrRight(bits, rightShift);
- WRITE(dst, FbDoMergeRop(bits1, READ(dst)));
- dst++;
- }
- }
- if (endmask)
- {
- bits1 = FbScrLeft(bits, leftShift);
- if (FbScrLeft(endmask, rightShift))
- {
- bits = READ(src);
- bits1 |= FbScrRight(bits, rightShift);
- }
- WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), endmask));
- }
- }
+ while (height--) {
+ src = srcLine;
+ dst = dstLine;
+ if (even) {
+ srcX = srcXEven;
+ dstX = dstXEven;
+ startmask = startmaskEven;
+ endmask = endmaskEven;
+ nmiddle = nmiddleEven;
+ leftShift = leftShiftEven;
+ rightShift = rightShiftEven;
+ srcLine += srcStrideEven;
+ dstLine += dstStrideEven;
+ even = FALSE;
+ }
+ else {
+ srcX = srcXOdd;
+ dstX = dstXOdd;
+ startmask = startmaskOdd;
+ endmask = endmaskOdd;
+ nmiddle = nmiddleOdd;
+ leftShift = leftShiftOdd;
+ rightShift = rightShiftOdd;
+ srcLine += srcStrideOdd;
+ dstLine += dstStrideOdd;
+ even = TRUE;
+ }
+ if (srcX == dstX) {
+ if (startmask) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), startmask));
+ dst++;
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--) {
+ bits = READ(src++);
+ WRITE(dst, FbDoDestInvarientMergeRop(bits));
+ dst++;
+ }
+ }
+ else {
+ while (n--) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ dst++;
+ }
+ }
+ if (endmask) {
+ bits = READ(src);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask));
+ }
+ }
+ else {
+ bits = 0;
+ if (srcX > dstX)
+ bits = READ(src++);
+ if (startmask) {
+ bits1 = FbScrLeft(bits, leftShift);
+ bits = READ(src++);
+ bits1 |= FbScrRight(bits, rightShift);
+ WRITE(dst, FbDoMaskMergeRop(bits1, READ(dst), startmask));
+ dst++;
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--) {
+ bits1 = FbScrLeft(bits, leftShift);
+ bits = READ(src++);
+ bits1 |= FbScrRight(bits, rightShift);
+ WRITE(dst, FbDoDestInvarientMergeRop(bits1));
+ dst++;
+ }
+ }
+ else {
+ while (n--) {
+ bits1 = FbScrLeft(bits, leftShift);
+ bits = READ(src++);
+ bits1 |= FbScrRight(bits, rightShift);
+ WRITE(dst, FbDoMergeRop(bits1, READ(dst)));
+ dst++;
+ }
+ }
+ if (endmask) {
+ bits1 = FbScrLeft(bits, leftShift);
+ if (FbScrLeft(endmask, rightShift)) {
+ bits = READ(src);
+ bits1 |= FbScrRight(bits, rightShift);
+ }
+ WRITE(dst, FbDoMaskMergeRop(bits1, READ(dst), endmask));
+ }
+ }
}
}
void
-fbBltOdd24 (FbBits *srcLine,
- FbStride srcStrideEven,
- FbStride srcStrideOdd,
- int srcXEven,
- int srcXOdd,
-
- FbBits *dstLine,
- FbStride dstStrideEven,
- FbStride dstStrideOdd,
- int dstXEven,
- int dstXOdd,
-
- int width,
- int height,
-
- int alu,
- FbBits pm)
+fbBltOdd24(FbBits * srcLine,
+ FbStride srcStrideEven,
+ FbStride srcStrideOdd,
+ int srcXEven,
+ int srcXOdd,
+ FbBits * dstLine,
+ FbStride dstStrideEven,
+ FbStride dstStrideOdd,
+ int dstXEven, int dstXOdd, int width, int height, int alu, FbBits pm)
{
- Bool even = TRUE;
-
- while (height--)
- {
- if (even)
- {
- fbBlt24Line (srcLine, srcXEven, dstLine, dstXEven,
- width, alu, pm, FALSE);
- srcLine += srcStrideEven;
- dstLine += dstStrideEven;
- even = FALSE;
- }
- else
- {
- fbBlt24Line (srcLine, srcXOdd, dstLine, dstXOdd,
- width, alu, pm, FALSE);
- srcLine += srcStrideOdd;
- dstLine += dstStrideOdd;
- even = TRUE;
- }
+ Bool even = TRUE;
+
+ while (height--) {
+ if (even) {
+ fbBlt24Line(srcLine, srcXEven, dstLine, dstXEven,
+ width, alu, pm, FALSE);
+ srcLine += srcStrideEven;
+ dstLine += dstStrideEven;
+ even = FALSE;
+ }
+ else {
+ fbBlt24Line(srcLine, srcXOdd, dstLine, dstXOdd,
+ width, alu, pm, FALSE);
+ srcLine += srcStrideOdd;
+ dstLine += dstStrideOdd;
+ even = TRUE;
+ }
}
}
@@ -831,17 +703,15 @@ fbBltOdd24 (FbBits *srcLine,
#if FB_STIP_SHIFT != FB_SHIFT
void
-fbSetBltOdd (FbStip *stip,
- FbStride stipStride,
- int srcX,
- FbBits **bits,
- FbStride *strideEven,
- FbStride *strideOdd,
- int *srcXEven,
- int *srcXOdd)
+fbSetBltOdd(FbStip * stip,
+ FbStride stipStride,
+ int srcX,
+ FbBits ** bits,
+ FbStride * strideEven,
+ FbStride * strideOdd, int *srcXEven, int *srcXOdd)
{
- int srcAdjust;
- int strideAdjust;
+ int srcAdjust;
+ int strideAdjust;
/*
* bytes needed to align source
@@ -853,96 +723,68 @@ fbSetBltOdd (FbStip *stip,
strideAdjust = stipStride & (FB_MASK >> FB_STIP_SHIFT);
*bits = (FbBits *) ((char *) stip - srcAdjust);
- if (srcAdjust)
- {
- *strideEven = FbStipStrideToBitsStride (stipStride + 1);
- *strideOdd = FbStipStrideToBitsStride (stipStride);
+ if (srcAdjust) {
+ *strideEven = FbStipStrideToBitsStride(stipStride + 1);
+ *strideOdd = FbStipStrideToBitsStride(stipStride);
- *srcXEven = srcX + (srcAdjust << 3);
- *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT);
+ *srcXEven = srcX + (srcAdjust << 3);
+ *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT);
}
- else
- {
- *strideEven = FbStipStrideToBitsStride (stipStride);
- *strideOdd = FbStipStrideToBitsStride (stipStride + 1);
-
- *srcXEven = srcX;
- *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT);
+ else {
+ *strideEven = FbStipStrideToBitsStride(stipStride);
+ *strideOdd = FbStipStrideToBitsStride(stipStride + 1);
+
+ *srcXEven = srcX;
+ *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT);
}
}
#endif
void
-fbBltStip (FbStip *src,
- FbStride srcStride, /* in FbStip units, not FbBits units */
- int srcX,
-
- FbStip *dst,
- FbStride dstStride, /* in FbStip units, not FbBits units */
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp)
+fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */
+ int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */
+ int dstX, int width, int height, int alu, FbBits pm, int bpp)
{
#if FB_STIP_SHIFT != FB_SHIFT
if (FB_STIP_ODDSTRIDE(srcStride) || FB_STIP_ODDPTR(src) ||
- FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst))
- {
- FbStride srcStrideEven, srcStrideOdd;
- FbStride dstStrideEven, dstStrideOdd;
- int srcXEven, srcXOdd;
- int dstXEven, dstXOdd;
- FbBits *s, *d;
- int sx, dx;
-
- src += srcX >> FB_STIP_SHIFT;
- srcX &= FB_STIP_MASK;
- dst += dstX >> FB_STIP_SHIFT;
- dstX &= FB_STIP_MASK;
-
- fbSetBltOdd (src, srcStride, srcX,
- &s,
- &srcStrideEven, &srcStrideOdd,
- &srcXEven, &srcXOdd);
-
- fbSetBltOdd (dst, dstStride, dstX,
- &d,
- &dstStrideEven, &dstStrideOdd,
- &dstXEven, &dstXOdd);
-
- if (bpp == 24 && !FbCheck24Pix (pm))
- {
- fbBltOdd24 (s, srcStrideEven, srcStrideOdd,
- srcXEven, srcXOdd,
-
- d, dstStrideEven, dstStrideOdd,
- dstXEven, dstXOdd,
-
- width, height, alu, pm);
- }
- else
- {
- fbBltOdd (s, srcStrideEven, srcStrideOdd,
- srcXEven, srcXOdd,
-
- d, dstStrideEven, dstStrideOdd,
- dstXEven, dstXOdd,
-
- width, height, alu, pm, bpp);
- }
+ FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) {
+ FbStride srcStrideEven, srcStrideOdd;
+ FbStride dstStrideEven, dstStrideOdd;
+ int srcXEven, srcXOdd;
+ int dstXEven, dstXOdd;
+ FbBits *s, *d;
+ int sx, dx;
+
+ src += srcX >> FB_STIP_SHIFT;
+ srcX &= FB_STIP_MASK;
+ dst += dstX >> FB_STIP_SHIFT;
+ dstX &= FB_STIP_MASK;
+
+ fbSetBltOdd(src, srcStride, srcX,
+ &s, &srcStrideEven, &srcStrideOdd, &srcXEven, &srcXOdd);
+
+ fbSetBltOdd(dst, dstStride, dstX,
+ &d, &dstStrideEven, &dstStrideOdd, &dstXEven, &dstXOdd);
+
+ if (bpp == 24 && !FbCheck24Pix(pm)) {
+ fbBltOdd24(s, srcStrideEven, srcStrideOdd,
+ srcXEven, srcXOdd,
+ d, dstStrideEven, dstStrideOdd,
+ dstXEven, dstXOdd, width, height, alu, pm);
+ }
+ else {
+ fbBltOdd(s, srcStrideEven, srcStrideOdd,
+ srcXEven, srcXOdd,
+ d, dstStrideEven, dstStrideOdd,
+ dstXEven, dstXOdd, width, height, alu, pm, bpp);
+ }
}
else
#endif
{
- fbBlt ((FbBits *) src, FbStipStrideToBitsStride (srcStride),
- srcX,
- (FbBits *) dst, FbStipStrideToBitsStride (dstStride),
- dstX,
- width, height,
- alu, pm, bpp, FALSE, FALSE);
+ fbBlt((FbBits *) src, FbStipStrideToBitsStride(srcStride),
+ srcX,
+ (FbBits *) dst, FbStipStrideToBitsStride(dstStride),
+ dstX, width, height, alu, pm, bpp, FALSE, FALSE);
}
}
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index 67e7853c6..eb7cf9483 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -61,8 +61,7 @@
} else \
bits = (src < srcEnd ? READ(src++) : 0); \
}
-
-
+
#define LaneCases1(n,a) case n: FbLaneCase(n,a); break
#define LaneCases2(n,a) LaneCases1(n,a); LaneCases1(n+1,a)
#define LaneCases4(n,a) LaneCases2(n,a); LaneCases2(n+2,a)
@@ -72,111 +71,112 @@
#define LaneCases64(n,a) LaneCases32(n,a); LaneCases32(n+32,a)
#define LaneCases128(n,a) LaneCases64(n,a); LaneCases64(n+64,a)
#define LaneCases256(n,a) LaneCases128(n,a); LaneCases128(n+128,a)
-
+
#if FB_SHIFT == 6
#define LaneCases(a) LaneCases256(0,a)
#endif
-
+
#if FB_SHIFT == 5
#define LaneCases(a) LaneCases16(0,a)
#endif
-
+
#if FB_SHIFT == 6
-CARD8 fb8Lane[256] = {
-0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
-22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
-60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
-79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
-98, 99, 100, 101, 102,103,104,105,106,107,108,109,110,111,112,113,114,115,
-116, 117, 118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,
-134, 135, 136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,
-152, 153, 154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,
-170, 171, 172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,
-188, 189, 190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,
-206, 207, 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
-224, 225, 226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-242, 243, 244,245,246,247,248,249,250,251,252,253,254,255,
+CARD8 fb8Lane[256] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ 113, 114, 115,
+ 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+ 131, 132, 133,
+ 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
+ 149, 150, 151,
+ 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
+ 167, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
+ 185, 186, 187,
+ 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
+ 203, 204, 205,
+ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
+ 221, 222, 223,
+ 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238,
+ 239, 240, 241,
+ 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
};
-CARD8 fb16Lane[256] = {
+CARD8 fb16Lane[256] = {
0x00, 0x03, 0x0c, 0x0f,
0x30, 0x33, 0x3c, 0x3f,
0xc0, 0xc3, 0xcc, 0xcf,
0xf0, 0xf3, 0xfc, 0xff,
};
-CARD8 fb32Lane[16] = {
+CARD8 fb32Lane[16] = {
0x00, 0x0f, 0xf0, 0xff,
};
#endif
#if FB_SHIFT == 5
-CARD8 fb8Lane[16] = {
+CARD8 fb8Lane[16] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
-CARD8 fb16Lane[16] = {
- 0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+CARD8 fb16Lane[16] = {
+ 0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-CARD8 fb32Lane[16] = {
- 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+CARD8 fb32Lane[16] = {
+ 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#endif
-CARD8 *fbLaneTable[33] = {
+CARD8 *fbLaneTable[33] = {
0, 0, 0, 0, 0, 0, 0, 0,
- fb8Lane, 0, 0, 0, 0, 0, 0, 0,
+ fb8Lane, 0, 0, 0, 0, 0, 0, 0,
fb16Lane, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
fb32Lane
};
void
-fbBltOne (FbStip *src,
- FbStride srcStride, /* FbStip units per scanline */
- int srcX, /* bit position of source */
- FbBits *dst,
- FbStride dstStride, /* FbBits units per scanline */
- int dstX, /* bit position of dest */
- int dstBpp, /* bits per destination unit */
-
- int width, /* width in bits of destination */
- int height, /* height in scanlines */
-
- FbBits fgand, /* rrop values */
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor)
+fbBltOne(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
+ int srcX, /* bit position of source */
+ FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
+ int dstX, /* bit position of dest */
+ int dstBpp, /* bits per destination unit */
+ int width, /* width in bits of destination */
+ int height, /* height in scanlines */
+ FbBits fgand, /* rrop values */
+ FbBits fgxor, FbBits bgand, FbBits bgxor)
{
- const FbBits *fbBits;
- FbBits *srcEnd;
- int pixelsPerDst; /* dst pixels per FbBits */
- int unitsPerSrc; /* src patterns per FbStip */
- int leftShift, rightShift; /* align source with dest */
- FbBits startmask, endmask; /* dest scanline masks */
- FbStip bits=0, bitsLeft, bitsRight;/* source bits */
- FbStip left;
- FbBits mask;
- int nDst; /* dest longwords (w.o. end) */
- int w;
- int n, nmiddle;
- int dstS; /* stipple-relative dst X coordinate */
- Bool copy; /* accelerate dest-invariant */
- Bool transparent; /* accelerate 0 nop */
- int srcinc; /* source units consumed */
- Bool endNeedsLoad = FALSE; /* need load for endmask */
- CARD8 *fbLane;
- int startbyte, endbyte;
-
- if (dstBpp == 24)
- {
- fbBltOne24 (src, srcStride, srcX,
- dst, dstStride, dstX, dstBpp,
- width, height,
- fgand, fgxor, bgand, bgxor);
- return;
+ const FbBits *fbBits;
+ FbBits *srcEnd;
+ int pixelsPerDst; /* dst pixels per FbBits */
+ int unitsPerSrc; /* src patterns per FbStip */
+ int leftShift, rightShift; /* align source with dest */
+ FbBits startmask, endmask; /* dest scanline masks */
+ FbStip bits = 0, bitsLeft, bitsRight; /* source bits */
+ FbStip left;
+ FbBits mask;
+ int nDst; /* dest longwords (w.o. end) */
+ int w;
+ int n, nmiddle;
+ int dstS; /* stipple-relative dst X coordinate */
+ Bool copy; /* accelerate dest-invariant */
+ Bool transparent; /* accelerate 0 nop */
+ int srcinc; /* source units consumed */
+ Bool endNeedsLoad = FALSE; /* need load for endmask */
+ CARD8 *fbLane;
+ int startbyte, endbyte;
+
+ if (dstBpp == 24) {
+ fbBltOne24(src, srcStride, srcX,
+ dst, dstStride, dstX, dstBpp,
+ width, height, fgand, fgxor, bgand, bgxor);
+ return;
}
/*
@@ -194,13 +194,13 @@ fbBltOne (FbStip *src,
* Number of source stipple patterns in FbStip
*/
unitsPerSrc = FB_STIP_UNIT / pixelsPerDst;
-
+
copy = FALSE;
transparent = FALSE;
if (bgand == 0 && fgand == 0)
- copy = TRUE;
+ copy = TRUE;
else if (bgand == FB_ALLONES && bgxor == 0)
- transparent = TRUE;
+ transparent = TRUE;
/*
* Adjust source and dest to nearest FbBits boundary
@@ -210,8 +210,8 @@ fbBltOne (FbStip *src,
srcX &= FB_STIP_MASK;
dstX &= FB_MASK;
- FbMaskBitsBytes(dstX, width, copy,
- startmask, startbyte, nmiddle, endmask, endbyte);
+ FbMaskBitsBytes(dstX, width, copy,
+ startmask, startbyte, nmiddle, endmask, endbyte);
/*
* Compute effective dest alignment requirement for
@@ -221,196 +221,175 @@ fbBltOne (FbStip *src,
/*
* Compute shift constants for effective alignement
*/
- if (srcX >= dstS)
- {
- leftShift = srcX - dstS;
- rightShift = FB_STIP_UNIT - leftShift;
+ if (srcX >= dstS) {
+ leftShift = srcX - dstS;
+ rightShift = FB_STIP_UNIT - leftShift;
}
- else
- {
- rightShift = dstS - srcX;
- leftShift = FB_STIP_UNIT - rightShift;
+ else {
+ rightShift = dstS - srcX;
+ leftShift = FB_STIP_UNIT - rightShift;
}
/*
* Get pointer to stipple mask array for this depth
*/
- fbBits = 0; /* unused */
+ fbBits = 0; /* unused */
if (pixelsPerDst <= 8)
- fbBits = fbStippleTable[pixelsPerDst];
+ fbBits = fbStippleTable[pixelsPerDst];
fbLane = 0;
if (transparent && fgand == 0 && dstBpp >= 8)
- fbLane = fbLaneTable[dstBpp];
-
+ fbLane = fbLaneTable[dstBpp];
+
/*
* Compute total number of destination words written, but
* don't count endmask
*/
nDst = nmiddle;
if (startmask)
- nDst++;
-
+ nDst++;
+
dstStride -= nDst;
/*
* Compute total number of source words consumed
*/
-
+
srcinc = (nDst + unitsPerSrc - 1) / unitsPerSrc;
-
+
if (srcX > dstS)
- srcinc++;
- if (endmask)
- {
- endNeedsLoad = nDst % unitsPerSrc == 0;
- if (endNeedsLoad)
- srcinc++;
+ srcinc++;
+ if (endmask) {
+ endNeedsLoad = nDst % unitsPerSrc == 0;
+ if (endNeedsLoad)
+ srcinc++;
}
srcStride -= srcinc;
-
+
/*
* Copy rectangle
*/
- while (height--)
- {
- w = nDst; /* total units across scanline */
- n = unitsPerSrc; /* units avail in single stipple */
- if (n > w)
- n = w;
-
- bitsLeft = 0;
- if (srcX > dstS)
- bitsLeft = READ(src++);
- if (n)
- {
- /*
- * Load first set of stipple bits
- */
- LoadBits;
-
- /*
- * Consume stipple bits for startmask
- */
- if (startmask)
- {
+ while (height--) {
+ w = nDst; /* total units across scanline */
+ n = unitsPerSrc; /* units avail in single stipple */
+ if (n > w)
+ n = w;
+
+ bitsLeft = 0;
+ if (srcX > dstS)
+ bitsLeft = READ(src++);
+ if (n) {
+ /*
+ * Load first set of stipple bits
+ */
+ LoadBits;
+
+ /*
+ * Consume stipple bits for startmask
+ */
+ if (startmask) {
#if FB_UNIT > 32
- if (pixelsPerDst == 16)
- mask = FbStipple16Bits(FbLeftStipBits(bits,16));
- else
+ if (pixelsPerDst == 16)
+ mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
+ else
#endif
- mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
- if (fbLane)
- {
- fbTransparentSpan (dst, mask & startmask, fgxor, 1);
- }
- else
- {
- if (mask || !transparent)
- FbDoLeftMaskByteStippleRRop (dst, mask,
- fgand, fgxor, bgand, bgxor,
- startbyte, startmask);
- }
- bits = FbStipLeft (bits, pixelsPerDst);
- dst++;
- n--;
- w--;
- }
- /*
- * Consume stipple bits across scanline
- */
- for (;;)
- {
- w -= n;
- if (copy)
- {
- while (n--)
- {
+ mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+ if (fbLane) {
+ fbTransparentSpan(dst, mask & startmask, fgxor, 1);
+ }
+ else {
+ if (mask || !transparent)
+ FbDoLeftMaskByteStippleRRop(dst, mask,
+ fgand, fgxor, bgand, bgxor,
+ startbyte, startmask);
+ }
+ bits = FbStipLeft(bits, pixelsPerDst);
+ dst++;
+ n--;
+ w--;
+ }
+ /*
+ * Consume stipple bits across scanline
+ */
+ for (;;) {
+ w -= n;
+ if (copy) {
+ while (n--) {
#if FB_UNIT > 32
- if (pixelsPerDst == 16)
- mask = FbStipple16Bits(FbLeftStipBits(bits,16));
- else
+ if (pixelsPerDst == 16)
+ mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
+ else
#endif
- mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
- WRITE(dst, FbOpaqueStipple (mask, fgxor, bgxor));
- dst++;
- bits = FbStipLeft(bits, pixelsPerDst);
- }
- }
- else
- {
- if (fbLane)
- {
- while (bits && n)
- {
- switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) {
- LaneCases((CARD8 *) dst);
- }
- bits = FbStipLeft(bits,pixelsPerDst);
- dst++;
- n--;
- }
- dst += n;
- }
- else
- {
- while (n--)
- {
- left = FbLeftStipBits(bits,pixelsPerDst);
- if (left || !transparent)
- {
- mask = fbBits[left];
- WRITE(dst, FbStippleRRop (READ(dst), mask,
- fgand, fgxor, bgand, bgxor));
- }
- dst++;
- bits = FbStipLeft(bits, pixelsPerDst);
- }
- }
- }
- if (!w)
- break;
- /*
- * Load another set and reset number of available units
- */
- LoadBits;
- n = unitsPerSrc;
- if (n > w)
- n = w;
- }
- }
- /*
- * Consume stipple bits for endmask
- */
- if (endmask)
- {
- if (endNeedsLoad)
- {
- LoadBits;
- }
+ mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+ WRITE(dst, FbOpaqueStipple(mask, fgxor, bgxor));
+ dst++;
+ bits = FbStipLeft(bits, pixelsPerDst);
+ }
+ }
+ else {
+ if (fbLane) {
+ while (bits && n) {
+ switch (fbLane[FbLeftStipBits(bits, pixelsPerDst)]) {
+ LaneCases((CARD8 *) dst);
+ }
+ bits = FbStipLeft(bits, pixelsPerDst);
+ dst++;
+ n--;
+ }
+ dst += n;
+ }
+ else {
+ while (n--) {
+ left = FbLeftStipBits(bits, pixelsPerDst);
+ if (left || !transparent) {
+ mask = fbBits[left];
+ WRITE(dst, FbStippleRRop(READ(dst), mask,
+ fgand, fgxor, bgand,
+ bgxor));
+ }
+ dst++;
+ bits = FbStipLeft(bits, pixelsPerDst);
+ }
+ }
+ }
+ if (!w)
+ break;
+ /*
+ * Load another set and reset number of available units
+ */
+ LoadBits;
+ n = unitsPerSrc;
+ if (n > w)
+ n = w;
+ }
+ }
+ /*
+ * Consume stipple bits for endmask
+ */
+ if (endmask) {
+ if (endNeedsLoad) {
+ LoadBits;
+ }
#if FB_UNIT > 32
- if (pixelsPerDst == 16)
- mask = FbStipple16Bits(FbLeftStipBits(bits,16));
- else
+ if (pixelsPerDst == 16)
+ mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
+ else
#endif
- mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
- if (fbLane)
- {
- fbTransparentSpan (dst, mask & endmask, fgxor, 1);
- }
- else
- {
- if (mask || !transparent)
- FbDoRightMaskByteStippleRRop (dst, mask,
- fgand, fgxor, bgand, bgxor,
- endbyte, endmask);
- }
- }
- dst += dstStride;
- src += srcStride;
+ mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+ if (fbLane) {
+ fbTransparentSpan(dst, mask & endmask, fgxor, 1);
+ }
+ else {
+ if (mask || !transparent)
+ FbDoRightMaskByteStippleRRop(dst, mask,
+ fgand, fgxor, bgand, bgxor,
+ endbyte, endmask);
+ }
+ }
+ dst += dstStride;
+ src += srcStride;
}
}
-
/*
* Crufty macros to initialize the mask array, most of this
* is to avoid compile-time warnings about shift overflow
@@ -447,28 +426,28 @@ fbBltOne (FbStip *src,
#define FbStip24New(rot) (2 + (rot != 0))
#define FbStip24Len 4
-const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
+const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
/* rotate 0 */
{
- C4_24( 0, 0), C4_24( 1, 0), C4_24( 2, 0), C4_24( 3, 0),
- C4_24( 4, 0), C4_24( 5, 0), C4_24( 6, 0), C4_24( 7, 0),
- C4_24( 8, 0), C4_24( 9, 0), C4_24(10, 0), C4_24(11, 0),
- C4_24(12, 0), C4_24(13, 0), C4_24(14, 0), C4_24(15, 0),
- },
+ C4_24(0, 0), C4_24(1, 0), C4_24(2, 0), C4_24(3, 0),
+ C4_24(4, 0), C4_24(5, 0), C4_24(6, 0), C4_24(7, 0),
+ C4_24(8, 0), C4_24(9, 0), C4_24(10, 0), C4_24(11, 0),
+ C4_24(12, 0), C4_24(13, 0), C4_24(14, 0), C4_24(15, 0),
+ },
/* rotate 8 */
{
- C4_24( 0, 8), C4_24( 1, 8), C4_24( 2, 8), C4_24( 3, 8),
- C4_24( 4, 8), C4_24( 5, 8), C4_24( 6, 8), C4_24( 7, 8),
- C4_24( 8, 8), C4_24( 9, 8), C4_24(10, 8), C4_24(11, 8),
- C4_24(12, 8), C4_24(13, 8), C4_24(14, 8), C4_24(15, 8),
- },
+ C4_24(0, 8), C4_24(1, 8), C4_24(2, 8), C4_24(3, 8),
+ C4_24(4, 8), C4_24(5, 8), C4_24(6, 8), C4_24(7, 8),
+ C4_24(8, 8), C4_24(9, 8), C4_24(10, 8), C4_24(11, 8),
+ C4_24(12, 8), C4_24(13, 8), C4_24(14, 8), C4_24(15, 8),
+ },
/* rotate 16 */
{
- C4_24( 0,16), C4_24( 1,16), C4_24( 2,16), C4_24( 3,16),
- C4_24( 4,16), C4_24( 5,16), C4_24( 6,16), C4_24( 7,16),
- C4_24( 8,16), C4_24( 9,16), C4_24(10,16), C4_24(11,16),
- C4_24(12,16), C4_24(13,16), C4_24(14,16), C4_24(15,16),
- }
+ C4_24(0, 16), C4_24(1, 16), C4_24(2, 16), C4_24(3, 16),
+ C4_24(4, 16), C4_24(5, 16), C4_24(6, 16), C4_24(7, 16),
+ C4_24(8, 16), C4_24(9, 16), C4_24(10, 16), C4_24(11, 16),
+ C4_24(12, 16), C4_24(13, 16), C4_24(14, 16), C4_24(15, 16),
+ }
};
#endif
@@ -485,19 +464,19 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
#define FbStip24New(rot) (1 + (rot == 8))
#endif
-const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
+const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
/* rotate 0 */
{
- C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0),
- },
+ C2_24(0, 0), C2_24(1, 0), C2_24(2, 0), C2_24(3, 0),
+ },
/* rotate 8 */
{
- C2_24( 0, 8), C2_24 ( 1, 8), C2_24 ( 2, 8), C2_24 ( 3, 8),
- },
+ C2_24(0, 8), C2_24(1, 8), C2_24(2, 8), C2_24(3, 8),
+ },
/* rotate 16 */
{
- C2_24( 0,16), C2_24 ( 1,16), C2_24 ( 2,16), C2_24 ( 3,16),
- }
+ C2_24(0, 16), C2_24(1, 16), C2_24(2, 16), C2_24(3, 16),
+ }
};
#endif
@@ -541,7 +520,7 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
fbFirstStipBits(len,stip); \
stip = FbMergeStip24Bits (0, stip, len); \
}
-
+
#define fbNextStipBits(rot,stip) {\
int __new = FbStip24New(rot); \
FbStip __right; \
@@ -560,32 +539,26 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
* and text
*/
void
-fbBltOne24 (FbStip *srcLine,
- FbStride srcStride, /* FbStip units per scanline */
- int srcX, /* bit position of source */
- FbBits *dst,
- FbStride dstStride, /* FbBits units per scanline */
- int dstX, /* bit position of dest */
- int dstBpp, /* bits per destination unit */
-
- int width, /* width in bits of destination */
- int height, /* height in scanlines */
-
- FbBits fgand, /* rrop values */
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor)
+fbBltOne24(FbStip * srcLine, FbStride srcStride, /* FbStip units per scanline */
+ int srcX, /* bit position of source */
+ FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
+ int dstX, /* bit position of dest */
+ int dstBpp, /* bits per destination unit */
+ int width, /* width in bits of destination */
+ int height, /* height in scanlines */
+ FbBits fgand, /* rrop values */
+ FbBits fgxor, FbBits bgand, FbBits bgxor)
{
- FbStip *src, *srcEnd;
- FbBits leftMask, rightMask, mask;
- int nlMiddle, nl;
- FbStip stip, bits;
- int remain;
- int dstS;
- int firstlen;
- int rot0, rot;
- int nDst;
-
+ FbStip *src, *srcEnd;
+ FbBits leftMask, rightMask, mask;
+ int nlMiddle, nl;
+ FbStip stip, bits;
+ int remain;
+ int dstS;
+ int firstlen;
+ int rot0, rot;
+ int nDst;
+
/*
* Do not read past the end of the buffer!
*/
@@ -595,146 +568,127 @@ fbBltOne24 (FbStip *srcLine,
dst += dstX >> FB_SHIFT;
srcX &= FB_STIP_MASK;
dstX &= FB_MASK;
- rot0 = FbFirst24Rot (dstX);
-
- FbMaskBits (dstX, width, leftMask, nlMiddle, rightMask);
-
+ rot0 = FbFirst24Rot(dstX);
+
+ FbMaskBits(dstX, width, leftMask, nlMiddle, rightMask);
+
dstS = (dstX + 23) / 24;
firstlen = FbStip24Len - dstS;
-
+
nDst = nlMiddle;
if (leftMask)
- nDst++;
+ nDst++;
dstStride -= nDst;
-
+
/* opaque copy */
- if (bgand == 0 && fgand == 0)
- {
- while (height--)
- {
- rot = rot0;
- src = srcLine;
- srcLine += srcStride;
- fbInitStipBits (srcX,firstlen, stip);
- if (leftMask)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, (READ(dst) & ~leftMask) |
- (FbOpaqueStipple (mask,
- FbRot24(fgxor, rot),
- FbRot24(bgxor, rot))
- & leftMask));
- dst++;
- fbNextStipBits(rot,stip);
- }
- nl = nlMiddle;
- while (nl--)
- {
- mask = fbStipple24Bits[rot>>3][stip];
- WRITE(dst, FbOpaqueStipple (mask,
- FbRot24(fgxor, rot),
- FbRot24(bgxor, rot)));
- dst++;
- fbNextStipBits(rot,stip);
- }
- if (rightMask)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, (READ(dst) & ~rightMask) |
- (FbOpaqueStipple (mask,
- FbRot24(fgxor, rot),
- FbRot24(bgxor, rot))
- & rightMask));
- }
- dst += dstStride;
- src += srcStride;
- }
+ if (bgand == 0 && fgand == 0) {
+ while (height--) {
+ rot = rot0;
+ src = srcLine;
+ srcLine += srcStride;
+ fbInitStipBits(srcX, firstlen, stip);
+ if (leftMask) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, (READ(dst) & ~leftMask) |
+ (FbOpaqueStipple(mask,
+ FbRot24(fgxor, rot), FbRot24(bgxor, rot))
+ & leftMask));
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ nl = nlMiddle;
+ while (nl--) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, FbOpaqueStipple(mask,
+ FbRot24(fgxor, rot),
+ FbRot24(bgxor, rot)));
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ if (rightMask) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, (READ(dst) & ~rightMask) |
+ (FbOpaqueStipple(mask,
+ FbRot24(fgxor, rot), FbRot24(bgxor, rot))
+ & rightMask));
+ }
+ dst += dstStride;
+ src += srcStride;
+ }
}
/* transparent copy */
- else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0)
- {
- while (height--)
- {
- rot = rot0;
- src = srcLine;
- srcLine += srcStride;
- fbInitStipBits (srcX, firstlen, stip);
- if (leftMask)
- {
- if (stip)
- {
- mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
- WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
- }
- dst++;
- fbNextStipBits (rot, stip);
- }
- nl = nlMiddle;
- while (nl--)
- {
- if (stip)
- {
- mask = fbStipple24Bits[rot>>3][stip];
- WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor,rot) & mask));
- }
- dst++;
- fbNextStipBits (rot, stip);
- }
- if (rightMask)
- {
- if (stip)
- {
- mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
- WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
- }
- }
- dst += dstStride;
- }
+ else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0) {
+ while (height--) {
+ rot = rot0;
+ src = srcLine;
+ srcLine += srcStride;
+ fbInitStipBits(srcX, firstlen, stip);
+ if (leftMask) {
+ if (stip) {
+ mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
+ WRITE(dst,
+ (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+ }
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ nl = nlMiddle;
+ while (nl--) {
+ if (stip) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst,
+ (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+ }
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ if (rightMask) {
+ if (stip) {
+ mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
+ WRITE(dst,
+ (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+ }
+ }
+ dst += dstStride;
+ }
}
- else
- {
- while (height--)
- {
- rot = rot0;
- src = srcLine;
- srcLine += srcStride;
- fbInitStipBits (srcX, firstlen, stip);
- if (leftMask)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, FbStippleRRopMask (READ(dst), mask,
- FbRot24(fgand, rot),
- FbRot24(fgxor, rot),
- FbRot24(bgand, rot),
- FbRot24(bgxor, rot),
- leftMask));
- dst++;
- fbNextStipBits(rot,stip);
- }
- nl = nlMiddle;
- while (nl--)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, FbStippleRRop (READ(dst), mask,
- FbRot24(fgand, rot),
- FbRot24(fgxor, rot),
- FbRot24(bgand, rot),
- FbRot24(bgxor, rot)));
- dst++;
- fbNextStipBits(rot,stip);
- }
- if (rightMask)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, FbStippleRRopMask (READ(dst), mask,
- FbRot24(fgand, rot),
- FbRot24(fgxor, rot),
- FbRot24(bgand, rot),
- FbRot24(bgxor, rot),
- rightMask));
- }
- dst += dstStride;
- }
+ else {
+ while (height--) {
+ rot = rot0;
+ src = srcLine;
+ srcLine += srcStride;
+ fbInitStipBits(srcX, firstlen, stip);
+ if (leftMask) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, FbStippleRRopMask(READ(dst), mask,
+ FbRot24(fgand, rot),
+ FbRot24(fgxor, rot),
+ FbRot24(bgand, rot),
+ FbRot24(bgxor, rot), leftMask));
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ nl = nlMiddle;
+ while (nl--) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, FbStippleRRop(READ(dst), mask,
+ FbRot24(fgand, rot),
+ FbRot24(fgxor, rot),
+ FbRot24(bgand, rot),
+ FbRot24(bgxor, rot)));
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ if (rightMask) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, FbStippleRRopMask(READ(dst), mask,
+ FbRot24(fgand, rot),
+ FbRot24(fgxor, rot),
+ FbRot24(bgand, rot),
+ FbRot24(bgxor, rot), rightMask));
+ }
+ dst += dstStride;
+ }
}
}
@@ -742,121 +696,107 @@ fbBltOne24 (FbStip *srcLine,
* Not very efficient, but simple -- copy a single plane
* from an N bit image to a 1 bit image
*/
-
+
void
-fbBltPlane (FbBits *src,
- FbStride srcStride,
- int srcX,
- int srcBpp,
-
- FbStip *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbStip fgand,
- FbStip fgxor,
- FbStip bgand,
- FbStip bgxor,
- Pixel planeMask)
+fbBltPlane(FbBits * src,
+ FbStride srcStride,
+ int srcX,
+ int srcBpp,
+ FbStip * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbStip fgand,
+ FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask)
{
- FbBits *s;
- FbBits pm;
- FbBits srcMask;
- FbBits srcMaskFirst;
- FbBits srcMask0 = 0;
- FbBits srcBits;
-
- FbStip dstBits;
- FbStip *d;
- FbStip dstMask;
- FbStip dstMaskFirst;
- FbStip dstUnion;
- int w;
- int wt;
- int rot0;
+ FbBits *s;
+ FbBits pm;
+ FbBits srcMask;
+ FbBits srcMaskFirst;
+ FbBits srcMask0 = 0;
+ FbBits srcBits;
+
+ FbStip dstBits;
+ FbStip *d;
+ FbStip dstMask;
+ FbStip dstMaskFirst;
+ FbStip dstUnion;
+ int w;
+ int wt;
+ int rot0;
if (!width)
- return;
-
+ return;
+
src += srcX >> FB_SHIFT;
srcX &= FB_MASK;
dst += dstX >> FB_STIP_SHIFT;
dstX &= FB_STIP_MASK;
-
+
w = width / srcBpp;
- pm = fbReplicatePixel (planeMask, srcBpp);
- if (srcBpp == 24)
- {
- int w = 24;
+ pm = fbReplicatePixel(planeMask, srcBpp);
+ if (srcBpp == 24) {
+ int w = 24;
- rot0 = FbFirst24Rot (srcX);
- if (srcX + w > FB_UNIT)
- w = FB_UNIT - srcX;
- srcMaskFirst = FbRot24(pm,rot0) & FbBitsMask(srcX,w);
+ rot0 = FbFirst24Rot(srcX);
+ if (srcX + w > FB_UNIT)
+ w = FB_UNIT - srcX;
+ srcMaskFirst = FbRot24(pm, rot0) & FbBitsMask(srcX, w);
}
- else
- {
- rot0 = 0;
- srcMaskFirst = pm & FbBitsMask(srcX, srcBpp);
- srcMask0 = pm & FbBitsMask(0, srcBpp);
+ else {
+ rot0 = 0;
+ srcMaskFirst = pm & FbBitsMask(srcX, srcBpp);
+ srcMask0 = pm & FbBitsMask(0, srcBpp);
}
-
- dstMaskFirst = FbStipMask(dstX,1);
- while (height--)
- {
- d = dst;
- dst += dstStride;
- s = src;
- src += srcStride;
-
- srcMask = srcMaskFirst;
- if (srcBpp == 24)
- srcMask0 = FbRot24(pm,rot0) & FbBitsMask(0, srcBpp);
- srcBits = READ(s++);
-
- dstMask = dstMaskFirst;
- dstUnion = 0;
- dstBits = 0;
-
- wt = w;
-
- while (wt--)
- {
- if (!srcMask)
- {
- srcBits = READ(s++);
- if (srcBpp == 24)
- srcMask0 = FbNext24Pix(srcMask0) & FbBitsMask(0,24);
- srcMask = srcMask0;
- }
- if (!dstMask)
- {
- WRITE(d, FbStippleRRopMask(READ(d), dstBits,
- fgand, fgxor, bgand, bgxor,
- dstUnion));
- d++;
- dstMask = FbStipMask(0,1);
- dstUnion = 0;
- dstBits = 0;
- }
- if (srcBits & srcMask)
- dstBits |= dstMask;
- dstUnion |= dstMask;
- if (srcBpp == FB_UNIT)
- srcMask = 0;
- else
- srcMask = FbScrRight(srcMask,srcBpp);
- dstMask = FbStipRight(dstMask,1);
- }
- if (dstUnion)
- WRITE(d, FbStippleRRopMask(READ(d),dstBits,
- fgand, fgxor, bgand, bgxor,
- dstUnion));
+
+ dstMaskFirst = FbStipMask(dstX, 1);
+ while (height--) {
+ d = dst;
+ dst += dstStride;
+ s = src;
+ src += srcStride;
+
+ srcMask = srcMaskFirst;
+ if (srcBpp == 24)
+ srcMask0 = FbRot24(pm, rot0) & FbBitsMask(0, srcBpp);
+ srcBits = READ(s++);
+
+ dstMask = dstMaskFirst;
+ dstUnion = 0;
+ dstBits = 0;
+
+ wt = w;
+
+ while (wt--) {
+ if (!srcMask) {
+ srcBits = READ(s++);
+ if (srcBpp == 24)
+ srcMask0 = FbNext24Pix(srcMask0) & FbBitsMask(0, 24);
+ srcMask = srcMask0;
+ }
+ if (!dstMask) {
+ WRITE(d, FbStippleRRopMask(READ(d), dstBits,
+ fgand, fgxor, bgand, bgxor,
+ dstUnion));
+ d++;
+ dstMask = FbStipMask(0, 1);
+ dstUnion = 0;
+ dstBits = 0;
+ }
+ if (srcBits & srcMask)
+ dstBits |= dstMask;
+ dstUnion |= dstMask;
+ if (srcBpp == FB_UNIT)
+ srcMask = 0;
+ else
+ srcMask = FbScrRight(srcMask, srcBpp);
+ dstMask = FbStipRight(dstMask, 1);
+ }
+ if (dstUnion)
+ WRITE(d, FbStippleRRopMask(READ(d), dstBits,
+ fgand, fgxor, bgand, bgxor, dstUnion));
}
}
-
diff --git a/fb/fbcmap_mi.c b/fb/fbcmap_mi.c
index 227da3118..7b6a2c679 100644
--- a/fb/fbcmap_mi.c
+++ b/fb/fbcmap_mi.c
@@ -27,7 +27,6 @@
* XFree86Server being defined.
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -37,7 +36,7 @@
#include "micmap.h"
int
-fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
+fbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps)
{
return miListInstalledColormaps(pScreen, pmaps);
}
@@ -55,10 +54,8 @@ fbUninstallColormap(ColormapPtr pmap)
}
void
-fbResolveColor(unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual)
+fbResolveColor(unsigned short *pred,
+ unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual)
{
miResolveColor(pred, pgreen, pblue, pVisual);
}
@@ -70,10 +67,8 @@ fbInitializeColormap(ColormapPtr pmap)
}
int
-fbExpandDirectColors (ColormapPtr pmap,
- int ndef,
- xColorItem *indefs,
- xColorItem *outdefs)
+fbExpandDirectColors(ColormapPtr pmap,
+ int ndef, xColorItem * indefs, xColorItem * outdefs)
{
return miExpandDirectColors(pmap, ndef, indefs, outdefs);
}
@@ -91,14 +86,14 @@ fbClearVisualTypes(void)
}
Bool
-fbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
+fbSetVisualTypes(int depth, int visuals, int bitsPerRGB)
{
return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
}
Bool
-fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
- Pixel redMask, Pixel greenMask, Pixel blueMask)
+fbSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
+ Pixel redMask, Pixel greenMask, Pixel blueMask)
{
return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
redMask, greenMask, blueMask);
@@ -110,15 +105,13 @@ fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
* the set which can be used with this version of fb.
*/
Bool
-fbInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB)
+fbInitVisuals(VisualPtr * visualp,
+ DepthPtr * depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB)
{
return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
- defaultVisp, sizes, bitsPerRGB, -1);
+ defaultVisp, sizes, bitsPerRGB, -1);
}
diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 898320378..e9c252a5e 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -30,343 +30,273 @@
/* Compatibility wrapper, to be removed at next ABI change. */
void
-fbCopyRegion (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- RegionPtr pDstRegion,
- int dx,
- int dy,
- fbCopyProc copyProc,
- Pixel bitPlane,
- void *closure)
+fbCopyRegion(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ RegionPtr pDstRegion,
+ int dx, int dy, fbCopyProc copyProc, Pixel bitPlane, void *closure)
{
- miCopyRegion(pSrcDrawable, pDstDrawable, pGC, pDstRegion, dx, dy, copyProc, bitPlane, closure);
+ miCopyRegion(pSrcDrawable, pDstDrawable, pGC, pDstRegion, dx, dy, copyProc,
+ bitPlane, closure);
}
/* Compatibility wrapper, to be removed at next ABI change. */
RegionPtr
-fbDoCopy (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- fbCopyProc copyProc,
- Pixel bitPlane,
- void *closure)
+fbDoCopy(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc,
+ int xOut, int yOut, fbCopyProc copyProc, Pixel bitPlane, void *closure)
{
- return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, copyProc, bitPlane, closure);
+ return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc,
+ heightSrc, xOut, yOut, copyProc, bitPlane, closure);
}
void
-fbCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fbCopyNtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
{
- CARD8 alu = pGC ? pGC->alu : GXcopy;
- FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES;
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ CARD8 alu = pGC ? pGC->alu : GXcopy;
+ FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES;
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
- while (nbox--)
- {
-#ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */
- if (pm == FB_ALLONES && alu == GXcopy && !reverse &&
- !upsidedown)
- {
- if (!pixman_blt ((uint32_t *)src, (uint32_t *)dst, srcStride, dstStride, srcBpp, dstBpp,
- (pbox->x1 + dx + srcXoff),
- (pbox->y1 + dy + srcYoff),
- (pbox->x1 + dstXoff),
- (pbox->y1 + dstYoff),
- (pbox->x2 - pbox->x1),
- (pbox->y2 - pbox->y1)))
- goto fallback;
- else
- goto next;
- }
- fallback:
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
+ fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
+ while (nbox--) {
+#ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */
+ if (pm == FB_ALLONES && alu == GXcopy && !reverse && !upsidedown) {
+ if (!pixman_blt
+ ((uint32_t *) src, (uint32_t *) dst, srcStride, dstStride,
+ srcBpp, dstBpp, (pbox->x1 + dx + srcXoff),
+ (pbox->y1 + dy + srcYoff), (pbox->x1 + dstXoff),
+ (pbox->y1 + dstYoff), (pbox->x2 - pbox->x1),
+ (pbox->y2 - pbox->y1)))
+ goto fallback;
+ else
+ goto next;
+ }
+ fallback:
#endif
- fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- alu,
- pm,
- dstBpp,
-
- reverse,
- upsidedown);
+ fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp,
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ (pbox->y2 - pbox->y1), alu, pm, dstBpp, reverse, upsidedown);
#ifndef FB_ACCESS_WRAPPER
- next:
+ next:
#endif
- pbox++;
- }
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
+ pbox++;
+ }
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
}
void
-fbCopy1toN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fbCopy1toN(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 *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
+ fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- while (nbox--)
- {
- if (dstBpp == 1)
- {
- fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- FbOpaqueStipple1Rop(pGC->alu,
- pGC->fgPixel,pGC->bgPixel),
- pPriv->pm,
- dstBpp,
-
- reverse,
- upsidedown);
- }
- else
- {
- fbBltOne ((FbStip *) (src + (pbox->y1 + dy + srcYoff) * srcStride),
- srcStride*(FB_UNIT/FB_STIP_UNIT),
- (pbox->x1 + dx + srcXoff),
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
- dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- pPriv->and, pPriv->xor,
- pPriv->bgand, pPriv->bgxor);
- }
- pbox++;
+ while (nbox--) {
+ if (dstBpp == 1) {
+ fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp,
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ (pbox->y2 - pbox->y1),
+ FbOpaqueStipple1Rop(pGC->alu,
+ pGC->fgPixel, pGC->bgPixel),
+ pPriv->pm, dstBpp, reverse, upsidedown);
+ }
+ else {
+ fbBltOne((FbStip *) (src + (pbox->y1 + dy + srcYoff) * srcStride),
+ srcStride * (FB_UNIT / FB_STIP_UNIT),
+ (pbox->x1 + dx + srcXoff),
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ (pbox->y2 - pbox->y1),
+ pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor);
+ }
+ pbox++;
}
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
}
void
-fbCopyNto1 (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fbCopyNto1(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);
-
- while (nbox--)
- {
- if (pDstDrawable->bitsPerPixel == 1)
- {
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
-
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetStipDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- fbBltPlane (src + (pbox->y1+ dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
- srcBpp,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * srcBpp,
- (pbox->y2 - pbox->y1),
-
- (FbStip) pPriv->and, (FbStip) pPriv->xor,
- (FbStip) pPriv->bgand, (FbStip) pPriv->bgxor,
- bitplane);
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
- }
- else
- {
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+
+ while (nbox--) {
+ if (pDstDrawable->bitsPerPixel == 1) {
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff,
+ srcYoff);
+ fbGetStipDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff,
+ dstYoff);
+ fbBltPlane(src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp, srcBpp,
+ dst + (pbox->y1 + dstYoff) * dstStride, dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ (pbox->x2 - pbox->x1) * srcBpp, (pbox->y2 - pbox->y1),
+ (FbStip) pPriv->and, (FbStip) pPriv->xor,
+ (FbStip) pPriv->bgand, (FbStip) pPriv->bgxor, bitplane);
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
+ }
+ else {
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ FbStip *tmp;
+ FbStride tmpStride;
+ int width, height;
+
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
+ tmp = malloc(tmpStride * height * sizeof(FbStip));
+ if (!tmp)
+ return;
+
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff,
+ srcYoff);
+ fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff,
+ dstYoff);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- FbStip *tmp;
- FbStride tmpStride;
- int width, height;
-
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
- tmp = malloc(tmpStride * height * sizeof (FbStip));
- if (!tmp)
- return;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- fbBltPlane (src + (pbox->y1+ dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
- srcBpp,
-
- tmp,
- tmpStride,
- 0,
-
- width * srcBpp,
- height,
-
- fbAndStip(GXcopy,FB_ALLONES,FB_ALLONES),
- fbXorStip(GXcopy,FB_ALLONES,FB_ALLONES),
- fbAndStip(GXcopy,0,FB_ALLONES),
- fbXorStip(GXcopy,0,FB_ALLONES),
- bitplane);
- fbBltOne (tmp,
- tmpStride,
- 0,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
- dstBpp,
-
- width * dstBpp,
- height,
-
- pPriv->and, pPriv->xor,
- pPriv->bgand, pPriv->bgxor);
- free(tmp);
+ fbBltPlane(src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp,
+ srcBpp,
+ tmp,
+ tmpStride,
+ 0,
+ width * srcBpp,
+ height,
+ fbAndStip(GXcopy, FB_ALLONES, FB_ALLONES),
+ fbXorStip(GXcopy, FB_ALLONES, FB_ALLONES),
+ fbAndStip(GXcopy, 0, FB_ALLONES),
+ fbXorStip(GXcopy, 0, FB_ALLONES), bitplane);
+ fbBltOne(tmp,
+ tmpStride,
+ 0,
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ dstBpp,
+ width * dstBpp,
+ height,
+ pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor);
+ free(tmp);
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
- }
- pbox++;
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
+ }
+ pbox++;
}
}
RegionPtr
-fbCopyArea (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut)
+fbCopyArea(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut)
{
- miCopyProc copy;
+ miCopyProc copy;
if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
- copy = fb24_32CopyMtoN;
+ copy = fb24_32CopyMtoN;
else
- copy = fbCopyNtoN;
- return miDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
- widthSrc, heightSrc, xOut, yOut, copy, 0, 0);
+ copy = fbCopyNtoN;
+ return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
+ widthSrc, heightSrc, xOut, yOut, copy, 0, 0);
}
RegionPtr
-fbCopyPlane (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- unsigned long bitplane)
+fbCopyPlane(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc, int xOut, int yOut, unsigned long bitplane)
{
if (pSrcDrawable->bitsPerPixel > 1)
- return miDoCopy (pSrcDrawable, pDstDrawable, pGC,
- xIn, yIn, widthSrc, heightSrc,
- xOut, yOut, fbCopyNto1, (Pixel) bitplane, 0);
+ return miDoCopy(pSrcDrawable, pDstDrawable, pGC,
+ xIn, yIn, widthSrc, heightSrc,
+ xOut, yOut, fbCopyNto1, (Pixel) bitplane, 0);
else if (bitplane & 1)
- return miDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
- widthSrc, heightSrc, xOut, yOut, fbCopy1toN,
- (Pixel) bitplane, 0);
+ return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
+ widthSrc, heightSrc, xOut, yOut, fbCopy1toN,
+ (Pixel) bitplane, 0);
else
- return miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
- xIn, yIn,
- widthSrc,
- heightSrc,
- xOut, yOut, bitplane);
+ return miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ xIn, yIn,
+ widthSrc, heightSrc, xOut, yOut, bitplane);
}
diff --git a/fb/fbfill.c b/fb/fbfill.c
index e62a48ae0..de9d6b313 100644
--- a/fb/fbfill.c
+++ b/fb/fbfill.c
@@ -27,204 +27,166 @@
#include "fb.h"
void
-fbFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height)
+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);
+ 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;
+ 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 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;
+ 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);
+ fbValidateDrawable(pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- int x1,
- int y1,
- int x2,
- int y2,
- FbBits and,
- FbBits xor)
+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);
-
+ 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;
+ 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))
+ 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);
+ fbSolid(dst + (partY1 + dstYoff) * dstStride,
+ dstStride,
+ (partX1 + dstXoff) * dstBpp,
+ dstBpp,
+ (partX2 - partX1) * dstBpp, (partY2 - partY1), and, xor);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
diff --git a/fb/fbfillrect.c b/fb/fbfillrect.c
index 7fc03f9a5..64ba2b493 100644
--- a/fb/fbfillrect.c
+++ b/fb/fbfillrect.c
@@ -27,86 +27,77 @@
#include "fb.h"
void
-fbPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
+fbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect)
{
- RegionPtr pClip = fbGetCompositeClip(pGC);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
register BoxPtr pbox;
- BoxPtr pextent;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1, fullY2;
- int partX1, partX2, partY1, partY2;
- int xorg, yorg;
- int n;
+ BoxPtr pextent;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1, fullY2;
+ int partX1, partX2, partY1, partY2;
+ int xorg, yorg;
+ int n;
xorg = pDrawable->x;
yorg = pDrawable->y;
-
+
pextent = RegionExtents(pClip);
extentX1 = pextent->x1;
extentY1 = pextent->y1;
extentX2 = pextent->x2;
extentY2 = pextent->y2;
- while (nrect--)
- {
- fullX1 = prect->x + xorg;
- fullY1 = prect->y + yorg;
- fullX2 = fullX1 + (int) prect->width;
- fullY2 = fullY1 + (int) prect->height;
- prect++;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
+ while (nrect--) {
+ fullX1 = prect->x + xorg;
+ fullY1 = prect->y + yorg;
+ fullX2 = fullX1 + (int) prect->width;
+ fullY2 = fullY1 + (int) prect->height;
+ prect++;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+
+ if (fullY1 < extentY1)
+ fullY1 = extentY1;
+
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullY2 > extentY2)
+ fullY2 = extentY2;
- if (fullY1 < extentY1)
- fullY1 = extentY1;
+ if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
+ continue;
+ n = RegionNumRects(pClip);
+ if (n == 1) {
+ fbFill(pDrawable,
+ pGC, fullX1, fullY1, fullX2 - fullX1, fullY2 - fullY1);
+ }
+ else {
+ pbox = RegionRects(pClip);
+ /*
+ * clip the rectangle to each box in the clip region
+ * this is logically equivalent to calling Intersect()
+ */
+ while (n--) {
+ partX1 = pbox->x1;
+ if (partX1 < fullX1)
+ partX1 = fullX1;
+ partY1 = pbox->y1;
+ if (partY1 < fullY1)
+ partY1 = fullY1;
+ partX2 = pbox->x2;
+ if (partX2 > fullX2)
+ partX2 = fullX2;
+ partY2 = pbox->y2;
+ if (partY2 > fullY2)
+ partY2 = fullY2;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullY2 > extentY2)
- fullY2 = extentY2;
+ pbox++;
- if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
- continue;
- n = RegionNumRects (pClip);
- if (n == 1)
- {
- fbFill (pDrawable,
- pGC,
- fullX1, fullY1, fullX2-fullX1, fullY2-fullY1);
- }
- else
- {
- pbox = RegionRects(pClip);
- /*
- * clip the rectangle to each box in the clip region
- * this is logically equivalent to calling Intersect()
- */
- while(n--)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partY1 = pbox->y1;
- if (partY1 < fullY1)
- partY1 = fullY1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- partY2 = pbox->y2;
- if (partY2 > fullY2)
- partY2 = fullY2;
-
- pbox++;
-
- if (partX1 < partX2 && partY1 < partY2)
- fbFill (pDrawable, pGC,
- partX1, partY1,
- partX2 - partX1, partY2 - partY1);
- }
- }
+ if (partX1 < partX2 && partY1 < partY2)
+ fbFill(pDrawable, pGC,
+ partX1, partY1, partX2 - partX1, partY2 - partY1);
+ }
+ }
}
}
diff --git a/fb/fbfillsp.c b/fb/fbfillsp.c
index 194bfc88b..4debe1ebd 100644
--- a/fb/fbfillsp.c
+++ b/fb/fbfillsp.c
@@ -27,74 +27,61 @@
#include "fb.h"
void
-fbFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted)
+fbFillSpans(DrawablePtr pDrawable,
+ GCPtr pGC, int n, DDXPointPtr ppt, int *pwidth, int fSorted)
{
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pextent, pbox;
- int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1;
- int partX1, partX2;
-
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ BoxPtr pextent, pbox;
+ int nbox;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1;
+ int partX1, partX2;
+
pextent = RegionExtents(pClip);
extentX1 = pextent->x1;
extentY1 = pextent->y1;
extentX2 = pextent->x2;
extentY2 = pextent->y2;
- while (n--)
- {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int) *pwidth;
- ppt++;
- pwidth++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
+ while (n--) {
+ fullX1 = ppt->x;
+ fullY1 = ppt->y;
+ fullX2 = fullX1 + (int) *pwidth;
+ ppt++;
+ pwidth++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- nbox = RegionNumRects (pClip);
- if (nbox == 1)
- {
- fbFill (pDrawable,
- pGC,
- fullX1, fullY1, fullX2-fullX1, 1);
- }
- else
- {
- pbox = RegionRects(pClip);
- while(nbox--)
- {
- if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- if (partX2 > partX1)
- {
- fbFill (pDrawable, pGC,
- partX1, fullY1,
- partX2 - partX1, 1);
- }
- }
- pbox++;
- }
- }
+ nbox = RegionNumRects(pClip);
+ if (nbox == 1) {
+ fbFill(pDrawable, pGC, fullX1, fullY1, fullX2 - fullX1, 1);
+ }
+ else {
+ pbox = RegionRects(pClip);
+ while (nbox--) {
+ if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) {
+ partX1 = pbox->x1;
+ if (partX1 < fullX1)
+ partX1 = fullX1;
+ partX2 = pbox->x2;
+ if (partX2 > fullX2)
+ partX2 = fullX2;
+ if (partX2 > partX1) {
+ fbFill(pDrawable, pGC,
+ partX1, fullY1, partX2 - partX1, 1);
+ }
+ }
+ pbox++;
+ }
+ }
}
}
diff --git a/fb/fbgc.c b/fb/fbgc.c
index 8108c3acb..e6f8279b3 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -38,7 +38,7 @@ const GCFuncs fbGCFuncs = {
miCopyClip,
};
-const GCOps fbGCOps = {
+const GCOps fbGCOps = {
fbFillSpans,
fbSetSpans,
fbPutImage,
@@ -64,14 +64,14 @@ const GCOps fbGCOps = {
Bool
fbCreateGC(GCPtr pGC)
{
- pGC->ops = (GCOps *) &fbGCOps;
- pGC->funcs = (GCFuncs *) &fbGCFuncs;
+ pGC->ops = (GCOps *) & fbGCOps;
+ pGC->funcs = (GCFuncs *) & fbGCFuncs;
/* fb wants to translate before scan conversion */
pGC->miTranslate = 1;
pGC->fExpose = 1;
- fbGetGCPrivate(pGC)->bpp = BitsPerPixel (pGC->depth);
+ fbGetGCPrivate(pGC)->bpp = BitsPerPixel(pGC->depth);
return TRUE;
}
@@ -79,56 +79,53 @@ fbCreateGC(GCPtr pGC)
* Pad pixmap to FB_UNIT bits wide
*/
void
-fbPadPixmap (PixmapPtr pPixmap)
+fbPadPixmap(PixmapPtr pPixmap)
{
- int width;
- FbBits *bits;
- FbBits b;
- FbBits mask;
- int height;
- int w;
- int stride;
- int bpp;
+ int width;
+ FbBits *bits;
+ FbBits b;
+ FbBits mask;
+ int height;
+ int w;
+ int stride;
+ int bpp;
_X_UNUSED int xOff, yOff;
- fbGetDrawable (&pPixmap->drawable, bits, stride, bpp, xOff, yOff);
+ fbGetDrawable(&pPixmap->drawable, bits, stride, bpp, xOff, yOff);
width = pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel;
height = pPixmap->drawable.height;
- mask = FbBitsMask (0, width);
- while (height--)
- {
- b = READ(bits) & mask;
- w = width;
- while (w < FB_UNIT)
- {
- b = b | FbScrRight(b, w);
- w <<= 1;
- }
- WRITE(bits, b);
- bits += stride;
+ mask = FbBitsMask(0, width);
+ while (height--) {
+ b = READ(bits) & mask;
+ w = width;
+ while (w < FB_UNIT) {
+ b = b | FbScrRight(b, w);
+ w <<= 1;
+ }
+ WRITE(bits, b);
+ bits += stride;
}
- fbFinishAccess (&pPixmap->drawable);
+ fbFinishAccess(&pPixmap->drawable);
}
/*
* Verify that 'bits' repeats every 'len' bits
*/
static Bool
-fbBitsRepeat (FbBits bits, int len, int width)
+fbBitsRepeat(FbBits bits, int len, int width)
{
- FbBits mask = FbBitsMask(0, len);
- FbBits orig = bits & mask;
- int i;
-
+ FbBits mask = FbBitsMask(0, len);
+ FbBits orig = bits & mask;
+ int i;
+
if (width > FB_UNIT)
- width = FB_UNIT;
- for (i = 0; i < width / len; i++)
- {
- if ((bits & mask) != orig)
- return FALSE;
- bits = FbScrLeft(bits,len);
+ width = FB_UNIT;
+ for (i = 0; i < width / len; i++) {
+ if ((bits & mask) != orig)
+ return FALSE;
+ bits = FbScrLeft(bits, len);
}
return TRUE;
}
@@ -138,17 +135,17 @@ fbBitsRepeat (FbBits bits, int len, int width)
* the first 'len' bits
*/
static Bool
-fbLineRepeat (FbBits *bits, int len, int width)
+fbLineRepeat(FbBits * bits, int len, int width)
{
- FbBits first = bits[0];
-
- if (!fbBitsRepeat (first, len, width))
- return FALSE;
- width = (width + FB_UNIT-1) >> FB_SHIFT;
+ FbBits first = bits[0];
+
+ if (!fbBitsRepeat(first, len, width))
+ return FALSE;
+ width = (width + FB_UNIT - 1) >> FB_SHIFT;
bits++;
while (--width)
- if (READ(bits) != first)
- return FALSE;
+ if (READ(bits) != first)
+ return FALSE;
return TRUE;
}
@@ -157,41 +154,41 @@ fbLineRepeat (FbBits *bits, int len, int width)
* each scanline to represent the entire stipple
*/
static Bool
-fbCanEvenStipple (PixmapPtr pStipple, int bpp)
+fbCanEvenStipple(PixmapPtr pStipple, int bpp)
{
- int len = FB_UNIT / bpp;
- FbBits *bits;
- int stride;
- int stip_bpp;
+ int len = FB_UNIT / bpp;
+ FbBits *bits;
+ int stride;
+ int stip_bpp;
_X_UNUSED int stipXoff, stipYoff;
- int h;
+ int h;
/* can't even stipple 24bpp drawables */
- if ((bpp & (bpp-1)) != 0)
- return FALSE;
+ if ((bpp & (bpp - 1)) != 0)
+ return FALSE;
/* make sure the stipple width is a multiple of the even stipple width */
if (pStipple->drawable.width % len != 0)
- return FALSE;
- fbGetDrawable (&pStipple->drawable, bits, stride, stip_bpp, stipXoff, stipYoff);
+ return FALSE;
+ fbGetDrawable(&pStipple->drawable, bits, stride, stip_bpp, stipXoff,
+ stipYoff);
h = pStipple->drawable.height;
/* check to see that the stipple repeats horizontally */
- while (h--)
- {
- if (!fbLineRepeat (bits, len, pStipple->drawable.width)) {
- fbFinishAccess (&pStipple->drawable);
- return FALSE;
- }
- bits += stride;
+ while (h--) {
+ if (!fbLineRepeat(bits, len, pStipple->drawable.width)) {
+ fbFinishAccess(&pStipple->drawable);
+ return FALSE;
+ }
+ bits += stride;
}
- fbFinishAccess (&pStipple->drawable);
+ fbFinishAccess(&pStipple->drawable);
return TRUE;
}
void
fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- FbBits mask;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbBits mask;
/*
* if the client clip is different or moved OR the subwindowMode has
@@ -199,109 +196,101 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
* we need to recompute the composite clip
*/
- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- )
- {
- miComputeCompositeClip (pGC, pDrawable);
+ if ((changes &
+ (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ ) {
+ miComputeCompositeClip(pGC, pDrawable);
}
-
- if (pPriv->bpp != pDrawable->bitsPerPixel)
- {
- changes |= GCStipple|GCForeground|GCBackground|GCPlaneMask;
- pPriv->bpp = pDrawable->bitsPerPixel;
+
+ if (pPriv->bpp != pDrawable->bitsPerPixel) {
+ changes |= GCStipple | GCForeground | GCBackground | GCPlaneMask;
+ pPriv->bpp = pDrawable->bitsPerPixel;
}
- if ((changes & GCTile) && fbGetRotatedPixmap(pGC))
- {
- (*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC));
- fbGetRotatedPixmap(pGC) = 0;
+ if ((changes & GCTile) && fbGetRotatedPixmap(pGC)) {
+ (*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC));
+ fbGetRotatedPixmap(pGC) = 0;
}
-
- if (pGC->fillStyle == FillTiled)
- {
- PixmapPtr pOldTile, pNewTile;
-
- pOldTile = pGC->tile.pixmap;
- if (pOldTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
- {
- pNewTile = fbGetRotatedPixmap(pGC);
- if (!pNewTile || pNewTile ->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
- {
- if (pNewTile)
- (*pGC->pScreen->DestroyPixmap) (pNewTile);
- pNewTile = fb24_32ReformatTile (pOldTile, pDrawable->bitsPerPixel);
- }
- if (pNewTile)
- {
- fbGetRotatedPixmap(pGC) = pOldTile;
- pGC->tile.pixmap = pNewTile;
- changes |= GCTile;
- }
- }
+
+ if (pGC->fillStyle == FillTiled) {
+ PixmapPtr pOldTile, pNewTile;
+
+ pOldTile = pGC->tile.pixmap;
+ if (pOldTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
+ pNewTile = fbGetRotatedPixmap(pGC);
+ if (!pNewTile ||
+ pNewTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
+ if (pNewTile)
+ (*pGC->pScreen->DestroyPixmap) (pNewTile);
+ pNewTile =
+ fb24_32ReformatTile(pOldTile, pDrawable->bitsPerPixel);
+ }
+ if (pNewTile) {
+ fbGetRotatedPixmap(pGC) = pOldTile;
+ pGC->tile.pixmap = pNewTile;
+ changes |= GCTile;
+ }
+ }
}
- if (changes & GCTile)
- {
- if (!pGC->tileIsPixel &&
- FbEvenTile (pGC->tile.pixmap->drawable.width *
- pDrawable->bitsPerPixel))
- fbPadPixmap (pGC->tile.pixmap);
+ if (changes & GCTile) {
+ if (!pGC->tileIsPixel &&
+ FbEvenTile(pGC->tile.pixmap->drawable.width *
+ pDrawable->bitsPerPixel))
+ fbPadPixmap(pGC->tile.pixmap);
}
- if (changes & GCStipple)
- {
- pPriv->evenStipple = FALSE;
+ if (changes & GCStipple) {
+ pPriv->evenStipple = FALSE;
- if (pGC->stipple) {
+ if (pGC->stipple) {
- /* can we do an even stipple ?? */
- if (FbEvenStip (pGC->stipple->drawable.width,
- pDrawable->bitsPerPixel) &&
- (fbCanEvenStipple (pGC->stipple, pDrawable->bitsPerPixel)))
- pPriv->evenStipple = TRUE;
+ /* can we do an even stipple ?? */
+ if (FbEvenStip(pGC->stipple->drawable.width,
+ pDrawable->bitsPerPixel) &&
+ (fbCanEvenStipple(pGC->stipple, pDrawable->bitsPerPixel)))
+ pPriv->evenStipple = TRUE;
- if (pGC->stipple->drawable.width * pDrawable->bitsPerPixel < FB_UNIT)
- fbPadPixmap (pGC->stipple);
- }
+ if (pGC->stipple->drawable.width * pDrawable->bitsPerPixel <
+ FB_UNIT)
+ fbPadPixmap(pGC->stipple);
+ }
}
/*
* Recompute reduced rop values
*/
- if (changes & (GCForeground|GCBackground|GCPlaneMask|GCFunction))
- {
- int s;
- FbBits depthMask;
-
- mask = FbFullMask(pDrawable->bitsPerPixel);
- depthMask = FbFullMask(pDrawable->depth);
-
- pPriv->fg = pGC->fgPixel & mask;
- pPriv->bg = pGC->bgPixel & mask;
-
- if ((pGC->planemask & depthMask) == depthMask)
- pPriv->pm = mask;
- else
- pPriv->pm = pGC->planemask & mask;
-
- s = pDrawable->bitsPerPixel;
- while (s < FB_UNIT)
- {
- pPriv->fg |= pPriv->fg << s;
- pPriv->bg |= pPriv->bg << s;
- pPriv->pm |= pPriv->pm << s;
- s <<= 1;
- }
- pPriv->and = fbAnd(pGC->alu, pPriv->fg, pPriv->pm);
- pPriv->xor = fbXor(pGC->alu, pPriv->fg, pPriv->pm);
- pPriv->bgand = fbAnd(pGC->alu, pPriv->bg, pPriv->pm);
- pPriv->bgxor = fbXor(pGC->alu, pPriv->bg, pPriv->pm);
+ if (changes & (GCForeground | GCBackground | GCPlaneMask | GCFunction)) {
+ int s;
+ FbBits depthMask;
+
+ mask = FbFullMask(pDrawable->bitsPerPixel);
+ depthMask = FbFullMask(pDrawable->depth);
+
+ pPriv->fg = pGC->fgPixel & mask;
+ pPriv->bg = pGC->bgPixel & mask;
+
+ if ((pGC->planemask & depthMask) == depthMask)
+ pPriv->pm = mask;
+ else
+ pPriv->pm = pGC->planemask & mask;
+
+ s = pDrawable->bitsPerPixel;
+ while (s < FB_UNIT) {
+ pPriv->fg |= pPriv->fg << s;
+ pPriv->bg |= pPriv->bg << s;
+ pPriv->pm |= pPriv->pm << s;
+ s <<= 1;
+ }
+ pPriv->and = fbAnd(pGC->alu, pPriv->fg, pPriv->pm);
+ pPriv->xor = fbXor(pGC->alu, pPriv->fg, pPriv->pm);
+ pPriv->bgand = fbAnd(pGC->alu, pPriv->bg, pPriv->pm);
+ pPriv->bgxor = fbXor(pGC->alu, pPriv->bg, pPriv->pm);
}
- if (changes & GCDashList)
- {
- unsigned short n = pGC->numInDashList;
- unsigned char *dash = pGC->dash;
- unsigned int dashLength = 0;
-
- while (n--)
- dashLength += (unsigned int ) *dash++;
- pPriv->dashLength = dashLength;
+ if (changes & GCDashList) {
+ unsigned short n = pGC->numInDashList;
+ unsigned char *dash = pGC->dash;
+ unsigned int dashLength = 0;
+
+ while (n--)
+ dashLength += (unsigned int) *dash++;
+ pPriv->dashLength = dashLength;
}
}
diff --git a/fb/fbgetsp.c b/fb/fbgetsp.c
index bf9f51eb4..9a163b27e 100644
--- a/fb/fbgetsp.c
+++ b/fb/fbgetsp.c
@@ -27,59 +27,44 @@
#include "fb.h"
void
-fbGetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart)
+fbGetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart)
{
- FbBits *src, *dst;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- int xoff;
-
+ FbBits *src, *dst;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ int xoff;
+
/*
* XFree86 DDX empties the root borderClip when the VT is
* switched away; this checks for that case
*/
if (!fbDrawableEnabled(pDrawable))
- return;
-
- if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth))
- {
- fb24_32GetSpans (pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
- return;
- }
-
- fbGetDrawable (pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
-
- while (nspans--)
- {
- xoff = (int) (((long) pchardstStart) & (FB_MASK >> 3));
- dst = (FbBits *) (pchardstStart - xoff);
- xoff <<= 3;
- fbBlt (src + (ppt->y + srcYoff) * srcStride, srcStride,
- (ppt->x + srcXoff) * srcBpp,
-
- dst,
- 1,
- xoff,
+ return;
- *pwidth * srcBpp,
- 1,
+ if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
+ fb24_32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
+ return;
+ }
- GXcopy,
- FB_ALLONES,
- srcBpp,
+ fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- FALSE,
- FALSE);
- pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
+ while (nspans--) {
+ xoff = (int) (((long) pchardstStart) & (FB_MASK >> 3));
+ dst = (FbBits *) (pchardstStart - xoff);
+ xoff <<= 3;
+ fbBlt(src + (ppt->y + srcYoff) * srcStride, srcStride,
+ (ppt->x + srcXoff) * srcBpp,
+ dst,
+ 1,
+ xoff,
+ *pwidth * srcBpp, 1, GXcopy, FB_ALLONES, srcBpp, FALSE, FALSE);
+ pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
diff --git a/fb/fbglyph.c b/fb/fbglyph.c
index 643cf909f..3080a7728 100644
--- a/fb/fbglyph.c
+++ b/fb/fbglyph.c
@@ -30,26 +30,22 @@
#include "dixfontstr.h"
Bool
-fbGlyphIn (RegionPtr pRegion,
- int x,
- int y,
- int width,
- int height)
+fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height)
{
- BoxRec box;
- BoxPtr pExtents = RegionExtents(pRegion);
+ BoxRec box;
+ BoxPtr pExtents = RegionExtents(pRegion);
/*
* Check extents by hand to avoid 16 bit overflows
*/
- if (x < (int) pExtents->x1)
- return FALSE;
- if ((int) pExtents->x2 < x + width)
- return FALSE;
+ if (x < (int) pExtents->x1)
+ return FALSE;
+ if ((int) pExtents->x2 < x + width)
+ return FALSE;
if (y < (int) pExtents->y1)
- return FALSE;
+ return FALSE;
if ((int) pExtents->y2 < y + height)
- return FALSE;
+ return FALSE;
box.x1 = x;
box.x2 = x + width;
box.y1 = y;
@@ -57,7 +53,6 @@ fbGlyphIn (RegionPtr pRegion,
return RegionContainsRect(pRegion, &box) == rgnIN;
}
-
#define WRITE1(d,n,fg) WRITE((d) + (n), (CARD8) fg)
#define WRITE2(d,n,fg) WRITE((CARD16 *) &(d[n]), (CARD16) fg)
#define WRITE4(d,n,fg) WRITE((CARD32 *) &(d[n]), (CARD32) fg)
@@ -66,7 +61,7 @@ fbGlyphIn (RegionPtr pRegion,
#else
#define WRITE8(d) WRITE4(d,0,_ABCA), WRITE4(d,4,_BCAB)
#endif
-
+
/*
* This is a bit tricky, but it's brief. Write 12 bytes worth
* of dest, which is four pixels, at a time. This gives constant
@@ -126,336 +121,296 @@ fbGlyphIn (RegionPtr pRegion,
#endif
void
-fbGlyph24 (FbBits *dstBits,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int x,
- int height)
+fbGlyph24(FbBits * dstBits,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int x, int height)
{
- int lshift;
- FbStip bits;
- CARD8 *dstLine;
- CARD8 *dst;
- FbStip f0, f1, f2;
- int n;
- int shift;
+ int lshift;
+ FbStip bits;
+ CARD8 *dstLine;
+ CARD8 *dst;
+ FbStip f0, f1, f2;
+ int n;
+ int shift;
f0 = fg;
- f1 = FbRot24(f0,16);
- f2 = FbRot24(f0,8);
-
+ f1 = FbRot24(f0, 16);
+ f2 = FbRot24(f0, 8);
+
dstLine = (CARD8 *) dstBits;
dstLine += (x & ~3) * 3;
- dstStride *= (sizeof (FbBits) / sizeof (CARD8));
+ dstStride *= (sizeof(FbBits) / sizeof(CARD8));
shift = x & 3;
lshift = 4 - shift;
- while (height--)
- {
- bits = READ(stipple++);
- n = lshift;
- dst = dstLine;
- while (bits)
- {
- switch (FbStipMoveLsb (FbLeftStipBits (bits, n), 4, n)) {
- case CASE(0,0,0,0):
- break;
- case CASE(1,0,0,0):
- WRITE2(dst,0,_AB);
- WRITE1(dst,2,_C);
- break;
- case CASE(0,1,0,0):
- WRITE1(dst,3,_A);
- WRITE2(dst,4,_BC);
- break;
- case CASE(1,1,0,0):
- WRITE4(dst,0,_ABCA);
- WRITE2(dst,4,_BC);
- break;
- case CASE(0,0,1,0):
- WRITE2(dst,6,_AB);
- WRITE1(dst,8,_C);
- break;
- case CASE(1,0,1,0):
- WRITE2(dst,0,_AB);
- WRITE1(dst,2,_C);
-
- WRITE2(dst,6,_AB);
- WRITE1(dst,8,_C);
- break;
- case CASE(0,1,1,0):
- WRITE1(dst,3,_A);
- WRITE4(dst,4,_BCAB);
- WRITE1(dst,8,_C);
- break;
- case CASE(1,1,1,0):
- WRITE8(dst);
- WRITE1(dst,8,_C);
- break;
- case CASE(0,0,0,1):
- WRITE1(dst,9,_A);
- WRITE2(dst,10,_BC);
- break;
- case CASE(1,0,0,1):
- WRITE2(dst,0,_AB);
- WRITE1(dst,2,_C);
-
- WRITE1(dst,9,_A);
- WRITE2(dst,10,_BC);
- break;
- case CASE(0,1,0,1):
- WRITE1(dst,3,_A);
- WRITE2(dst,4,_BC);
-
- WRITE1(dst,9,_A);
- WRITE2(dst,10,_BC);
- break;
- case CASE(1,1,0,1):
- WRITE4(dst,0,_ABCA);
- WRITE2(dst,4,_BC);
-
- WRITE1(dst,9,_A);
- WRITE2(dst,10,_BC);
- break;
- case CASE(0,0,1,1):
- WRITE2(dst,6,_AB);
- WRITE4(dst,8,_CABC);
- break;
- case CASE(1,0,1,1):
- WRITE2(dst,0,_AB);
- WRITE1(dst,2,_C);
-
- WRITE2(dst,6,_AB);
- WRITE4(dst,8,_CABC);
- break;
- case CASE(0,1,1,1):
- WRITE1(dst,3,_A);
- WRITE4(dst,4,_BCAB);
- WRITE4(dst,8,_CABC);
- break;
- case CASE(1,1,1,1):
- WRITE8(dst);
- WRITE4(dst,8,_CABC);
- break;
- }
- bits = FbStipLeft (bits, n);
- n = 4;
- dst += 12;
- }
- dstLine += dstStride;
+ while (height--) {
+ bits = READ(stipple++);
+ n = lshift;
+ dst = dstLine;
+ while (bits) {
+ switch (FbStipMoveLsb(FbLeftStipBits(bits, n), 4, n)) {
+ case CASE(0, 0, 0, 0):
+ break;
+ case CASE(1, 0, 0, 0):
+ WRITE2(dst, 0, _AB);
+ WRITE1(dst, 2, _C);
+ break;
+ case CASE(0, 1, 0, 0):
+ WRITE1(dst, 3, _A);
+ WRITE2(dst, 4, _BC);
+ break;
+ case CASE(1, 1, 0, 0):
+ WRITE4(dst, 0, _ABCA);
+ WRITE2(dst, 4, _BC);
+ break;
+ case CASE(0, 0, 1, 0):
+ WRITE2(dst, 6, _AB);
+ WRITE1(dst, 8, _C);
+ break;
+ case CASE(1, 0, 1, 0):
+ WRITE2(dst, 0, _AB);
+ WRITE1(dst, 2, _C);
+
+ WRITE2(dst, 6, _AB);
+ WRITE1(dst, 8, _C);
+ break;
+ case CASE(0, 1, 1, 0):
+ WRITE1(dst, 3, _A);
+ WRITE4(dst, 4, _BCAB);
+ WRITE1(dst, 8, _C);
+ break;
+ case CASE(1, 1, 1, 0):
+ WRITE8(dst);
+ WRITE1(dst, 8, _C);
+ break;
+ case CASE(0, 0, 0, 1):
+ WRITE1(dst, 9, _A);
+ WRITE2(dst, 10, _BC);
+ break;
+ case CASE(1, 0, 0, 1):
+ WRITE2(dst, 0, _AB);
+ WRITE1(dst, 2, _C);
+
+ WRITE1(dst, 9, _A);
+ WRITE2(dst, 10, _BC);
+ break;
+ case CASE(0, 1, 0, 1):
+ WRITE1(dst, 3, _A);
+ WRITE2(dst, 4, _BC);
+
+ WRITE1(dst, 9, _A);
+ WRITE2(dst, 10, _BC);
+ break;
+ case CASE(1, 1, 0, 1):
+ WRITE4(dst, 0, _ABCA);
+ WRITE2(dst, 4, _BC);
+
+ WRITE1(dst, 9, _A);
+ WRITE2(dst, 10, _BC);
+ break;
+ case CASE(0, 0, 1, 1):
+ WRITE2(dst, 6, _AB);
+ WRITE4(dst, 8, _CABC);
+ break;
+ case CASE(1, 0, 1, 1):
+ WRITE2(dst, 0, _AB);
+ WRITE1(dst, 2, _C);
+
+ WRITE2(dst, 6, _AB);
+ WRITE4(dst, 8, _CABC);
+ break;
+ case CASE(0, 1, 1, 1):
+ WRITE1(dst, 3, _A);
+ WRITE4(dst, 4, _BCAB);
+ WRITE4(dst, 8, _CABC);
+ break;
+ case CASE(1, 1, 1, 1):
+ WRITE8(dst);
+ WRITE4(dst, 8, _CABC);
+ break;
+ }
+ bits = FbStipLeft(bits, n);
+ n = 4;
+ dst += 12;
+ }
+ dstLine += dstStride;
}
}
void
-fbPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
+fbPolyGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- CharInfoPtr pci;
- unsigned char *pglyph; /* pointer bits in glyph */
- int gx, gy;
- int gWidth, gHeight; /* width and height of glyph */
- FbStride gStride; /* stride of glyph */
- void (*glyph) (FbBits *,
- FbStride,
- int,
- FbStip *,
- FbBits,
- int,
- int);
- FbBits *dst = 0;
- FbStride dstStride = 0;
- int dstBpp = 0;
- int dstXoff = 0, dstYoff = 0;
-
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ CharInfoPtr pci;
+ unsigned char *pglyph; /* pointer bits in glyph */
+ int gx, gy;
+ int gWidth, gHeight; /* width and height of glyph */
+ FbStride gStride; /* stride of glyph */
+ void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int);
+ FbBits *dst = 0;
+ FbStride dstStride = 0;
+ int dstBpp = 0;
+ int dstXoff = 0, dstYoff = 0;
+
glyph = 0;
- if (pGC->fillStyle == FillSolid && pPriv->and == 0)
- {
- dstBpp = pDrawable->bitsPerPixel;
- switch (dstBpp) {
- case 8: glyph = fbGlyph8; break;
- case 16: glyph = fbGlyph16; break;
- case 24: glyph = fbGlyph24; break;
- case 32: glyph = fbGlyph32; break;
- }
+ if (pGC->fillStyle == FillSolid && pPriv->and == 0) {
+ dstBpp = pDrawable->bitsPerPixel;
+ switch (dstBpp) {
+ case 8:
+ glyph = fbGlyph8;
+ break;
+ case 16:
+ glyph = fbGlyph16;
+ break;
+ case 24:
+ glyph = fbGlyph24;
+ break;
+ case 32:
+ glyph = fbGlyph32;
+ break;
+ }
}
x += pDrawable->x;
y += pDrawable->y;
- while (nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = y - pci->metrics.ascent;
- if (glyph && gWidth <= sizeof (FbStip) * 8 &&
- fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
- {
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- (*glyph) (dst + (gy + dstYoff) * dstStride,
- dstStride,
- dstBpp,
- (FbStip *) pglyph,
- pPriv->xor,
- gx + dstXoff,
- gHeight);
- fbFinishAccess (pDrawable);
- }
- else
- {
- gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
- fbPushImage (pDrawable,
- pGC,
-
- (FbStip *) pglyph,
- gStride,
- 0,
-
- gx,
- gy,
- gWidth, gHeight);
- }
- }
- x += pci->metrics.characterWidth;
+ while (nglyph--) {
+ pci = *ppci++;
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ gWidth = GLYPHWIDTHPIXELS(pci);
+ gHeight = GLYPHHEIGHTPIXELS(pci);
+ if (gWidth && gHeight) {
+ gx = x + pci->metrics.leftSideBearing;
+ gy = y - pci->metrics.ascent;
+ if (glyph && gWidth <= sizeof(FbStip) * 8 &&
+ fbGlyphIn(fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) {
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff,
+ dstYoff);
+ (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp,
+ (FbStip *) pglyph, pPriv->xor, gx + dstXoff, gHeight);
+ fbFinishAccess(pDrawable);
+ }
+ else {
+ gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof(FbStip);
+ fbPushImage(pDrawable,
+ pGC,
+ (FbStip *) pglyph,
+ gStride, 0, gx, gy, gWidth, gHeight);
+ }
+ }
+ x += pci->metrics.characterWidth;
}
}
-
void
-fbImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
+fbImageGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppciInit, pointer pglyphBase)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- CharInfoPtr *ppci;
- CharInfoPtr pci;
- unsigned char *pglyph; /* pointer bits in glyph */
- int gWidth, gHeight; /* width and height of glyph */
- FbStride gStride; /* stride of glyph */
- Bool opaque;
- int n;
- int gx, gy;
- void (*glyph) (FbBits *,
- FbStride,
- int,
- FbStip *,
- FbBits,
- int,
- int);
- FbBits *dst = 0;
- FbStride dstStride = 0;
- int dstBpp = 0;
- int dstXoff = 0, dstYoff = 0;
-
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ CharInfoPtr *ppci;
+ CharInfoPtr pci;
+ unsigned char *pglyph; /* pointer bits in glyph */
+ int gWidth, gHeight; /* width and height of glyph */
+ FbStride gStride; /* stride of glyph */
+ Bool opaque;
+ int n;
+ int gx, gy;
+ void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int);
+ FbBits *dst = 0;
+ FbStride dstStride = 0;
+ int dstBpp = 0;
+ int dstXoff = 0, dstYoff = 0;
+
glyph = 0;
- if (pPriv->and == 0)
- {
- dstBpp = pDrawable->bitsPerPixel;
- switch (dstBpp) {
- case 8: glyph = fbGlyph8; break;
- case 16: glyph = fbGlyph16; break;
- case 24: glyph = fbGlyph24; break;
- case 32: glyph = fbGlyph32; break;
- }
+ if (pPriv->and == 0) {
+ dstBpp = pDrawable->bitsPerPixel;
+ switch (dstBpp) {
+ case 8:
+ glyph = fbGlyph8;
+ break;
+ case 16:
+ glyph = fbGlyph16;
+ break;
+ case 24:
+ glyph = fbGlyph24;
+ break;
+ case 32:
+ glyph = fbGlyph32;
+ break;
+ }
}
-
+
x += pDrawable->x;
y += pDrawable->y;
- if (TERMINALFONT (pGC->font)
- && !glyph
- )
- {
- opaque = TRUE;
+ if (TERMINALFONT(pGC->font)
+ && !glyph) {
+ opaque = TRUE;
}
- else
- {
- int xBack, widthBack;
- int yBack, heightBack;
-
- ppci = ppciInit;
- n = nglyph;
- widthBack = 0;
- while (n--)
- widthBack += (*ppci++)->metrics.characterWidth;
-
+ else {
+ int xBack, widthBack;
+ int yBack, heightBack;
+
+ ppci = ppciInit;
+ n = nglyph;
+ widthBack = 0;
+ while (n--)
+ widthBack += (*ppci++)->metrics.characterWidth;
+
xBack = x;
- if (widthBack < 0)
- {
- xBack += widthBack;
- widthBack = -widthBack;
- }
- yBack = y - FONTASCENT(pGC->font);
- heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- fbSolidBoxClipped (pDrawable,
- fbGetCompositeClip(pGC),
- xBack,
- yBack,
- xBack + widthBack,
- yBack + heightBack,
- fbAnd(GXcopy,pPriv->bg,pPriv->pm),
- fbXor(GXcopy,pPriv->bg,pPriv->pm));
- opaque = FALSE;
+ if (widthBack < 0) {
+ xBack += widthBack;
+ widthBack = -widthBack;
+ }
+ yBack = y - FONTASCENT(pGC->font);
+ heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
+ fbSolidBoxClipped(pDrawable,
+ fbGetCompositeClip(pGC),
+ xBack,
+ yBack,
+ xBack + widthBack,
+ yBack + heightBack,
+ fbAnd(GXcopy, pPriv->bg, pPriv->pm),
+ fbXor(GXcopy, pPriv->bg, pPriv->pm));
+ opaque = FALSE;
}
ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = y - pci->metrics.ascent;
- if (glyph && gWidth <= sizeof (FbStip) * 8 &&
- fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
- {
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- (*glyph) (dst + (gy + dstYoff) * dstStride,
- dstStride,
- dstBpp,
- (FbStip *) pglyph,
- pPriv->fg,
- gx + dstXoff,
- gHeight);
- fbFinishAccess (pDrawable);
- }
- else
- {
- gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- pPriv->fg,
- pPriv->bg,
- pPriv->pm,
- GXcopy,
- opaque,
-
- gx,
- gy,
- gWidth, gHeight,
-
- (FbStip *) pglyph,
- gStride,
- 0);
- }
- }
- x += pci->metrics.characterWidth;
+ while (nglyph--) {
+ pci = *ppci++;
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ gWidth = GLYPHWIDTHPIXELS(pci);
+ gHeight = GLYPHHEIGHTPIXELS(pci);
+ if (gWidth && gHeight) {
+ gx = x + pci->metrics.leftSideBearing;
+ gy = y - pci->metrics.ascent;
+ if (glyph && gWidth <= sizeof(FbStip) * 8 &&
+ fbGlyphIn(fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) {
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff,
+ dstYoff);
+ (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp,
+ (FbStip *) pglyph, pPriv->fg, gx + dstXoff, gHeight);
+ fbFinishAccess(pDrawable);
+ }
+ else {
+ gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof(FbStip);
+ fbPutXYImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ pPriv->fg,
+ pPriv->bg,
+ pPriv->pm,
+ GXcopy,
+ opaque,
+ gx,
+ gy,
+ gWidth, gHeight, (FbStip *) pglyph, gStride, 0);
+ }
+ }
+ x += pci->metrics.characterWidth;
}
}
diff --git a/fb/fbimage.c b/fb/fbimage.c
index 63978cc3b..59daa21bb 100644
--- a/fb/fbimage.c
+++ b/fb/fbimage.c
@@ -29,336 +29,250 @@
#include "fb.h"
void
-fbPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage)
+fbPutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- unsigned long i;
- FbStride srcStride;
- FbStip *src = (FbStip *) pImage;
-
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ unsigned long i;
+ FbStride srcStride;
+ FbStip *src = (FbStip *) pImage;
+
x += pDrawable->x;
y += pDrawable->y;
-
- switch (format)
- {
+
+ switch (format) {
case XYBitmap:
- srcStride = BitmapBytePad(w + leftPad) / sizeof (FbStip);
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- pPriv->fg,
- pPriv->bg,
- pPriv->pm,
- pGC->alu,
- TRUE,
- x, y, w, h,
- src,
- srcStride,
- leftPad);
- break;
+ srcStride = BitmapBytePad(w + leftPad) / sizeof(FbStip);
+ fbPutXYImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ pPriv->fg,
+ pPriv->bg,
+ pPriv->pm,
+ pGC->alu, TRUE, x, y, w, h, src, srcStride, leftPad);
+ break;
case XYPixmap:
- srcStride = BitmapBytePad(w + leftPad) / sizeof (FbStip);
- for (i = (unsigned long)1 << (pDrawable->depth - 1); i; i >>= 1)
- {
- if (i & pGC->planemask)
- {
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- FB_ALLONES,
- 0,
- fbReplicatePixel (i, pDrawable->bitsPerPixel),
- pGC->alu,
- TRUE,
- x, y, w, h,
- src,
- srcStride,
- leftPad);
- src += srcStride * h;
- }
- }
- break;
+ srcStride = BitmapBytePad(w + leftPad) / sizeof(FbStip);
+ for (i = (unsigned long) 1 << (pDrawable->depth - 1); i; i >>= 1) {
+ if (i & pGC->planemask) {
+ fbPutXYImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ FB_ALLONES,
+ 0,
+ fbReplicatePixel(i, pDrawable->bitsPerPixel),
+ pGC->alu,
+ TRUE, x, y, w, h, src, srcStride, leftPad);
+ src += srcStride * h;
+ }
+ }
+ break;
case ZPixmap:
- if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth))
- {
- srcStride = PixmapBytePad(w, pDrawable->depth);
- fb24_32PutZImage (pDrawable,
- fbGetCompositeClip(pGC),
- pGC->alu,
- (FbBits) pGC->planemask,
- x, y, w, h,
- (CARD8 *) pImage,
- srcStride);
- }
- else
- {
- srcStride = PixmapBytePad(w, pDrawable->depth) / sizeof (FbStip);
- fbPutZImage (pDrawable,
- fbGetCompositeClip(pGC),
- pGC->alu,
- pPriv->pm,
- x, y, w, h,
- src, srcStride);
- }
+ if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
+ srcStride = PixmapBytePad(w, pDrawable->depth);
+ fb24_32PutZImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ pGC->alu,
+ (FbBits) pGC->planemask,
+ x, y, w, h, (CARD8 *) pImage, srcStride);
+ }
+ else {
+ srcStride = PixmapBytePad(w, pDrawable->depth) / sizeof(FbStip);
+ fbPutZImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ pGC->alu, pPriv->pm, x, y, w, h, src, srcStride);
+ }
}
}
void
-fbPutZImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- int alu,
- FbBits pm,
- int x,
- int y,
- int width,
- int height,
- FbStip *src,
- FbStride srcStride)
+fbPutZImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y, int width, int height, FbStip * src, FbStride srcStride)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int nbox;
- BoxPtr pbox;
- int x1, y1, x2, y2;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ 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;
- fbBltStip (src + (y1 - y) * srcStride,
- srcStride,
- (x1 - x) * dstBpp,
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- dst + (y1 + dstYoff) * dstStride,
- dstStride,
- (x1 + dstXoff) * dstBpp,
-
- (x2 - x1) * dstBpp,
- (y2 - y1),
-
- alu,
- pm,
- dstBpp);
+ 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;
+ fbBltStip(src + (y1 - y) * srcStride,
+ srcStride,
+ (x1 - x) * dstBpp,
+ dst + (y1 + dstYoff) * dstStride,
+ dstStride,
+ (x1 + dstXoff) * dstBpp,
+ (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
-
-void
-fbPutXYImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- FbBits fg,
- FbBits bg,
- FbBits pm,
- int alu,
- Bool opaque,
-
- int x,
- int y,
- int width,
- int height,
- FbStip *src,
- FbStride srcStride,
- int srcX)
+void
+fbPutXYImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ FbBits fg,
+ FbBits bg,
+ FbBits pm,
+ int alu,
+ Bool opaque,
+ int x,
+ int y,
+ int width, int height, FbStip * src, FbStride srcStride, int srcX)
{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int nbox;
- BoxPtr pbox;
- int x1, y1, x2, y2;
- FbBits fgand = 0, fgxor = 0, bgand = 0, bgxor = 0;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int nbox;
+ BoxPtr pbox;
+ int x1, y1, x2, y2;
+ FbBits fgand = 0, fgxor = 0, bgand = 0, bgxor = 0;
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- if (dstBpp == 1)
- {
- if (opaque)
- alu = FbOpaqueStipple1Rop(alu,fg,bg);
- else
- alu = FbStipple1Rop(alu,fg);
+ if (dstBpp == 1) {
+ if (opaque)
+ alu = FbOpaqueStipple1Rop(alu, fg, bg);
+ else
+ alu = FbStipple1Rop(alu, fg);
}
- else
- {
- fgand = fbAnd(alu,fg,pm);
- fgxor = fbXor(alu,fg,pm);
- if (opaque)
- {
- bgand = fbAnd(alu,bg,pm);
- bgxor = fbXor(alu,bg,pm);
- }
- else
- {
- bgand = fbAnd(GXnoop,(FbBits)0,FB_ALLONES);
- bgxor = fbXor(GXnoop,(FbBits)0,FB_ALLONES);
- }
+ else {
+ fgand = fbAnd(alu, fg, pm);
+ fgxor = fbXor(alu, fg, pm);
+ if (opaque) {
+ bgand = fbAnd(alu, bg, pm);
+ bgxor = fbXor(alu, bg, pm);
+ }
+ else {
+ bgand = fbAnd(GXnoop, (FbBits) 0, FB_ALLONES);
+ bgxor = fbXor(GXnoop, (FbBits) 0, FB_ALLONES);
+ }
}
- 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;
- if (dstBpp == 1)
- {
- fbBltStip (src + (y1 - y) * srcStride,
- srcStride,
- (x1 - x) + srcX,
-
- (FbStip *) (dst + (y1 + dstYoff) * dstStride),
- FbBitsStrideToStipStride(dstStride),
- (x1 + dstXoff) * dstBpp,
-
- (x2 - x1) * dstBpp,
- (y2 - y1),
-
- alu,
- pm,
- dstBpp);
- }
- else
- {
- fbBltOne (src + (y1 - y) * srcStride,
- srcStride,
- (x1 - x) + srcX,
-
- dst + (y1 + dstYoff) * dstStride,
- dstStride,
- (x1 + dstXoff) * dstBpp,
- dstBpp,
-
- (x2 - x1) * dstBpp,
- (y2 - y1),
-
- fgand, fgxor, bgand, bgxor);
- }
+ 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;
+ if (dstBpp == 1) {
+ fbBltStip(src + (y1 - y) * srcStride,
+ srcStride,
+ (x1 - x) + srcX,
+ (FbStip *) (dst + (y1 + dstYoff) * dstStride),
+ FbBitsStrideToStipStride(dstStride),
+ (x1 + dstXoff) * dstBpp,
+ (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp);
+ }
+ else {
+ fbBltOne(src + (y1 - y) * srcStride,
+ srcStride,
+ (x1 - x) + srcX,
+ dst + (y1 + dstYoff) * dstStride,
+ dstStride,
+ (x1 + dstXoff) * dstBpp,
+ dstBpp,
+ (x2 - x1) * dstBpp, (y2 - y1), fgand, fgxor, bgand, bgxor);
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbGetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d)
+fbGetImage(DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w, int h, unsigned int format, unsigned long planeMask, char *d)
{
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbStip *dst;
- FbStride dstStride;
-
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbStip *dst;
+ FbStride dstStride;
+
/*
* XFree86 DDX empties the root borderClip when the VT is
* switched away; this checks for that case
*/
if (!fbDrawableEnabled(pDrawable))
- return;
-
+ return;
+
if (format == ZPixmap &&
- pDrawable->bitsPerPixel != BitsPerPixel (pDrawable->depth))
- {
- fb24_32GetImage (pDrawable, x, y, w, h, format, planeMask, d);
- return;
+ pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
+ fb24_32GetImage(pDrawable, x, y, w, h, format, planeMask, d);
+ return;
}
-
- fbGetDrawable (pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
-
+
+ fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
+
x += pDrawable->x;
y += pDrawable->y;
-
- dst = (FbStip *) d;
- if (format == ZPixmap || srcBpp == 1)
- {
- FbBits pm;
- pm = fbReplicatePixel (planeMask, srcBpp);
- dstStride = PixmapBytePad(w, pDrawable->depth);
- if (pm != FB_ALLONES)
- memset (d, 0, dstStride * h);
- dstStride /= sizeof (FbStip);
- fbBltStip ((FbStip *) (src + (y + srcYoff) * srcStride),
- FbBitsStrideToStipStride(srcStride),
- (x + srcXoff) * srcBpp,
-
- dst,
- dstStride,
- 0,
-
- w * srcBpp, h,
+ dst = (FbStip *) d;
+ if (format == ZPixmap || srcBpp == 1) {
+ FbBits pm;
- GXcopy,
- pm,
- srcBpp);
+ pm = fbReplicatePixel(planeMask, srcBpp);
+ dstStride = PixmapBytePad(w, pDrawable->depth);
+ if (pm != FB_ALLONES)
+ memset(d, 0, dstStride * h);
+ dstStride /= sizeof(FbStip);
+ fbBltStip((FbStip *) (src + (y + srcYoff) * srcStride),
+ FbBitsStrideToStipStride(srcStride),
+ (x + srcXoff) * srcBpp,
+ dst, dstStride, 0, w * srcBpp, h, GXcopy, pm, srcBpp);
}
- else
- {
- dstStride = BitmapBytePad(w) / sizeof (FbStip);
- fbBltPlane (src + (y + srcYoff) * srcStride,
- srcStride,
- (x + srcXoff) * srcBpp,
- srcBpp,
-
- dst,
- dstStride,
- 0,
-
- w * srcBpp, h,
-
- fbAndStip(GXcopy,FB_STIP_ALLONES,FB_STIP_ALLONES),
- fbXorStip(GXcopy,FB_STIP_ALLONES,FB_STIP_ALLONES),
- fbAndStip(GXcopy,0,FB_STIP_ALLONES),
- fbXorStip(GXcopy,0,FB_STIP_ALLONES),
- planeMask);
+ else {
+ dstStride = BitmapBytePad(w) / sizeof(FbStip);
+ fbBltPlane(src + (y + srcYoff) * srcStride,
+ srcStride,
+ (x + srcXoff) * srcBpp,
+ srcBpp,
+ dst,
+ dstStride,
+ 0,
+ w * srcBpp, h,
+ fbAndStip(GXcopy, FB_STIP_ALLONES, FB_STIP_ALLONES),
+ fbXorStip(GXcopy, FB_STIP_ALLONES, FB_STIP_ALLONES),
+ fbAndStip(GXcopy, 0, FB_STIP_ALLONES),
+ fbXorStip(GXcopy, 0, FB_STIP_ALLONES), planeMask);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
diff --git a/fb/fbline.c b/fb/fbline.c
index e290bf886..80dc89dde 100644
--- a/fb/fbline.c
+++ b/fb/fbline.c
@@ -27,141 +27,129 @@
#include "fb.h"
void
-fbZeroLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
+fbZeroLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
{
- int x1, y1, x2, y2;
- int x, y;
- int dashOffset;
+ int x1, y1, x2, y2;
+ int x, y;
+ int dashOffset;
x = pDrawable->x;
y = pDrawable->y;
x1 = ppt->x;
y1 = ppt->y;
dashOffset = pGC->dashOffset;
- while (--npt)
- {
- ++ppt;
- x2 = ppt->x;
- y2 = ppt->y;
- if (mode == CoordModePrevious)
- {
- x2 += x1;
- y2 += y1;
- }
- fbSegment (pDrawable, pGC, x1 + x, y1 + y,
- x2 + x, y2 + y,
- npt == 1 && pGC->capStyle != CapNotLast,
- &dashOffset);
- x1 = x2;
- y1 = y2;
+ while (--npt) {
+ ++ppt;
+ x2 = ppt->x;
+ y2 = ppt->y;
+ if (mode == CoordModePrevious) {
+ x2 += x1;
+ y2 += y1;
+ }
+ fbSegment(pDrawable, pGC, x1 + x, y1 + y,
+ x2 + x, y2 + y,
+ npt == 1 && pGC->capStyle != CapNotLast, &dashOffset);
+ x1 = x2;
+ y1 = y2;
}
}
void
-fbZeroSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSegs)
+fbZeroSegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs)
{
- int dashOffset;
- int x, y;
- Bool drawLast = pGC->capStyle != CapNotLast;
-
+ int dashOffset;
+ int x, y;
+ Bool drawLast = pGC->capStyle != CapNotLast;
+
x = pDrawable->x;
y = pDrawable->y;
- while (nseg--)
- {
- dashOffset = pGC->dashOffset;
- fbSegment (pDrawable, pGC,
- pSegs->x1 + x, pSegs->y1 + y,
- pSegs->x2 + x, pSegs->y2 + y,
- drawLast,
- &dashOffset);
- pSegs++;
+ while (nseg--) {
+ dashOffset = pGC->dashOffset;
+ fbSegment(pDrawable, pGC,
+ pSegs->x1 + x, pSegs->y1 + y,
+ pSegs->x2 + x, pSegs->y2 + y, drawLast, &dashOffset);
+ pSegs++;
}
}
void
-fbFixCoordModePrevious (int npt,
- DDXPointPtr ppt)
+fbFixCoordModePrevious(int npt, DDXPointPtr ppt)
{
- int x, y;
+ int x, y;
x = ppt->x;
y = ppt->y;
npt--;
- while (npt--)
- {
- ppt++;
- x = (ppt->x += x);
- y = (ppt->y += y);
+ while (npt--) {
+ ppt++;
+ x = (ppt->x += x);
+ y = (ppt->y += y);
}
}
void
-fbPolyLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
+fbPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
{
- void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt);
-
- if (pGC->lineWidth == 0)
- {
- line = fbZeroLine;
- if (pGC->fillStyle == FillSolid &&
- pGC->lineStyle == LineSolid &&
- RegionNumRects (fbGetCompositeClip(pGC)) == 1)
- {
- switch (pDrawable->bitsPerPixel) {
- case 8: line = fbPolyline8; break;
- case 16: line = fbPolyline16; break;
- case 24: line = fbPolyline24; break;
- case 32: line = fbPolyline32; break;
- }
- }
+ void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt);
+
+ if (pGC->lineWidth == 0) {
+ line = fbZeroLine;
+ if (pGC->fillStyle == FillSolid &&
+ pGC->lineStyle == LineSolid &&
+ RegionNumRects(fbGetCompositeClip(pGC)) == 1) {
+ switch (pDrawable->bitsPerPixel) {
+ case 8:
+ line = fbPolyline8;
+ break;
+ case 16:
+ line = fbPolyline16;
+ break;
+ case 24:
+ line = fbPolyline24;
+ break;
+ case 32:
+ line = fbPolyline32;
+ break;
+ }
+ }
}
- else
- {
- if (pGC->lineStyle != LineSolid)
- line = miWideDash;
- else
- line = miWideLine;
+ else {
+ if (pGC->lineStyle != LineSolid)
+ line = miWideDash;
+ else
+ line = miWideLine;
}
(*line) (pDrawable, pGC, mode, npt, ppt);
}
void
-fbPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg)
+fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
{
- void (*seg) (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg);
+ void (*seg) (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
- if (pGC->lineWidth == 0)
- {
- seg = fbZeroSegment;
- if (pGC->fillStyle == FillSolid &&
- pGC->lineStyle == LineSolid &&
- RegionNumRects (fbGetCompositeClip(pGC)) == 1)
- {
- switch (pDrawable->bitsPerPixel) {
- case 8: seg = fbPolySegment8; break;
- case 16: seg = fbPolySegment16; break;
- case 24: seg = fbPolySegment24; break;
- case 32: seg = fbPolySegment32; break;
- }
- }
+ if (pGC->lineWidth == 0) {
+ seg = fbZeroSegment;
+ if (pGC->fillStyle == FillSolid &&
+ pGC->lineStyle == LineSolid &&
+ RegionNumRects(fbGetCompositeClip(pGC)) == 1) {
+ switch (pDrawable->bitsPerPixel) {
+ case 8:
+ seg = fbPolySegment8;
+ break;
+ case 16:
+ seg = fbPolySegment16;
+ break;
+ case 24:
+ seg = fbPolySegment24;
+ break;
+ case 32:
+ seg = fbPolySegment32;
+ break;
+ }
+ }
}
- else
- {
- seg = miPolySegment;
+ else {
+ seg = miPolySegment;
}
(*seg) (pDrawable, pGC, nseg, pseg);
}
diff --git a/fb/fboverlay.c b/fb/fboverlay.c
index 255cc23c1..998be66d9 100644
--- a/fb/fboverlay.c
+++ b/fb/fboverlay.c
@@ -22,7 +22,6 @@
* Author: Keith Packard, SuSE, Inc.
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -34,9 +33,11 @@
#include "shmint.h"
static DevPrivateKeyRec fbOverlayScreenPrivateKeyRec;
+
#define fbOverlayScreenPrivateKey (&fbOverlayScreenPrivateKeyRec)
-DevPrivateKey fbOverlayGetScreenPrivateKey(void)
+DevPrivateKey
+fbOverlayGetScreenPrivateKey(void)
{
return fbOverlayScreenPrivateKey;
}
@@ -48,49 +49,46 @@ DevPrivateKey fbOverlayGetScreenPrivateKey(void)
Bool
fbOverlayCreateWindow(WindowPtr pWin)
{
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen);
- int i;
- PixmapPtr pPixmap;
-
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen);
+ int i;
+ PixmapPtr pPixmap;
+
if (pWin->drawable.class != InputOutput)
- return TRUE;
+ return TRUE;
if (pWin->drawable.bitsPerPixel == 32)
- pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
-
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- pPixmap = pScrPriv->layer[i].u.run.pixmap;
- if (pWin->drawable.depth == pPixmap->drawable.depth)
- {
- dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap);
- /*
- * Make sure layer keys are written correctly by
- * having non-root layers set to full while the
- * root layer is set to empty. This will cause
- * all of the layers to get painted when the root
- * is mapped
- */
- if (!pWin->parent)
- {
- RegionEmpty(&pScrPriv->layer[i].u.run.region);
- }
- return TRUE;
- }
+ pWin->drawable.bitsPerPixel =
+ fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
+
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ pPixmap = pScrPriv->layer[i].u.run.pixmap;
+ if (pWin->drawable.depth == pPixmap->drawable.depth) {
+ dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap);
+ /*
+ * Make sure layer keys are written correctly by
+ * having non-root layers set to full while the
+ * root layer is set to empty. This will cause
+ * all of the layers to get painted when the root
+ * is mapped
+ */
+ if (!pWin->parent) {
+ RegionEmpty(&pScrPriv->layer[i].u.run.region);
+ }
+ return TRUE;
+ }
}
return FALSE;
}
Bool
-fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen)
+fbOverlayCloseScreen(int iScreen, ScreenPtr pScreen)
{
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- int i;
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ int i;
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- (*pScreen->DestroyPixmap)(pScrPriv->layer[i].u.run.pixmap);
- RegionUninit(&pScrPriv->layer[i].u.run.region);
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ (*pScreen->DestroyPixmap) (pScrPriv->layer[i].u.run.pixmap);
+ RegionUninit(&pScrPriv->layer[i].u.run.region);
}
return TRUE;
}
@@ -102,103 +100,90 @@ int
fbOverlayWindowLayer(WindowPtr pWin)
{
FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen);
- int i;
+ int i;
for (i = 0; i < pScrPriv->nlayers; i++)
- if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey()) ==
- (pointer) pScrPriv->layer[i].u.run.pixmap)
- return i;
+ if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey()) ==
+ (pointer) pScrPriv->layer[i].u.run.pixmap)
+ return i;
return 0;
}
Bool
fbOverlayCreateScreenResources(ScreenPtr pScreen)
{
- int i;
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- PixmapPtr pPixmap;
- pointer pbits;
- int width;
- int depth;
- BoxRec box;
-
+ int i;
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ PixmapPtr pPixmap;
+ pointer pbits;
+ int width;
+ int depth;
+ BoxRec box;
+
if (!miCreateScreenResources(pScreen))
- return FALSE;
+ return FALSE;
box.x1 = 0;
box.y1 = 0;
box.x2 = pScreen->width;
box.y2 = pScreen->height;
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- pbits = pScrPriv->layer[i].u.init.pbits;
- width = pScrPriv->layer[i].u.init.width;
- depth = pScrPriv->layer[i].u.init.depth;
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0);
- if (!pPixmap)
- return FALSE;
- if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
- pScreen->height, depth,
- BitsPerPixel(depth),
- PixmapBytePad(width, depth),
- pbits))
- return FALSE;
- pScrPriv->layer[i].u.run.pixmap = pPixmap;
- RegionInit(&pScrPriv->layer[i].u.run.region, &box, 0);
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ pbits = pScrPriv->layer[i].u.init.pbits;
+ width = pScrPriv->layer[i].u.init.width;
+ depth = pScrPriv->layer[i].u.init.depth;
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0);
+ if (!pPixmap)
+ return FALSE;
+ if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width,
+ pScreen->height, depth,
+ BitsPerPixel(depth),
+ PixmapBytePad(width, depth),
+ pbits))
+ return FALSE;
+ pScrPriv->layer[i].u.run.pixmap = pPixmap;
+ RegionInit(&pScrPriv->layer[i].u.run.region, &box, 0);
}
pScreen->devPrivate = pScrPriv->layer[0].u.run.pixmap;
return TRUE;
}
void
-fbOverlayPaintKey (DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer)
+fbOverlayPaintKey(DrawablePtr pDrawable,
+ RegionPtr pRegion, CARD32 pixel, int layer)
{
- fbFillRegionSolid (pDrawable, pRegion, 0,
- fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
+ fbFillRegionSolid(pDrawable, pRegion, 0,
+ fbReplicatePixel(pixel, pDrawable->bitsPerPixel));
}
/*
* Track visible region for each layer
*/
void
-fbOverlayUpdateLayerRegion (ScreenPtr pScreen,
- int layer,
- RegionPtr prgn)
+fbOverlayUpdateLayerRegion(ScreenPtr pScreen, int layer, RegionPtr prgn)
{
FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- int i;
- RegionRec rgnNew;
-
+ int i;
+ RegionRec rgnNew;
+
if (!prgn || !RegionNotEmpty(prgn))
- return;
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- if (i == layer)
- {
- /* add new piece to this fb */
- RegionUnion(&pScrPriv->layer[i].u.run.region,
- &pScrPriv->layer[i].u.run.region,
- prgn);
- }
- else if (RegionNotEmpty(&pScrPriv->layer[i].u.run.region))
- {
- /* paint new piece with chroma key */
- RegionNull(&rgnNew);
- RegionIntersect(&rgnNew, prgn,
- &pScrPriv->layer[i].u.run.region);
- (*pScrPriv->PaintKey) (&pScrPriv->layer[i].u.run.pixmap->drawable,
- &rgnNew,
- pScrPriv->layer[i].key,
- i);
- RegionUninit(&rgnNew);
- /* remove piece from other fbs */
- RegionSubtract(&pScrPriv->layer[i].u.run.region,
- &pScrPriv->layer[i].u.run.region,
- prgn);
- }
+ return;
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ if (i == layer) {
+ /* add new piece to this fb */
+ RegionUnion(&pScrPriv->layer[i].u.run.region,
+ &pScrPriv->layer[i].u.run.region, prgn);
+ }
+ else if (RegionNotEmpty(&pScrPriv->layer[i].u.run.region)) {
+ /* paint new piece with chroma key */
+ RegionNull(&rgnNew);
+ RegionIntersect(&rgnNew, prgn, &pScrPriv->layer[i].u.run.region);
+ (*pScrPriv->PaintKey) (&pScrPriv->layer[i].u.run.pixmap->drawable,
+ &rgnNew, pScrPriv->layer[i].key, i);
+ RegionUninit(&rgnNew);
+ /* remove piece from other fbs */
+ RegionSubtract(&pScrPriv->layer[i].u.run.region,
+ &pScrPriv->layer[i].u.run.region, prgn);
+ }
}
}
@@ -206,17 +191,15 @@ fbOverlayUpdateLayerRegion (ScreenPtr pScreen,
* Copy only areas in each layer containing real bits
*/
void
-fbOverlayCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
+fbOverlayCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- RegionRec rgnDst;
- int dx, dy;
- int i;
- RegionRec layerRgn[FB_OVERLAY_MAX];
- PixmapPtr pPixmap;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ RegionRec rgnDst;
+ int dx, dy;
+ int i;
+ RegionRec layerRgn[FB_OVERLAY_MAX];
+ PixmapPtr pPixmap;
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
@@ -231,168 +214,146 @@ fbOverlayCopyWindow(WindowPtr pWin,
/*
* Compute the portion of each fb affected by this copy
*/
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- RegionNull(&layerRgn[i]);
- RegionIntersect(&layerRgn[i], &rgnDst,
- &pScrPriv->layer[i].u.run.region);
- if (RegionNotEmpty(&layerRgn[i]))
- {
- RegionTranslate(&layerRgn[i], -dx, -dy);
- pPixmap = pScrPriv->layer[i].u.run.pixmap;
- miCopyRegion (&pPixmap->drawable, &pPixmap->drawable,
- 0,
- &layerRgn[i], dx, dy, pScrPriv->CopyWindow, 0,
- (void *)(long) i);
- }
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ RegionNull(&layerRgn[i]);
+ RegionIntersect(&layerRgn[i], &rgnDst,
+ &pScrPriv->layer[i].u.run.region);
+ if (RegionNotEmpty(&layerRgn[i])) {
+ RegionTranslate(&layerRgn[i], -dx, -dy);
+ pPixmap = pScrPriv->layer[i].u.run.pixmap;
+ miCopyRegion(&pPixmap->drawable, &pPixmap->drawable,
+ 0,
+ &layerRgn[i], dx, dy, pScrPriv->CopyWindow, 0,
+ (void *) (long) i);
+ }
}
/*
* Update regions
*/
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- if (RegionNotEmpty(&layerRgn[i]))
- fbOverlayUpdateLayerRegion (pScreen, i, &layerRgn[i]);
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ if (RegionNotEmpty(&layerRgn[i]))
+ fbOverlayUpdateLayerRegion(pScreen, i, &layerRgn[i]);
- RegionUninit(&layerRgn[i]);
+ RegionUninit(&layerRgn[i]);
}
RegionUninit(&rgnDst);
-}
+}
void
-fbOverlayWindowExposures (WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr other_exposed)
+fbOverlayWindowExposures(WindowPtr pWin,
+ RegionPtr prgn, RegionPtr other_exposed)
{
- fbOverlayUpdateLayerRegion (pWin->drawable.pScreen,
- fbOverlayWindowLayer (pWin),
- prgn);
+ fbOverlayUpdateLayerRegion(pWin->drawable.pScreen,
+ fbOverlayWindowLayer(pWin), prgn);
miWindowExposures(pWin, prgn, other_exposed);
}
Bool
-fbOverlaySetupScreen(ScreenPtr pScreen,
- pointer pbits1,
- pointer pbits2,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width1,
- int width2,
- int bpp1,
- int bpp2)
+fbOverlaySetupScreen(ScreenPtr pScreen,
+ pointer pbits1,
+ pointer pbits2,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy, int width1, int width2, int bpp1, int bpp2)
{
- return fbSetupScreen (pScreen,
- pbits1,
- xsize,
- ysize,
- dpix,
- dpiy,
- width1,
- bpp1);
+ return fbSetupScreen(pScreen,
+ pbits1, xsize, ysize, dpix, dpiy, width1, bpp1);
}
static Bool
fb24_32OverlayCreateScreenResources(ScreenPtr pScreen)
{
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
int pitch;
Bool retval;
int i;
- if((retval = fbOverlayCreateScreenResources(pScreen))) {
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- /* fix the screen pixmap */
- PixmapPtr pPix = (PixmapPtr) pScrPriv->layer[i].u.run.pixmap;
- if (pPix->drawable.bitsPerPixel == 32) {
- pPix->drawable.bitsPerPixel = 24;
- pitch = BitmapBytePad(pPix->drawable.width * 24);
- pPix->devKind = pitch;
- }
- }
+ if ((retval = fbOverlayCreateScreenResources(pScreen))) {
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ /* fix the screen pixmap */
+ PixmapPtr pPix = (PixmapPtr) pScrPriv->layer[i].u.run.pixmap;
+
+ if (pPix->drawable.bitsPerPixel == 32) {
+ pPix->drawable.bitsPerPixel = 24;
+ pitch = BitmapBytePad(pPix->drawable.width * 24);
+ pPix->devKind = pitch;
+ }
+ }
}
return retval;
}
Bool
-fbOverlayFinishScreenInit(ScreenPtr pScreen,
- pointer pbits1,
- pointer pbits2,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width1,
- int width2,
- int bpp1,
- int bpp2,
- int depth1,
- int depth2)
+fbOverlayFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits1,
+ pointer pbits2,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width1,
+ int width2,
+ int bpp1, int bpp2, int depth1, int depth2)
{
- VisualPtr visuals;
- DepthPtr depths;
- int nvisuals;
- int ndepths;
- int bpp = 0, imagebpp = 32;
- VisualID defaultVisual;
- FbOverlayScrPrivPtr pScrPriv;
-
- if (!dixRegisterPrivateKey(&fbOverlayScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- pScrPriv = malloc(sizeof (FbOverlayScrPrivRec));
+ VisualPtr visuals;
+ DepthPtr depths;
+ int nvisuals;
+ int ndepths;
+ int bpp = 0, imagebpp = 32;
+ VisualID defaultVisual;
+ FbOverlayScrPrivPtr pScrPriv;
+
+ if (!dixRegisterPrivateKey
+ (&fbOverlayScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ pScrPriv = malloc(sizeof(FbOverlayScrPrivRec));
if (!pScrPriv)
- return FALSE;
-
+ return FALSE;
+
if (bpp1 == 32 || bpp2 == 32)
- bpp = 32;
+ bpp = 32;
else if (bpp1 == 24 || bpp2 == 24)
- bpp = 24;
-
- if (bpp == 24)
- {
- int f;
-
- imagebpp = 32;
- /*
- * Check to see if we're advertising a 24bpp image format,
- * in which case windows will use it in preference to a 32 bit
- * format.
- */
- for (f = 0; f < screenInfo.numPixmapFormats; f++)
- {
- if (screenInfo.formats[f].bitsPerPixel == 24)
- {
- imagebpp = 24;
- break;
- }
- }
+ bpp = 24;
+
+ if (bpp == 24) {
+ int f;
+
+ imagebpp = 32;
+ /*
+ * Check to see if we're advertising a 24bpp image format,
+ * in which case windows will use it in preference to a 32 bit
+ * format.
+ */
+ for (f = 0; f < screenInfo.numPixmapFormats; f++) {
+ if (screenInfo.formats[f].bitsPerPixel == 24) {
+ imagebpp = 24;
+ break;
+ }
+ }
}
- if (imagebpp == 32)
- {
- fbGetScreenPrivate(pScreen)->win32bpp = bpp;
- fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
+ if (imagebpp == 32) {
+ fbGetScreenPrivate(pScreen)->win32bpp = bpp;
+ fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
}
- else
- {
- fbGetScreenPrivate(pScreen)->win32bpp = 32;
- fbGetScreenPrivate(pScreen)->pix32bpp = 32;
+ else {
+ fbGetScreenPrivate(pScreen)->win32bpp = 32;
+ fbGetScreenPrivate(pScreen)->pix32bpp = 32;
}
-
- if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &depth1,
- &defaultVisual, ((unsigned long)1<<(bpp1-1)) |
- ((unsigned long)1<<(bpp2-1)), 8)) {
- free(pScrPriv);
- return FALSE;
+
+ if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &depth1,
+ &defaultVisual, ((unsigned long) 1 << (bpp1 - 1)) |
+ ((unsigned long) 1 << (bpp2 - 1)), 8)) {
+ free(pScrPriv);
+ return FALSE;
}
- if (! miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0,
- depth1, ndepths, depths,
- defaultVisual, nvisuals, visuals)) {
- free(pScrPriv);
- return FALSE;
+ if (!miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0,
+ depth1, ndepths, depths,
+ defaultVisual, nvisuals, visuals)) {
+ free(pScrPriv);
+ return FALSE;
}
/* MI thinks there's no frame buffer */
#ifdef MITSHM
@@ -400,7 +361,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
#endif
pScreen->minInstalledCmaps = 1;
pScreen->maxInstalledCmaps = 2;
-
+
pScrPriv->nlayers = 2;
pScrPriv->PaintKey = fbOverlayPaintKey;
pScrPriv->CopyWindow = fbCopyWindowProc;
@@ -412,17 +373,16 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
pScrPriv->layer[1].u.init.width = width2;
pScrPriv->layer[1].u.init.depth = depth2;
dixSetPrivate(&pScreen->devPrivates, fbOverlayScreenPrivateKey, pScrPriv);
-
+
/* overwrite miCloseScreen with our own */
pScreen->CloseScreen = fbOverlayCloseScreen;
pScreen->CreateScreenResources = fbOverlayCreateScreenResources;
pScreen->CreateWindow = fbOverlayCreateWindow;
pScreen->WindowExposures = fbOverlayWindowExposures;
pScreen->CopyWindow = fbOverlayCopyWindow;
- if (bpp == 24 && imagebpp == 32)
- {
- pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
- pScreen->CreateScreenResources = fb24_32OverlayCreateScreenResources;
+ if (bpp == 24 && imagebpp == 32) {
+ pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
+ pScreen->CreateScreenResources = fb24_32OverlayCreateScreenResources;
}
return TRUE;
diff --git a/fb/fboverlay.h b/fb/fboverlay.h
index b626a7702..76198cda5 100644
--- a/fb/fboverlay.h
+++ b/fb/fboverlay.h
@@ -33,91 +33,80 @@ extern _X_EXPORT DevPrivateKey fbOverlayGetScreenPrivateKey(void);
#define FB_OVERLAY_MAX 2
#endif
-typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int);
+typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int);
typedef struct _fbOverlayLayer {
union {
- struct {
- pointer pbits;
- int width;
- int depth;
- } init;
- struct {
- PixmapPtr pixmap;
- RegionRec region;
- } run;
+ struct {
+ pointer pbits;
+ int width;
+ int depth;
+ } init;
+ struct {
+ PixmapPtr pixmap;
+ RegionRec region;
+ } run;
} u;
- CARD32 key; /* special pixel value */
+ CARD32 key; /* special pixel value */
} FbOverlayLayer;
typedef struct _fbOverlayScrPriv {
- int nlayers;
- fbOverlayPaintKeyProc PaintKey;
- miCopyProc CopyWindow;
- FbOverlayLayer layer[FB_OVERLAY_MAX];
+ int nlayers;
+ fbOverlayPaintKeyProc PaintKey;
+ miCopyProc CopyWindow;
+ FbOverlayLayer layer[FB_OVERLAY_MAX];
} FbOverlayScrPrivRec, *FbOverlayScrPrivPtr;
#define fbOverlayGetScrPriv(s) \
dixLookupPrivate(&(s)->devPrivates, fbOverlayGetScreenPrivateKey())
extern _X_EXPORT Bool
-fbOverlayCreateWindow(WindowPtr pWin);
+ fbOverlayCreateWindow(WindowPtr pWin);
extern _X_EXPORT Bool
-fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen);
+ fbOverlayCloseScreen(int iScreen, ScreenPtr pScreen);
extern _X_EXPORT int
-fbOverlayWindowLayer(WindowPtr pWin);
+ fbOverlayWindowLayer(WindowPtr pWin);
extern _X_EXPORT Bool
-fbOverlayCreateScreenResources(ScreenPtr pScreen);
+ fbOverlayCreateScreenResources(ScreenPtr pScreen);
extern _X_EXPORT void
-fbOverlayPaintKey (DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer);
+
+fbOverlayPaintKey(DrawablePtr pDrawable,
+ RegionPtr pRegion, CARD32 pixel, int layer);
extern _X_EXPORT void
-fbOverlayUpdateLayerRegion (ScreenPtr pScreen,
- int layer,
- RegionPtr prgn);
+ fbOverlayUpdateLayerRegion(ScreenPtr pScreen, int layer, RegionPtr prgn);
-
extern _X_EXPORT void
-fbOverlayCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
+ fbOverlayCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+
extern _X_EXPORT void
-fbOverlayWindowExposures (WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr other_exposed);
+
+fbOverlayWindowExposures(WindowPtr pWin,
+ RegionPtr prgn, RegionPtr other_exposed);
extern _X_EXPORT Bool
-fbOverlaySetupScreen(ScreenPtr pScreen,
- pointer pbits1,
- pointer pbits2,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width1,
- int width2,
- int bpp1,
- int bpp2);
+
+fbOverlaySetupScreen(ScreenPtr pScreen,
+ pointer pbits1,
+ pointer pbits2,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy, int width1, int width2, int bpp1, int bpp2);
extern _X_EXPORT Bool
-fbOverlayFinishScreenInit(ScreenPtr pScreen,
- pointer pbits1,
- pointer pbits2,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width1,
- int width2,
- int bpp1,
- int bpp2,
- int depth1,
- int depth2);
-
-#endif /* _FBOVERLAY_H_ */
+
+fbOverlayFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits1,
+ pointer pbits2,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width1,
+ int width2,
+ int bpp1, int bpp2, int depth1, int depth2);
+
+#endif /* _FBOVERLAY_H_ */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 57c93fd06..097a1a6bd 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -36,171 +36,165 @@
#include "fbpict.h"
void
-fbComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+fbComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
pixman_image_t *src, *mask, *dest;
int src_xoff, src_yoff;
int msk_xoff, msk_yoff;
int dst_xoff, dst_yoff;
-
- miCompositeSourceValidate (pSrc);
+
+ miCompositeSourceValidate(pSrc);
if (pMask)
- miCompositeSourceValidate (pMask);
-
- src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
- mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
- dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
-
- if (src && dest && !(pMask && !mask))
- {
- pixman_image_composite (op, src, mask, dest,
- xSrc + src_xoff, ySrc + src_yoff,
- xMask + msk_xoff, yMask + msk_yoff,
- xDst + dst_xoff, yDst + dst_yoff,
- width, height);
+ miCompositeSourceValidate(pMask);
+
+ src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff);
+ mask = image_from_pict(pMask, FALSE, &msk_xoff, &msk_yoff);
+ dest = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff);
+
+ if (src && dest && !(pMask && !mask)) {
+ pixman_image_composite(op, src, mask, dest,
+ xSrc + src_xoff, ySrc + src_yoff,
+ xMask + msk_xoff, yMask + msk_yoff,
+ xDst + dst_xoff, yDst + dst_yoff, width, height);
}
- free_pixman_pict (pSrc, src);
- free_pixman_pict (pMask, mask);
- free_pixman_pict (pDst, dest);
+ free_pixman_pict(pSrc, src);
+ free_pixman_pict(pMask, mask);
+ free_pixman_pict(pDst, dest);
}
static pixman_image_t *
-create_solid_fill_image (PicturePtr pict)
+create_solid_fill_image(PicturePtr pict)
{
PictSolidFill *solid = &pict->pSourcePict->solidFill;
pixman_color_t color;
CARD32 a, r, g, b;
-
+
a = (solid->color & 0xff000000) >> 24;
r = (solid->color & 0x00ff0000) >> 16;
- g = (solid->color & 0x0000ff00) >> 8;
- b = (solid->color & 0x000000ff) >> 0;
-
+ g = (solid->color & 0x0000ff00) >> 8;
+ b = (solid->color & 0x000000ff) >> 0;
+
color.alpha = (a << 8) | a;
- color.red = (r << 8) | r;
+ color.red = (r << 8) | r;
color.green = (g << 8) | g;
- color.blue = (b << 8) | b;
-
- return pixman_image_create_solid_fill (&color);
+ color.blue = (b << 8) | b;
+
+ return pixman_image_create_solid_fill(&color);
}
static pixman_image_t *
-create_linear_gradient_image (PictGradient *gradient)
+create_linear_gradient_image(PictGradient * gradient)
{
- PictLinearGradient *linear = (PictLinearGradient *)gradient;
+ PictLinearGradient *linear = (PictLinearGradient *) gradient;
pixman_point_fixed_t p1;
pixman_point_fixed_t p2;
-
+
p1.x = linear->p1.x;
p1.y = linear->p1.y;
p2.x = linear->p2.x;
p2.y = linear->p2.y;
-
- return pixman_image_create_linear_gradient (
- &p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
+
+ return pixman_image_create_linear_gradient(&p1, &p2,
+ (pixman_gradient_stop_t *)
+ gradient->stops,
+ gradient->nstops);
}
static pixman_image_t *
-create_radial_gradient_image (PictGradient *gradient)
+create_radial_gradient_image(PictGradient * gradient)
{
- PictRadialGradient *radial = (PictRadialGradient *)gradient;
+ PictRadialGradient *radial = (PictRadialGradient *) gradient;
pixman_point_fixed_t c1;
pixman_point_fixed_t c2;
-
+
c1.x = radial->c1.x;
c1.y = radial->c1.y;
c2.x = radial->c2.x;
c2.y = radial->c2.y;
-
- return pixman_image_create_radial_gradient (
- &c1, &c2, radial->c1.radius,
- radial->c2.radius,
- (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
+
+ return pixman_image_create_radial_gradient(&c1, &c2, radial->c1.radius,
+ radial->c2.radius,
+ (pixman_gradient_stop_t *)
+ gradient->stops,
+ gradient->nstops);
}
static pixman_image_t *
-create_conical_gradient_image (PictGradient *gradient)
+create_conical_gradient_image(PictGradient * gradient)
{
- PictConicalGradient *conical = (PictConicalGradient *)gradient;
+ PictConicalGradient *conical = (PictConicalGradient *) gradient;
pixman_point_fixed_t center;
-
+
center.x = conical->center.x;
center.y = conical->center.y;
-
- return pixman_image_create_conical_gradient (
- &center, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
- gradient->nstops);
+
+ return pixman_image_create_conical_gradient(&center, conical->angle,
+ (pixman_gradient_stop_t *)
+ gradient->stops,
+ gradient->nstops);
}
static pixman_image_t *
-create_bits_picture (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff)
+create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
{
PixmapPtr pixmap;
FbBits *bits;
FbStride stride;
int bpp;
pixman_image_t *image;
-
- fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
+
+ fbGetDrawablePixmap(pict->pDrawable, pixmap, *xoff, *yoff);
fbGetPixmapBitsData(pixmap, bits, stride, bpp);
- image = pixman_image_create_bits (
- (pixman_format_code_t)pict->format,
- pixmap->drawable.width, pixmap->drawable.height,
- (uint32_t *)bits, stride * sizeof (FbStride));
+ image = pixman_image_create_bits((pixman_format_code_t) pict->format,
+ pixmap->drawable.width,
+ pixmap->drawable.height, (uint32_t *) bits,
+ stride * sizeof(FbStride));
if (!image)
- return NULL;
-
+ return NULL;
+
#ifdef FB_ACCESS_WRAPPER
#if FB_SHIFT==5
-
- pixman_image_set_accessors (image,
- (pixman_read_memory_func_t)wfbReadMemory,
- (pixman_write_memory_func_t)wfbWriteMemory);
-
+
+ pixman_image_set_accessors(image,
+ (pixman_read_memory_func_t) wfbReadMemory,
+ (pixman_write_memory_func_t) wfbWriteMemory);
+
#else
-
+
#error The pixman library only works when FbBits is 32 bits wide
-
+
#endif
#endif
-
+
/* pCompositeClip is undefined for source pictures, so
* only set the clip region for pictures with drawables
*/
- if (has_clip)
- {
- if (pict->clientClipType != CT_NONE)
- pixman_image_set_has_client_clip (image, TRUE);
+ if (has_clip) {
+ if (pict->clientClipType != CT_NONE)
+ pixman_image_set_has_client_clip(image, TRUE);
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+ if (*xoff || *yoff)
+ pixman_region_translate(pict->pCompositeClip, *xoff, *yoff);
- pixman_image_set_clip_region (image, pict->pCompositeClip);
+ pixman_image_set_clip_region(image, pict->pCompositeClip);
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+ if (*xoff || *yoff)
+ pixman_region_translate(pict->pCompositeClip, -*xoff, -*yoff);
}
-
+
/* Indexed table */
if (pict->pFormat->index.devPrivate)
- pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
+ pixman_image_set_indexed(image, pict->pFormat->index.devPrivate);
/* Add in drawable origin to position within the image */
*xoff += pict->pDrawable->x;
@@ -209,158 +203,158 @@ create_bits_picture (PicturePtr pict,
return image;
}
-static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+static pixman_image_t *image_from_pict_internal(PicturePtr pict, Bool has_clip,
+ int *xoff, int *yoff,
+ Bool is_alpha_map);
static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
+ int *xoff, int *yoff, Bool is_alpha_map)
{
pixman_repeat_t repeat;
pixman_filter_t filter;
-
- if (pict->transform)
- {
- /* For source images, adjust the transform to account
- * for the drawable offset within the pixman image,
- * then set the offset to 0 as it will be used
- * to compute positions within the transformed image.
- */
- if (!has_clip) {
- struct pixman_transform adjusted;
-
- adjusted = *pict->transform;
- pixman_transform_translate(&adjusted,
- NULL,
- pixman_int_to_fixed(*xoff),
- pixman_int_to_fixed(*yoff));
- pixman_image_set_transform (image, &adjusted);
- *xoff = 0;
- *yoff = 0;
- } else
- pixman_image_set_transform (image, pict->transform);
+
+ if (pict->transform) {
+ /* For source images, adjust the transform to account
+ * for the drawable offset within the pixman image,
+ * then set the offset to 0 as it will be used
+ * to compute positions within the transformed image.
+ */
+ if (!has_clip) {
+ struct pixman_transform adjusted;
+
+ adjusted = *pict->transform;
+ pixman_transform_translate(&adjusted,
+ NULL,
+ pixman_int_to_fixed(*xoff),
+ pixman_int_to_fixed(*yoff));
+ pixman_image_set_transform(image, &adjusted);
+ *xoff = 0;
+ *yoff = 0;
+ }
+ else
+ pixman_image_set_transform(image, pict->transform);
}
-
- switch (pict->repeatType)
- {
+
+ switch (pict->repeatType) {
default:
case RepeatNone:
- repeat = PIXMAN_REPEAT_NONE;
- break;
-
+ repeat = PIXMAN_REPEAT_NONE;
+ break;
+
case RepeatPad:
- repeat = PIXMAN_REPEAT_PAD;
- break;
-
+ repeat = PIXMAN_REPEAT_PAD;
+ break;
+
case RepeatNormal:
- repeat = PIXMAN_REPEAT_NORMAL;
- break;
-
+ repeat = PIXMAN_REPEAT_NORMAL;
+ break;
+
case RepeatReflect:
- repeat = PIXMAN_REPEAT_REFLECT;
- break;
+ repeat = PIXMAN_REPEAT_REFLECT;
+ break;
}
-
- pixman_image_set_repeat (image, repeat);
-
+
+ pixman_image_set_repeat(image, repeat);
+
/* Fetch alpha map unless 'pict' is being used
* as the alpha map for this operation
*/
- if (pict->alphaMap && !is_alpha_map)
- {
- int alpha_xoff, alpha_yoff;
- pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
-
- pixman_image_set_alpha_map (
- image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
-
- free_pixman_pict (pict->alphaMap, alpha_map);
+ if (pict->alphaMap && !is_alpha_map) {
+ int alpha_xoff, alpha_yoff;
+ pixman_image_t *alpha_map =
+ image_from_pict_internal(pict->alphaMap, FALSE, &alpha_xoff,
+ &alpha_yoff, TRUE);
+
+ pixman_image_set_alpha_map(image, alpha_map, pict->alphaOrigin.x,
+ pict->alphaOrigin.y);
+
+ free_pixman_pict(pict->alphaMap, alpha_map);
}
-
- pixman_image_set_component_alpha (image, pict->componentAlpha);
- switch (pict->filter)
- {
+ pixman_image_set_component_alpha(image, pict->componentAlpha);
+
+ switch (pict->filter) {
default:
case PictFilterNearest:
case PictFilterFast:
- filter = PIXMAN_FILTER_NEAREST;
- break;
-
+ filter = PIXMAN_FILTER_NEAREST;
+ break;
+
case PictFilterBilinear:
case PictFilterGood:
- filter = PIXMAN_FILTER_BILINEAR;
- break;
-
+ filter = PIXMAN_FILTER_BILINEAR;
+ break;
+
case PictFilterConvolution:
- filter = PIXMAN_FILTER_CONVOLUTION;
- break;
+ filter = PIXMAN_FILTER_CONVOLUTION;
+ break;
}
-
- pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
- pixman_image_set_source_clipping (image, TRUE);
+
+ pixman_image_set_filter(image, filter,
+ (pixman_fixed_t *) pict->filter_params,
+ pict->filter_nparams);
+ pixman_image_set_source_clipping(image, TRUE);
}
static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
+ Bool is_alpha_map)
{
pixman_image_t *image = NULL;
if (!pict)
- return NULL;
+ return NULL;
- if (pict->pDrawable)
- {
- image = create_bits_picture (pict, has_clip, xoff, yoff);
+ if (pict->pDrawable) {
+ image = create_bits_picture(pict, has_clip, xoff, yoff);
}
- else if (pict->pSourcePict)
- {
- SourcePict *sp = pict->pSourcePict;
-
- if (sp->type == SourcePictTypeSolidFill)
- {
- image = create_solid_fill_image (pict);
- }
- else
- {
- PictGradient *gradient = &pict->pSourcePict->gradient;
-
- if (sp->type == SourcePictTypeLinear)
- image = create_linear_gradient_image (gradient);
- else if (sp->type == SourcePictTypeRadial)
- image = create_radial_gradient_image (gradient);
- else if (sp->type == SourcePictTypeConical)
- image = create_conical_gradient_image (gradient);
- }
- *xoff = *yoff = 0;
+ else if (pict->pSourcePict) {
+ SourcePict *sp = pict->pSourcePict;
+
+ if (sp->type == SourcePictTypeSolidFill) {
+ image = create_solid_fill_image(pict);
+ }
+ else {
+ PictGradient *gradient = &pict->pSourcePict->gradient;
+
+ if (sp->type == SourcePictTypeLinear)
+ image = create_linear_gradient_image(gradient);
+ else if (sp->type == SourcePictTypeRadial)
+ image = create_radial_gradient_image(gradient);
+ else if (sp->type == SourcePictTypeConical)
+ image = create_conical_gradient_image(gradient);
+ }
+ *xoff = *yoff = 0;
}
-
+
if (image)
- set_image_properties (image, pict, has_clip, xoff, yoff, is_alpha_map);
-
+ set_image_properties(image, pict, has_clip, xoff, yoff, is_alpha_map);
+
return image;
}
pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
{
- return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+ return image_from_pict_internal(pict, has_clip, xoff, yoff, FALSE);
}
void
-free_pixman_pict (PicturePtr pict, pixman_image_t *image)
+free_pixman_pict(PicturePtr pict, pixman_image_t * image)
{
- if (image && pixman_image_unref (image) && pict->pDrawable)
- fbFinishAccess (pict->pDrawable);
+ if (image && pixman_image_unref(image) && pict->pDrawable)
+ fbFinishAccess(pict->pDrawable);
}
Bool
-fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
- PictureScreenPtr ps;
+ PictureScreenPtr ps;
- if (!miPictureInit (pScreen, formats, nformats))
- return FALSE;
+ if (!miPictureInit(pScreen, formats, nformats))
+ return FALSE;
ps = GetPictureScreen(pScreen);
ps->Composite = fbComposite;
ps->Glyphs = miGlyphs;
diff --git a/fb/fbpict.h b/fb/fbpict.h
index b880ebbe1..110f32dfe 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -30,59 +30,46 @@
/* fbpict.c */
extern _X_EXPORT void
-fbComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
+
+fbComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
/* fbtrap.c */
extern _X_EXPORT void
-fbAddTraps (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntrap,
- xTrap *traps);
+
+fbAddTraps(PicturePtr pPicture,
+ INT16 xOff, INT16 yOff, int ntrap, xTrap * traps);
extern _X_EXPORT void
-fbRasterizeTrapezoid (PicturePtr alpha,
- xTrapezoid *trap,
- int x_off,
- int y_off);
+
+fbRasterizeTrapezoid(PicturePtr alpha, xTrapezoid * trap, int x_off, int y_off);
extern _X_EXPORT void
-fbAddTriangles (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntri,
- xTriangle *tris);
+
+fbAddTriangles(PicturePtr pPicture,
+ INT16 xOff, INT16 yOff, int ntri, xTriangle * tris);
extern _X_EXPORT void
-fbTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps);
+
+fbTrapezoids(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
extern _X_EXPORT void
-fbTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntris,
- xTriangle *tris);
-
-#endif /* _FBPICT_H_ */
+
+fbTriangles(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris);
+
+#endif /* _FBPICT_H_ */
diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c
index a356c67b6..fbcdca99c 100644
--- a/fb/fbpixmap.c
+++ b/fb/fbpixmap.c
@@ -29,30 +29,30 @@
#include "fb.h"
PixmapPtr
-fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
- unsigned usage_hint)
+fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
+ unsigned usage_hint)
{
- PixmapPtr pPixmap;
- size_t datasize;
- size_t paddedWidth;
- int adjust;
- int base;
+ PixmapPtr pPixmap;
+ size_t datasize;
+ size_t paddedWidth;
+ int adjust;
+ int base;
- paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
+ paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
if (paddedWidth / 4 > 32767 || height > 32767)
- return NullPixmap;
+ return NullPixmap;
datasize = height * paddedWidth;
base = pScreen->totalPixmapSize;
adjust = 0;
if (base & 7)
- adjust = 8 - (base & 7);
+ adjust = 8 - (base & 7);
datasize += adjust;
#ifdef FB_DEBUG
datasize += 2 * paddedWidth;
#endif
pPixmap = AllocatePixmap(pScreen, datasize);
if (!pPixmap)
- return NullPixmap;
+ return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
pPixmap->drawable.class = 0;
pPixmap->drawable.pScreen = pScreen;
@@ -66,11 +66,12 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
pPixmap->drawable.height = height;
pPixmap->devKind = paddedWidth;
pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = (pointer) ((char *)pPixmap + base + adjust);
+ pPixmap->devPrivate.ptr = (pointer) ((char *) pPixmap + base + adjust);
#ifdef FB_DEBUG
- pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth);
- fbInitializeDrawable (&pPixmap->drawable);
+ pPixmap->devPrivate.ptr =
+ (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth);
+ fbInitializeDrawable(&pPixmap->drawable);
#endif
#ifdef COMPOSITE
@@ -84,21 +85,22 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
}
PixmapPtr
-fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
+fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
{
- int bpp;
- bpp = BitsPerPixel (depth);
+ int bpp;
+
+ bpp = BitsPerPixel(depth);
if (bpp == 32 && depth <= 24)
- bpp = fbGetScreenPrivate(pScreen)->pix32bpp;
- return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint);
+ bpp = fbGetScreenPrivate(pScreen)->pix32bpp;
+ return fbCreatePixmapBpp(pScreen, width, height, depth, bpp, usage_hint);
}
Bool
-fbDestroyPixmap (PixmapPtr pPixmap)
+fbDestroyPixmap(PixmapPtr pPixmap)
{
- if(--pPixmap->refcnt)
- return TRUE;
+ if (--pPixmap->refcnt)
+ return TRUE;
FreePixmap(pPixmap);
return TRUE;
}
@@ -138,183 +140,160 @@ if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \
RegionPtr
fbPixmapToRegion(PixmapPtr pPix)
{
- register RegionPtr pReg;
- FbBits *pw, w;
- register int ib;
- int width, h, base, rx1 = 0, crects;
- FbBits *pwLineEnd;
- int irectPrevStart, irectLineStart;
- register BoxPtr prectO, prectN;
- BoxPtr FirstRect, rects, prectLineStart;
- Bool fInBox, fSame;
- register FbBits mask0 = FB_ALLONES & ~FbScrRight(FB_ALLONES, 1);
- FbBits *pwLine;
- int nWidth;
-
+ register RegionPtr pReg;
+ FbBits *pw, w;
+ register int ib;
+ int width, h, base, rx1 = 0, crects;
+ FbBits *pwLineEnd;
+ int irectPrevStart, irectLineStart;
+ register BoxPtr prectO, prectN;
+ BoxPtr FirstRect, rects, prectLineStart;
+ Bool fInBox, fSame;
+ register FbBits mask0 = FB_ALLONES & ~FbScrRight(FB_ALLONES, 1);
+ FbBits *pwLine;
+ int nWidth;
+
pReg = RegionCreate(NULL, 1);
- if(!pReg)
- return NullRegion;
+ if (!pReg)
+ return NullRegion;
FirstRect = RegionBoxptr(pReg);
rects = FirstRect;
fbPrepareAccess(&pPix->drawable);
pwLine = (FbBits *) pPix->devPrivate.ptr;
- nWidth = pPix->devKind >> (FB_SHIFT-3);
+ nWidth = pPix->devKind >> (FB_SHIFT - 3);
width = pPix->drawable.width;
pReg->extents.x1 = width - 1;
pReg->extents.x2 = 0;
irectPrevStart = -1;
- for(h = 0; h < pPix->drawable.height; h++)
- {
- pw = pwLine;
- pwLine += nWidth;
- irectLineStart = rects - FirstRect;
- /* If the Screen left most bit of the word is set, we're starting in
- * a box */
- if(READ(pw) & mask0)
- {
- fInBox = TRUE;
- rx1 = 0;
- }
- else
- fInBox = FALSE;
- /* Process all words which are fully in the pixmap */
- pwLineEnd = pw + (width >> FB_SHIFT);
- for (base = 0; pw < pwLineEnd; base += FB_UNIT)
- {
- w = READ(pw++);
- if (fInBox)
- {
- if (!~w)
- continue;
- }
- else
- {
- if (!w)
- continue;
- }
- for(ib = 0; ib < FB_UNIT; ib++)
- {
- /* If the Screen left most bit of the word is set, we're
- * starting a box */
- if(w & mask0)
- {
- if(!fInBox)
- {
- rx1 = base + ib;
- /* start new box */
- fInBox = TRUE;
- }
- }
- else
- {
- if(fInBox)
- {
- /* end box */
- ADDRECT(pReg, rects, FirstRect,
- rx1, h, base + ib, h + 1);
- fInBox = FALSE;
- }
- }
- /* Shift the word VISUALLY left one. */
- w = FbScrLeft(w, 1);
- }
- }
- if(width & FB_MASK)
- {
- /* Process final partial word on line */
- w = READ(pw++);
- for(ib = 0; ib < (width & FB_MASK); ib++)
- {
- /* If the Screen left most bit of the word is set, we're
- * starting a box */
- if(w & mask0)
- {
- if(!fInBox)
- {
- rx1 = base + ib;
- /* start new box */
- fInBox = TRUE;
- }
- }
- else
- {
- if(fInBox)
- {
- /* end box */
- ADDRECT(pReg, rects, FirstRect,
- rx1, h, base + ib, h + 1);
- fInBox = FALSE;
- }
- }
- /* Shift the word VISUALLY left one. */
- w = FbScrLeft(w, 1);
- }
- }
- /* If scanline ended with last bit set, end the box */
- if(fInBox)
- {
- ADDRECT(pReg, rects, FirstRect,
- rx1, h, base + (width & FB_MASK), h + 1);
- }
- /* if all rectangles on this line have the same x-coords as
- * those on the previous line, then add 1 to all the previous y2s and
- * throw away all the rectangles from this line
- */
- fSame = FALSE;
- if(irectPrevStart != -1)
- {
- crects = irectLineStart - irectPrevStart;
- if(crects == ((rects - FirstRect) - irectLineStart))
- {
- prectO = FirstRect + irectPrevStart;
- prectN = prectLineStart = FirstRect + irectLineStart;
- fSame = TRUE;
- while(prectO < prectLineStart)
- {
- if((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2))
- {
- fSame = FALSE;
- break;
- }
- prectO++;
- prectN++;
- }
- if (fSame)
- {
- prectO = FirstRect + irectPrevStart;
- while(prectO < prectLineStart)
- {
- prectO->y2 += 1;
- prectO++;
- }
- rects -= crects;
- pReg->data->numRects -= crects;
- }
- }
- }
- if(!fSame)
- irectPrevStart = irectLineStart;
+ for (h = 0; h < pPix->drawable.height; h++) {
+ pw = pwLine;
+ pwLine += nWidth;
+ irectLineStart = rects - FirstRect;
+ /* If the Screen left most bit of the word is set, we're starting in
+ * a box */
+ if (READ(pw) & mask0) {
+ fInBox = TRUE;
+ rx1 = 0;
+ }
+ else
+ fInBox = FALSE;
+ /* Process all words which are fully in the pixmap */
+ pwLineEnd = pw + (width >> FB_SHIFT);
+ for (base = 0; pw < pwLineEnd; base += FB_UNIT) {
+ w = READ(pw++);
+ if (fInBox) {
+ if (!~w)
+ continue;
+ }
+ else {
+ if (!w)
+ continue;
+ }
+ for (ib = 0; ib < FB_UNIT; ib++) {
+ /* If the Screen left most bit of the word is set, we're
+ * starting a box */
+ if (w & mask0) {
+ if (!fInBox) {
+ rx1 = base + ib;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ }
+ else {
+ if (fInBox) {
+ /* end box */
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + ib, h + 1);
+ fInBox = FALSE;
+ }
+ }
+ /* Shift the word VISUALLY left one. */
+ w = FbScrLeft(w, 1);
+ }
+ }
+ if (width & FB_MASK) {
+ /* Process final partial word on line */
+ w = READ(pw++);
+ for (ib = 0; ib < (width & FB_MASK); ib++) {
+ /* If the Screen left most bit of the word is set, we're
+ * starting a box */
+ if (w & mask0) {
+ if (!fInBox) {
+ rx1 = base + ib;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ }
+ else {
+ if (fInBox) {
+ /* end box */
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + ib, h + 1);
+ fInBox = FALSE;
+ }
+ }
+ /* Shift the word VISUALLY left one. */
+ w = FbScrLeft(w, 1);
+ }
+ }
+ /* If scanline ended with last bit set, end the box */
+ if (fInBox) {
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + (width & FB_MASK), h + 1);
+ }
+ /* if all rectangles on this line have the same x-coords as
+ * those on the previous line, then add 1 to all the previous y2s and
+ * throw away all the rectangles from this line
+ */
+ fSame = FALSE;
+ if (irectPrevStart != -1) {
+ crects = irectLineStart - irectPrevStart;
+ if (crects == ((rects - FirstRect) - irectLineStart)) {
+ prectO = FirstRect + irectPrevStart;
+ prectN = prectLineStart = FirstRect + irectLineStart;
+ fSame = TRUE;
+ while (prectO < prectLineStart) {
+ if ((prectO->x1 != prectN->x1) ||
+ (prectO->x2 != prectN->x2)) {
+ fSame = FALSE;
+ break;
+ }
+ prectO++;
+ prectN++;
+ }
+ if (fSame) {
+ prectO = FirstRect + irectPrevStart;
+ while (prectO < prectLineStart) {
+ prectO->y2 += 1;
+ prectO++;
+ }
+ rects -= crects;
+ pReg->data->numRects -= crects;
+ }
+ }
+ }
+ if (!fSame)
+ irectPrevStart = irectLineStart;
}
if (!pReg->data->numRects)
- pReg->extents.x1 = pReg->extents.x2 = 0;
- else
- {
- pReg->extents.y1 = RegionBoxptr(pReg)->y1;
- pReg->extents.y2 = RegionEnd(pReg)->y2;
- if (pReg->data->numRects == 1)
- {
- free(pReg->data);
- pReg->data = (RegDataPtr)NULL;
- }
+ pReg->extents.x1 = pReg->extents.x2 = 0;
+ else {
+ pReg->extents.y1 = RegionBoxptr(pReg)->y1;
+ pReg->extents.y2 = RegionEnd(pReg)->y2;
+ if (pReg->data->numRects == 1) {
+ free(pReg->data);
+ pReg->data = (RegDataPtr) NULL;
+ }
}
fbFinishAccess(&pPix->drawable);
#ifdef DEBUG
if (!RegionIsValid(pReg))
- FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
+ FatalError("Assertion failed file %s, line %d: expr\n", __FILE__,
+ __LINE__);
#endif
return pReg;
}
@@ -328,63 +307,62 @@ fbPixmapToRegion(PixmapPtr pPix)
#endif
static Bool
-fbValidateBits (FbStip *bits, int stride, FbStip data)
+fbValidateBits(FbStip * bits, int stride, FbStip data)
{
- while (stride--)
- {
- if (*bits != data)
- {
+ while (stride--) {
+ if (*bits != data) {
#ifdef WIN32
- NCD_DEBUG ((DEBUG_FAILURE, "fdValidateBits failed at 0x%x (is 0x%x want 0x%x)",
- bits, *bits, data));
+ NCD_DEBUG((DEBUG_FAILURE,
+ "fdValidateBits failed at 0x%x (is 0x%x want 0x%x)",
+ bits, *bits, data));
#else
- fprintf (stderr, "fbValidateBits failed\n");
+ fprintf(stderr, "fbValidateBits failed\n");
#endif
- return FALSE;
- }
- bits++;
+ return FALSE;
+ }
+ bits++;
}
}
void
-fbValidateDrawable (DrawablePtr pDrawable)
+fbValidateDrawable(DrawablePtr pDrawable)
{
- FbStip *bits, *first, *last;
- int stride, bpp;
- int xoff, yoff;
- int height;
- Bool failed;
-
+ FbStip *bits, *first, *last;
+ int stride, bpp;
+ int xoff, yoff;
+ int height;
+ Bool failed;
+
if (pDrawable->type != DRAWABLE_PIXMAP)
- pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable);
+ pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable);
fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff);
first = bits - stride;
last = bits + stride * pDrawable->height;
- if (!fbValidateBits (first, stride, FB_HEAD_BITS) ||
- !fbValidateBits (last, stride, FB_TAIL_BITS))
- fbInitializeDrawable(pDrawable);
- fbFinishAccess (pDrawable);
+ if (!fbValidateBits(first, stride, FB_HEAD_BITS) ||
+ !fbValidateBits(last, stride, FB_TAIL_BITS))
+ fbInitializeDrawable(pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbSetBits (FbStip *bits, int stride, FbStip data)
+fbSetBits(FbStip * bits, int stride, FbStip data)
{
while (stride--)
- *bits++ = data;
+ *bits++ = data;
}
void
-fbInitializeDrawable (DrawablePtr pDrawable)
+fbInitializeDrawable(DrawablePtr pDrawable)
{
- FbStip *bits, *first, *last;
- int stride, bpp;
- int xoff, yoff;
-
+ FbStip *bits, *first, *last;
+ int stride, bpp;
+ int xoff, yoff;
+
fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff);
first = bits - stride;
last = bits + stride * pDrawable->height;
- fbSetBits (first, stride, FB_HEAD_BITS);
- fbSetBits (last, stride, FB_TAIL_BITS);
- fbFinishAccess (pDrawable);
+ fbSetBits(first, stride, FB_HEAD_BITS);
+ fbSetBits(last, stride, FB_TAIL_BITS);
+ fbFinishAccess(pDrawable);
}
-#endif /* FB_DEBUG */
+#endif /* FB_DEBUG */
diff --git a/fb/fbpoint.c b/fb/fbpoint.c
index bf617708b..d5129d796 100644
--- a/fb/fbpoint.c
+++ b/fb/fbpoint.c
@@ -26,131 +26,121 @@
#include "fb.h"
-typedef void (*FbDots) (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
+typedef void (*FbDots) (FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg,
+ int yorg, int xoff, int yoff, FbBits and, FbBits xor);
void
-fbDots (FbBits *dstOrig,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits andOrig,
- FbBits xorOrig)
+fbDots(FbBits * dstOrig,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig)
{
- FbStip *dst = (FbStip *) dstOrig;
- int x1, y1, x2, y2;
- int x, y;
- FbStip *d;
- FbStip and = andOrig;
- FbStip xor = xorOrig;
+ FbStip *dst = (FbStip *) dstOrig;
+ int x1, y1, x2, y2;
+ int x, y;
+ FbStip *d;
+ FbStip and = andOrig;
+ FbStip xor = xorOrig;
- dstStride = FbBitsStrideToStipStride (dstStride);
+ dstStride = FbBitsStrideToStipStride(dstStride);
x1 = pBox->x1;
y1 = pBox->y1;
x2 = pBox->x2;
y2 = pBox->y2;
- while (npt--)
- {
- x = pts->x + xorg;
- y = pts->y + yorg;
- pts++;
- if (x1 <= x && x < x2 && y1 <= y && y < y2)
- {
- x = (x + xoff) * dstBpp;
- d = dst + ((y + yoff) * dstStride) + (x >> FB_STIP_SHIFT);
- x &= FB_STIP_MASK;
- if (dstBpp == 24)
- {
- FbStip leftMask, rightMask;
- int n, rot;
- FbStip andT, xorT;
-
- rot = FbFirst24Rot (x);
- andT = FbRot24Stip(and,rot);
- xorT = FbRot24Stip(xor,rot);
- FbMaskStip (x, 24, leftMask, n, rightMask);
- if (leftMask)
- {
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
- andT = FbNext24Stip(andT);
- xorT = FbNext24Stip(xorT);
- d++;
- }
- if (rightMask)
- WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
- }
- else
- {
- FbStip mask;
- mask = FbStipMask(x, dstBpp);
- WRITE(d, FbDoMaskRRop (READ(d), and, xor, mask));
- }
- }
+ while (npt--) {
+ x = pts->x + xorg;
+ y = pts->y + yorg;
+ pts++;
+ if (x1 <= x && x < x2 && y1 <= y && y < y2) {
+ x = (x + xoff) * dstBpp;
+ d = dst + ((y + yoff) * dstStride) + (x >> FB_STIP_SHIFT);
+ x &= FB_STIP_MASK;
+ if (dstBpp == 24) {
+ FbStip leftMask, rightMask;
+ int n, rot;
+ FbStip andT, xorT;
+
+ rot = FbFirst24Rot(x);
+ andT = FbRot24Stip(and, rot);
+ xorT = FbRot24Stip(xor, rot);
+ FbMaskStip(x, 24, leftMask, n, rightMask);
+ if (leftMask) {
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
+ andT = FbNext24Stip(andT);
+ xorT = FbNext24Stip(xorT);
+ d++;
+ }
+ if (rightMask)
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
+ }
+ else {
+ FbStip mask;
+
+ mask = FbStipMask(x, dstBpp);
+ WRITE(d, FbDoMaskRRop(READ(d), and, xor, mask));
+ }
+ }
}
}
void
-fbPolyPoint (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int nptInit,
- xPoint *pptInit)
+fbPolyPoint(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int nptInit, xPoint * pptInit)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbDots dots;
- FbBits and, xor;
- xPoint *ppt;
- int npt;
- BoxPtr pBox;
- int nBox;
-
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbDots dots;
+ FbBits and, xor;
+ xPoint *ppt;
+ int npt;
+ BoxPtr pBox;
+ int nBox;
+
/* make pointlist origin relative */
ppt = pptInit;
npt = nptInit;
- if (mode == CoordModePrevious)
- {
- npt--;
- while(npt--)
- {
- ppt++;
- ppt->x += (ppt-1)->x;
- ppt->y += (ppt-1)->y;
- }
+ if (mode == CoordModePrevious) {
+ npt--;
+ while (npt--) {
+ ppt++;
+ ppt->x += (ppt - 1)->x;
+ ppt->y += (ppt - 1)->y;
+ }
}
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
and = pPriv->and;
xor = pPriv->xor;
dots = fbDots;
switch (dstBpp) {
- case 8: dots = fbDots8; break;
- case 16: dots = fbDots16; break;
- case 24: dots = fbDots24; break;
- case 32: dots = fbDots32; break;
+ case 8:
+ dots = fbDots8;
+ break;
+ case 16:
+ dots = fbDots16;
+ break;
+ case 24:
+ dots = fbDots24;
+ break;
+ case 32:
+ dots = fbDots32;
+ break;
}
- for (nBox = RegionNumRects (pClip), pBox = RegionRects (pClip);
- nBox--; pBox++)
- (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit,
- pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor);
- fbFinishAccess (pDrawable);
+ for (nBox = RegionNumRects(pClip), pBox = RegionRects(pClip);
+ nBox--; pBox++)
+ (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit,
+ pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor);
+ fbFinishAccess(pDrawable);
}
diff --git a/fb/fbpush.c b/fb/fbpush.c
index 8dd7c2b59..f0a861cbe 100644
--- a/fb/fbpush.c
+++ b/fb/fbpush.c
@@ -27,219 +27,162 @@
#include "fb.h"
void
-fbPushPattern (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
-
- int width,
- int height)
+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;
-
+ 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++;
+
+ 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)
+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;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- 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);
+ 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);
+ 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)
+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,
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ int nbox;
+ BoxPtr pbox;
+ int x1, y1, x2, y2;
- src + (y1 - y) * srcStride,
- srcStride,
- srcX + (x1 - x),
-
- x1,
- y1,
- x2 - x1,
- y2 - y1);
+ 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)
+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;
+ FbStip *stip;
+ FbStride stipStride;
+ int stipBpp;
+ _X_UNUSED int stipXoff, stipYoff;
- fbGetStipDrawable (&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
+ fbGetStipDrawable(&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff,
+ stipYoff);
- fbPushImage (pDrawable, pGC,
- stip, stipStride, 0,
- xOrg, yOrg, dx, dy);
+ fbPushImage(pDrawable, pGC, stip, stipStride, 0, xOrg, yOrg, dx, dy);
}
diff --git a/fb/fbrop.h b/fb/fbrop.h
index a01fdabfe..4362adb37 100644
--- a/fb/fbrop.h
+++ b/fb/fbrop.h
@@ -24,10 +24,10 @@
#define _FBROP_H_
typedef struct _mergeRopBits {
- FbBits ca1, cx1, ca2, cx2;
+ FbBits ca1, cx1, ca2, cx2;
} FbMergeRopRec, *FbMergeRopPtr;
-extern _X_EXPORT const FbMergeRopRec FbMergeRopBits[16];
+extern _X_EXPORT const FbMergeRopRec FbMergeRopBits[16];
#define FbDeclareMergeRop() FbBits _ca1, _cx1, _ca2, _cx2;
#define FbDeclarePrebuiltMergeRop() FbBits _cca, _ccx;
@@ -95,21 +95,22 @@ extern _X_EXPORT const FbMergeRopRec FbMergeRopBits[16];
* Stippling operations;
*/
-extern _X_EXPORT const FbBits fbStipple16Bits[256]; /* half of table */
+extern _X_EXPORT const FbBits fbStipple16Bits[256]; /* half of table */
+
#define FbStipple16Bits(b) \
(fbStipple16Bits[(b)&0xff] | fbStipple16Bits[(b) >> 8] << FB_HALFUNIT)
-extern _X_EXPORT const FbBits fbStipple8Bits[256];
-extern _X_EXPORT const FbBits fbStipple4Bits[16];
-extern _X_EXPORT const FbBits fbStipple2Bits[4];
-extern _X_EXPORT const FbBits fbStipple1Bits[2];
-extern _X_EXPORT const FbBits *const fbStippleTable[];
+extern _X_EXPORT const FbBits fbStipple8Bits[256];
+extern _X_EXPORT const FbBits fbStipple4Bits[16];
+extern _X_EXPORT const FbBits fbStipple2Bits[4];
+extern _X_EXPORT const FbBits fbStipple1Bits[2];
+extern _X_EXPORT const FbBits *const fbStippleTable[];
#define FbStippleRRop(dst, b, fa, fx, ba, bx) \
(FbDoRRop(dst, fa, fx) & b) | (FbDoRRop(dst, ba, bx) & ~b)
#define FbStippleRRopMask(dst, b, fa, fx, ba, bx, m) \
(FbDoMaskRRop(dst, fa, fx, m) & (b)) | (FbDoMaskRRop(dst, ba, bx, m) & ~(b))
-
+
#define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \
FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \
FbDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \
@@ -121,7 +122,7 @@ extern _X_EXPORT const FbBits *const fbStippleTable[];
}
#define FbOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b)))
-
+
/*
* Compute rop for using tile code for 1-bit dest stipples; modifies
* existing rop to flip depending on pixel values
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 9e6ecf50f..c0903ec5c 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -27,13 +27,13 @@
#include "fb.h"
Bool
-fbCloseScreen (int index, ScreenPtr pScreen)
+fbCloseScreen(int index, ScreenPtr pScreen)
{
- int d;
- DepthPtr depths = pScreen->allowedDepths;
+ int d;
+ DepthPtr depths = pScreen->allowedDepths;
for (d = 0; d < pScreen->numDepths; d++)
- free(depths[d].vids);
+ free(depths[d].vids);
free(depths);
free(pScreen->visuals);
free(pScreen->devPrivate);
@@ -53,57 +53,52 @@ fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
}
void
-fbQueryBestSize (int class,
- unsigned short *width, unsigned short *height,
- ScreenPtr pScreen)
+fbQueryBestSize(int class,
+ unsigned short *width, unsigned short *height,
+ ScreenPtr pScreen)
{
- unsigned short w;
-
+ unsigned short w;
+
switch (class) {
case CursorShape:
- if (*width > pScreen->width)
- *width = pScreen->width;
- if (*height > pScreen->height)
- *height = pScreen->height;
- break;
+ if (*width > pScreen->width)
+ *width = pScreen->width;
+ if (*height > pScreen->height)
+ *height = pScreen->height;
+ break;
case TileShape:
case StippleShape:
- w = *width;
- if ((w & (w - 1)) && w < FB_UNIT)
- {
- for (w = 1; w < *width; w <<= 1)
- ;
- *width = w;
- }
+ w = *width;
+ if ((w & (w - 1)) && w < FB_UNIT) {
+ for (w = 1; w < *width; w <<= 1);
+ *width = w;
+ }
}
}
PixmapPtr
-_fbGetWindowPixmap (WindowPtr pWindow)
+_fbGetWindowPixmap(WindowPtr pWindow)
{
- return fbGetWindowPixmap (pWindow);
+ return fbGetWindowPixmap(pWindow);
}
void
-_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
+_fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
{
dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(), pPixmap);
}
Bool
-fbSetupScreen(ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, /* in pixels */
- int ysize,
- int dpix, /* dots per inch */
- int dpiy,
- int width, /* pixel width of frame buffer */
- int bpp) /* bits per pixel for screen */
-{
+fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */
+ int xsize, /* in pixels */
+ int ysize, int dpix, /* dots per inch */
+ int dpiy, int width, /* pixel width of frame buffer */
+ int bpp)
+{ /* bits per pixel for screen */
if (!fbAllocatePrivates(pScreen, NULL))
- return FALSE;
+ return FALSE;
pScreen->defColormap = FakeClientID(0);
- /* let CreateDefColormap do whatever it wants for pixels */
+ /* let CreateDefColormap do whatever it wants for pixels */
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
pScreen->QueryBestSize = fbQueryBestSize;
/* SaveScreen */
@@ -122,14 +117,14 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->UnrealizeFont = fbUnrealizeFont;
pScreen->CreateGC = fbCreateGC;
pScreen->CreateColormap = fbInitializeColormap;
- pScreen->DestroyColormap = (void (*)(ColormapPtr))NoopDDA;
+ pScreen->DestroyColormap = (void (*)(ColormapPtr)) NoopDDA;
pScreen->InstallColormap = fbInstallColormap;
pScreen->UninstallColormap = fbUninstallColormap;
pScreen->ListInstalledColormaps = fbListInstalledColormaps;
- pScreen->StoreColors = (void (*)(ColormapPtr, int, xColorItem *))NoopDDA;
+ pScreen->StoreColors = (void (*)(ColormapPtr, int, xColorItem *)) NoopDDA;
pScreen->ResolveColor = fbResolveColor;
pScreen->BitmapToRegion = fbPixmapToRegion;
-
+
pScreen->GetWindowPixmap = _fbGetWindowPixmap;
pScreen->SetWindowPixmap = _fbSetWindowPixmap;
@@ -138,46 +133,39 @@ fbSetupScreen(ScreenPtr pScreen,
#ifdef FB_ACCESS_WRAPPER
Bool
-wfbFinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp,
- SetupWrapProcPtr setupWrap,
- FinishWrapProcPtr finishWrap)
+wfbFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int bpp,
+ SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap)
#else
Bool
-fbFinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp)
+fbFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize, int dpix, int dpiy, int width, int bpp)
#endif
{
- VisualPtr visuals;
- DepthPtr depths;
- int nvisuals;
- int ndepths;
- int rootdepth;
- VisualID defaultVisual;
- int imagebpp = bpp;
+ VisualPtr visuals;
+ DepthPtr depths;
+ int nvisuals;
+ int ndepths;
+ int rootdepth;
+ VisualID defaultVisual;
+ int imagebpp = bpp;
#ifdef FB_DEBUG
- int stride;
-
+ int stride;
+
ysize -= 2;
stride = (width * bpp) / 8;
- fbSetBits ((FbStip *) pbits,
- stride / sizeof (FbStip), FB_HEAD_BITS);
+ fbSetBits((FbStip *) pbits, stride / sizeof(FbStip), FB_HEAD_BITS);
pbits = (void *) ((char *) pbits + stride);
- fbSetBits ((FbStip *) ((char *) pbits + stride * ysize),
- stride / sizeof (FbStip), FB_TAIL_BITS);
+ fbSetBits((FbStip *) ((char *) pbits + stride * ysize),
+ stride / sizeof(FbStip), FB_TAIL_BITS);
#endif
/*
* By default, a 24bpp screen will use 32bpp images, this avoids
@@ -185,53 +173,48 @@ fbFinishScreenInit(ScreenPtr pScreen,
* pixels. If you want real 24bit images, include a 24bpp
* format in the pixmap formats
*/
- if (bpp == 24)
- {
- int f;
-
- imagebpp = 32;
- /*
- * Check to see if we're advertising a 24bpp image format,
- * in which case windows will use it in preference to a 32 bit
- * format.
- */
- for (f = 0; f < screenInfo.numPixmapFormats; f++)
- {
- if (screenInfo.formats[f].bitsPerPixel == 24)
- {
- imagebpp = 24;
- break;
- }
- }
+ if (bpp == 24) {
+ int f;
+
+ imagebpp = 32;
+ /*
+ * Check to see if we're advertising a 24bpp image format,
+ * in which case windows will use it in preference to a 32 bit
+ * format.
+ */
+ for (f = 0; f < screenInfo.numPixmapFormats; f++) {
+ if (screenInfo.formats[f].bitsPerPixel == 24) {
+ imagebpp = 24;
+ break;
+ }
+ }
}
- if (imagebpp == 32)
- {
- fbGetScreenPrivate(pScreen)->win32bpp = bpp;
- fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
+ if (imagebpp == 32) {
+ fbGetScreenPrivate(pScreen)->win32bpp = bpp;
+ fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
}
- else
- {
- fbGetScreenPrivate(pScreen)->win32bpp = 32;
- fbGetScreenPrivate(pScreen)->pix32bpp = 32;
+ else {
+ fbGetScreenPrivate(pScreen)->win32bpp = 32;
+ fbGetScreenPrivate(pScreen)->pix32bpp = 32;
}
#ifdef FB_ACCESS_WRAPPER
fbGetScreenPrivate(pScreen)->setupWrap = setupWrap;
fbGetScreenPrivate(pScreen)->finishWrap = finishWrap;
#endif
rootdepth = 0;
- if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
- &defaultVisual,((unsigned long)1<<(imagebpp-1)), 8))
- return FALSE;
- if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- rootdepth, ndepths, depths,
- defaultVisual, nvisuals, visuals))
- return FALSE;
+ if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
+ &defaultVisual, ((unsigned long) 1 << (imagebpp - 1)),
+ 8))
+ return FALSE;
+ if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
/* overwrite miCloseScreen with our own */
pScreen->CloseScreen = fbCloseScreen;
- if (bpp == 24 && imagebpp == 32)
- {
- pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
- pScreen->CreateScreenResources = fb24_32CreateScreenResources;
+ if (bpp == 24 && imagebpp == 32) {
+ pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
+ pScreen->CreateScreenResources = fb24_32CreateScreenResources;
}
return TRUE;
}
@@ -239,40 +222,33 @@ fbFinishScreenInit(ScreenPtr pScreen,
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
#ifdef FB_ACCESS_WRAPPER
Bool
-wfbScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp,
- SetupWrapProcPtr setupWrap,
- FinishWrapProcPtr finishWrap)
+wfbScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int bpp, SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap)
{
if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
- return FALSE;
+ return FALSE;
if (!wfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
- width, bpp, setupWrap, finishWrap))
- return FALSE;
+ width, bpp, setupWrap, finishWrap))
+ return FALSE;
return TRUE;
}
#else
Bool
-fbScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp)
+fbScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize, int dpix, int dpiy, int width, int bpp)
{
if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
- return FALSE;
- if (!fbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
- width, bpp))
- return FALSE;
+ return FALSE;
+ if (!fbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width, bpp))
+ return FALSE;
return TRUE;
}
#endif
diff --git a/fb/fbseg.c b/fb/fbseg.c
index 5a458fe51..0e4e0a9f7 100644
--- a/fb/fbseg.c
+++ b/fb/fbseg.c
@@ -34,477 +34,398 @@
FbStipRight(mask,bpp)))
void
-fbBresSolid (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresSolid(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbStip and = (FbStip) pPriv->and;
- FbStip xor = (FbStip) pPriv->xor;
- FbStip mask, mask0;
- FbStip bits;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbStip and = (FbStip) pPriv->and;
+ FbStip xor = (FbStip) pPriv->xor;
+ FbStip mask, mask0;
+ FbStip bits;
+
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
dst += ((y1 + dstYoff) * dstStride);
x1 = (x1 + dstXoff) * dstBpp;
dst += x1 >> FB_STIP_SHIFT;
x1 &= FB_STIP_MASK;
mask0 = FbStipMask(0, dstBpp);
- mask = FbStipRight (mask0, x1);
+ mask = FbStipRight(mask0, x1);
if (signdx < 0)
- mask0 = FbStipRight (mask0, FB_STIP_UNIT - dstBpp);
+ mask0 = FbStipRight(mask0, FB_STIP_UNIT - dstBpp);
if (signdy < 0)
- dstStride = -dstStride;
- if (axis == X_AXIS)
- {
- bits = 0;
- while (len--)
- {
- bits |= mask;
- mask = fbBresShiftMask(mask,signdx,dstBpp);
- if (!mask)
- {
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
- bits = 0;
- dst += signdx;
- mask = mask0;
- }
- e += e1;
- if (e >= 0)
- {
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
- bits = 0;
- dst += dstStride;
- e += e3;
- }
- }
- if (bits)
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
+ dstStride = -dstStride;
+ if (axis == X_AXIS) {
+ bits = 0;
+ while (len--) {
+ bits |= mask;
+ mask = fbBresShiftMask(mask, signdx, dstBpp);
+ if (!mask) {
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
+ bits = 0;
+ dst += signdx;
+ mask = mask0;
+ }
+ e += e1;
+ if (e >= 0) {
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
+ bits = 0;
+ dst += dstStride;
+ e += e3;
+ }
+ }
+ if (bits)
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
}
- else
- {
- while (len--)
- {
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, mask));
- dst += dstStride;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- mask = fbBresShiftMask(mask,signdx,dstBpp);
- if (!mask)
- {
- dst += signdx;
- mask = mask0;
- }
- }
- }
+ else {
+ while (len--) {
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
+ dst += dstStride;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ mask = fbBresShiftMask(mask, signdx, dstBpp);
+ if (!mask) {
+ dst += signdx;
+ mask = mask0;
+ }
+ }
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbBresDash (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresDash(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbStip and = (FbStip) pPriv->and;
- FbStip xor = (FbStip) pPriv->xor;
- FbStip bgand = (FbStip) pPriv->bgand;
- FbStip bgxor = (FbStip) pPriv->bgxor;
- FbStip mask, mask0;
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbStip and = (FbStip) pPriv->and;
+ FbStip xor = (FbStip) pPriv->xor;
+ FbStip bgand = (FbStip) pPriv->bgand;
+ FbStip bgxor = (FbStip) pPriv->bgxor;
+ FbStip mask, mask0;
+
FbDashDeclare;
- int dashlen;
- Bool even;
- Bool doOdd;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ int dashlen;
+ Bool even;
+ Bool doOdd;
+
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
doOdd = pGC->lineStyle == LineDoubleDash;
- FbDashInit (pGC, pPriv, dashOffset, dashlen, even);
-
+ FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
+
dst += ((y1 + dstYoff) * dstStride);
x1 = (x1 + dstXoff) * dstBpp;
dst += x1 >> FB_STIP_SHIFT;
x1 &= FB_STIP_MASK;
mask0 = FbStipMask(0, dstBpp);
- mask = FbStipRight (mask0, x1);
+ mask = FbStipRight(mask0, x1);
if (signdx < 0)
- mask0 = FbStipRight (mask0, FB_STIP_UNIT - dstBpp);
+ mask0 = FbStipRight(mask0, FB_STIP_UNIT - dstBpp);
if (signdy < 0)
- dstStride = -dstStride;
- while (len--)
- {
- if (even)
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, mask));
- else if (doOdd)
- WRITE(dst, FbDoMaskRRop (READ(dst), bgand, bgxor, mask));
- if (axis == X_AXIS)
- {
- mask = fbBresShiftMask(mask,signdx,dstBpp);
- if (!mask)
- {
- dst += signdx;
- mask = mask0;
- }
- e += e1;
- if (e >= 0)
- {
- dst += dstStride;
- e += e3;
- }
- }
- else
- {
- dst += dstStride;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- mask = fbBresShiftMask(mask,signdx,dstBpp);
- if (!mask)
- {
- dst += signdx;
- mask = mask0;
- }
- }
- }
- FbDashStep (dashlen, even);
+ dstStride = -dstStride;
+ while (len--) {
+ if (even)
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
+ else if (doOdd)
+ WRITE(dst, FbDoMaskRRop(READ(dst), bgand, bgxor, mask));
+ if (axis == X_AXIS) {
+ mask = fbBresShiftMask(mask, signdx, dstBpp);
+ if (!mask) {
+ dst += signdx;
+ mask = mask0;
+ }
+ e += e1;
+ if (e >= 0) {
+ dst += dstStride;
+ e += e3;
+ }
+ }
+ else {
+ dst += dstStride;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ mask = fbBresShiftMask(mask, signdx, dstBpp);
+ if (!mask) {
+ dst += signdx;
+ mask = mask0;
+ }
+ }
+ }
+ FbDashStep(dashlen, even);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbBresFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresFill(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- while (len--)
- {
- fbFill (pDrawable, pGC, x1, y1, 1, 1);
- if (axis == X_AXIS)
- {
- x1 += signdx;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- y1 += signdy;
- }
- }
- else
- {
- y1 += signdy;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- x1 += signdx;
- }
- }
+ while (len--) {
+ fbFill(pDrawable, pGC, x1, y1, 1, 1);
+ if (axis == X_AXIS) {
+ x1 += signdx;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ y1 += signdy;
+ }
+ }
+ else {
+ y1 += signdy;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ x1 += signdx;
+ }
+ }
}
}
static void
-fbSetFg (DrawablePtr pDrawable,
- GCPtr pGC,
- Pixel fg)
+fbSetFg(DrawablePtr pDrawable, GCPtr pGC, Pixel fg)
{
- if (fg != pGC->fgPixel)
- {
- ChangeGCVal val;
- val.val = fg;
- ChangeGC (NullClient, pGC, GCForeground, &val);
- ValidateGC (pDrawable, pGC);
+ if (fg != pGC->fgPixel) {
+ ChangeGCVal val;
+
+ val.val = fg;
+ ChangeGC(NullClient, pGC, GCForeground, &val);
+ ValidateGC(pDrawable, pGC);
}
}
void
-fbBresFillDash (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresFillDash(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+
FbDashDeclare;
- int dashlen;
- Bool even;
- Bool doOdd;
- Bool doBg;
- Pixel fg, bg;
-
+ int dashlen;
+ Bool even;
+ Bool doOdd;
+ Bool doBg;
+ Pixel fg, bg;
+
fg = pGC->fgPixel;
bg = pGC->bgPixel;
-
+
/* whether to fill the odd dashes */
doOdd = pGC->lineStyle == LineDoubleDash;
/* whether to switch fg to bg when filling odd dashes */
- doBg = doOdd && (pGC->fillStyle == FillSolid ||
- pGC->fillStyle == FillStippled);
-
+ doBg = doOdd && (pGC->fillStyle == FillSolid ||
+ pGC->fillStyle == FillStippled);
+
/* compute current dash position */
- FbDashInit (pGC, pPriv, dashOffset, dashlen, even);
-
- while (len--)
- {
- if (even || doOdd)
- {
- if (doBg)
- {
- if (even)
- fbSetFg (pDrawable, pGC, fg);
- else
- fbSetFg (pDrawable, pGC, bg);
- }
- fbFill (pDrawable, pGC, x1, y1, 1, 1);
- }
- if (axis == X_AXIS)
- {
- x1 += signdx;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- y1 += signdy;
- }
- }
- else
- {
- y1 += signdy;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- x1 += signdx;
- }
- }
- FbDashStep (dashlen, even);
+ FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
+
+ while (len--) {
+ if (even || doOdd) {
+ if (doBg) {
+ if (even)
+ fbSetFg(pDrawable, pGC, fg);
+ else
+ fbSetFg(pDrawable, pGC, bg);
+ }
+ fbFill(pDrawable, pGC, x1, y1, 1, 1);
+ }
+ if (axis == X_AXIS) {
+ x1 += signdx;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ y1 += signdy;
+ }
+ }
+ else {
+ y1 += signdy;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ x1 += signdx;
+ }
+ }
+ FbDashStep(dashlen, even);
}
if (doBg)
- fbSetFg (pDrawable, pGC, fg);
+ fbSetFg(pDrawable, pGC, fg);
}
static void
-fbBresSolid24RRop (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresSolid24RRop(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbStip and = pPriv->and;
- FbStip xor = pPriv->xor;
- FbStip leftMask, rightMask;
- int nl;
- FbStip *d;
- int x;
- int rot;
- FbStip andT, xorT;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbStip and = pPriv->and;
+ FbStip xor = pPriv->xor;
+ FbStip leftMask, rightMask;
+ int nl;
+ FbStip *d;
+ int x;
+ int rot;
+ FbStip andT, xorT;
+
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
dst += ((y1 + dstYoff) * dstStride);
x1 = (x1 + dstXoff) * 24;
if (signdy < 0)
- dstStride = -dstStride;
+ dstStride = -dstStride;
signdx *= 24;
- while (len--)
- {
- d = dst + (x1 >> FB_STIP_SHIFT);
- x = x1 & FB_STIP_MASK;
- rot = FbFirst24Rot (x);
- andT = FbRot24Stip(and,rot);
- xorT = FbRot24Stip(xor,rot);
- FbMaskStip (x, 24, leftMask, nl, rightMask);
- if (leftMask)
- {
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
- d++;
- andT = FbNext24Stip (andT);
- xorT = FbNext24Stip (xorT);
- }
- if (rightMask)
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, rightMask));
- if (axis == X_AXIS)
- {
- x1 += signdx;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- dst += dstStride;
- }
- }
- else
- {
- dst += dstStride;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- x1 += signdx;
- }
- }
+ while (len--) {
+ d = dst + (x1 >> FB_STIP_SHIFT);
+ x = x1 & FB_STIP_MASK;
+ rot = FbFirst24Rot(x);
+ andT = FbRot24Stip(and, rot);
+ xorT = FbRot24Stip(xor, rot);
+ FbMaskStip(x, 24, leftMask, nl, rightMask);
+ if (leftMask) {
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
+ d++;
+ andT = FbNext24Stip(andT);
+ xorT = FbNext24Stip(xorT);
+ }
+ if (rightMask)
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
+ if (axis == X_AXIS) {
+ x1 += signdx;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ dst += dstStride;
+ }
+ }
+ else {
+ dst += dstStride;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ x1 += signdx;
+ }
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
static void
-fbBresDash24RRop (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresDash24RRop(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbStip andT, xorT;
- FbStip fgand = pPriv->and;
- FbStip fgxor = pPriv->xor;
- FbStip bgand = pPriv->bgand;
- FbStip bgxor = pPriv->bgxor;
- FbStip leftMask, rightMask;
- int nl;
- FbStip *d;
- int x;
- int rot;
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbStip andT, xorT;
+ FbStip fgand = pPriv->and;
+ FbStip fgxor = pPriv->xor;
+ FbStip bgand = pPriv->bgand;
+ FbStip bgxor = pPriv->bgxor;
+ FbStip leftMask, rightMask;
+ int nl;
+ FbStip *d;
+ int x;
+ int rot;
+
FbDashDeclare;
- int dashlen;
- Bool even;
- Bool doOdd;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ int dashlen;
+ Bool even;
+ Bool doOdd;
+
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
doOdd = pGC->lineStyle == LineDoubleDash;
/* compute current dash position */
FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
-
+
dst += ((y1 + dstYoff) * dstStride);
x1 = (x1 + dstXoff) * 24;
if (signdy < 0)
- dstStride = -dstStride;
+ dstStride = -dstStride;
signdx *= 24;
- while (len--)
- {
- if (even || doOdd)
- {
- if (even)
- {
- andT = fgand;
- xorT = fgxor;
- }
- else
- {
- andT = bgand;
- xorT = bgxor;
- }
- d = dst + (x1 >> FB_STIP_SHIFT);
- x = x1 & FB_STIP_MASK;
- rot = FbFirst24Rot (x);
- andT = FbRot24Stip (andT, rot);
- xorT = FbRot24Stip (xorT, rot);
- FbMaskStip (x, 24, leftMask, nl, rightMask);
- if (leftMask)
- {
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
- d++;
- andT = FbNext24Stip (andT);
- xorT = FbNext24Stip (xorT);
- }
- if (rightMask)
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, rightMask));
- }
- if (axis == X_AXIS)
- {
- x1 += signdx;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- dst += dstStride;
- }
- }
- else
- {
- dst += dstStride;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- x1 += signdx;
- }
- }
- FbDashStep (dashlen, even);
+ while (len--) {
+ if (even || doOdd) {
+ if (even) {
+ andT = fgand;
+ xorT = fgxor;
+ }
+ else {
+ andT = bgand;
+ xorT = bgxor;
+ }
+ d = dst + (x1 >> FB_STIP_SHIFT);
+ x = x1 & FB_STIP_MASK;
+ rot = FbFirst24Rot(x);
+ andT = FbRot24Stip(andT, rot);
+ xorT = FbRot24Stip(xorT, rot);
+ FbMaskStip(x, 24, leftMask, nl, rightMask);
+ if (leftMask) {
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
+ d++;
+ andT = FbNext24Stip(andT);
+ xorT = FbNext24Stip(xorT);
+ }
+ if (rightMask)
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
+ }
+ if (axis == X_AXIS) {
+ x1 += signdx;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ dst += dstStride;
+ }
+ }
+ else {
+ dst += dstStride;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ x1 += signdx;
+ }
+ }
+ FbDashStep(dashlen, even);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
/*
@@ -514,209 +435,193 @@ fbBresDash24RRop (DrawablePtr pDrawable,
*/
FbBres *
-fbSelectBres (DrawablePtr pDrawable,
- GCPtr pGC)
+fbSelectBres(DrawablePtr pDrawable, GCPtr pGC)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- int dstBpp = pDrawable->bitsPerPixel;
- FbBres * bres;
-
- if (pGC->lineStyle == LineSolid)
- {
- bres = fbBresFill;
- if (pGC->fillStyle == FillSolid)
- {
- bres = fbBresSolid;
- if (dstBpp == 24)
- bres = fbBresSolid24RRop;
- if (pPriv->and == 0)
- {
- switch (dstBpp) {
- case 8: bres = fbBresSolid8; break;
- case 16: bres = fbBresSolid16; break;
- case 24: bres = fbBresSolid24; break;
- case 32: bres = fbBresSolid32; break;
- }
- }
- }
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ int dstBpp = pDrawable->bitsPerPixel;
+ FbBres *bres;
+
+ if (pGC->lineStyle == LineSolid) {
+ bres = fbBresFill;
+ if (pGC->fillStyle == FillSolid) {
+ bres = fbBresSolid;
+ if (dstBpp == 24)
+ bres = fbBresSolid24RRop;
+ if (pPriv->and == 0) {
+ switch (dstBpp) {
+ case 8:
+ bres = fbBresSolid8;
+ break;
+ case 16:
+ bres = fbBresSolid16;
+ break;
+ case 24:
+ bres = fbBresSolid24;
+ break;
+ case 32:
+ bres = fbBresSolid32;
+ break;
+ }
+ }
+ }
}
- else
- {
- bres = fbBresFillDash;
- if (pGC->fillStyle == FillSolid)
- {
- bres = fbBresDash;
- if (dstBpp == 24)
- bres = fbBresDash24RRop;
- if (pPriv->and == 0 &&
- (pGC->lineStyle == LineOnOffDash || pPriv->bgand == 0))
- {
- switch (dstBpp) {
- case 8: bres = fbBresDash8; break;
- case 16: bres = fbBresDash16; break;
- case 24: bres = fbBresDash24; break;
- case 32: bres = fbBresDash32; break;
- }
- }
- }
+ else {
+ bres = fbBresFillDash;
+ if (pGC->fillStyle == FillSolid) {
+ bres = fbBresDash;
+ if (dstBpp == 24)
+ bres = fbBresDash24RRop;
+ if (pPriv->and == 0 &&
+ (pGC->lineStyle == LineOnOffDash || pPriv->bgand == 0)) {
+ switch (dstBpp) {
+ case 8:
+ bres = fbBresDash8;
+ break;
+ case 16:
+ bres = fbBresDash16;
+ break;
+ case 24:
+ bres = fbBresDash24;
+ break;
+ case 32:
+ bres = fbBresDash32;
+ break;
+ }
+ }
+ }
}
return bres;
}
void
-fbBres (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBres(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- (*fbSelectBres (pDrawable, pGC)) (pDrawable, pGC, dashOffset,
- signdx, signdy, axis, x1, y1,
- e, e1, e3, len);
+ (*fbSelectBres(pDrawable, pGC)) (pDrawable, pGC, dashOffset,
+ signdx, signdy, axis, x1, y1,
+ e, e1, e3, len);
}
void
-fbSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int x1,
- int y1,
- int x2,
- int y2,
- Bool drawLast,
- int *dashOffset)
+fbSegment(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x1, int y1, int x2, int y2, Bool drawLast, int *dashOffset)
{
- FbBres * bres;
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pBox;
- int nBox;
- int adx; /* abs values of dx and dy */
- int ady;
- int signdx; /* sign of dx and dy */
- int signdy;
- int e, e1, e2, e3; /* bresenham error and increments */
- int len; /* length of segment */
- int axis; /* major axis */
- int octant;
- int dashoff;
- int doff;
+ FbBres *bres;
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ BoxPtr pBox;
+ int nBox;
+ int adx; /* abs values of dx and dy */
+ int ady;
+ int signdx; /* sign of dx and dy */
+ int signdy;
+ int e, e1, e2, e3; /* bresenham error and increments */
+ int len; /* length of segment */
+ int axis; /* major axis */
+ int octant;
+ int dashoff;
+ int doff;
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- unsigned int oc1; /* outcode of point 1 */
- unsigned int oc2; /* outcode of point 2 */
-
- nBox = RegionNumRects (pClip);
- pBox = RegionRects (pClip);
-
- bres = fbSelectBres (pDrawable, pGC);
-
- CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
- 1, 1, octant);
-
- if (adx > ady)
- {
- axis = X_AXIS;
- e1 = ady << 1;
- e2 = e1 - (adx << 1);
- e = e1 - adx;
- len = adx;
+ unsigned int oc1; /* outcode of point 1 */
+ unsigned int oc2; /* outcode of point 2 */
+
+ nBox = RegionNumRects(pClip);
+ pBox = RegionRects(pClip);
+
+ bres = fbSelectBres(pDrawable, pGC);
+
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
+
+ if (adx > ady) {
+ axis = X_AXIS;
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ len = adx;
}
- else
- {
- axis = Y_AXIS;
- e1 = adx << 1;
- e2 = e1 - (ady << 1);
- e = e1 - ady;
- SetYMajorOctant(octant);
- len = ady;
+ else {
+ axis = Y_AXIS;
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ SetYMajorOctant(octant);
+ len = ady;
}
- FIXUP_ERROR (e, octant, bias);
-
+ FIXUP_ERROR(e, octant, bias);
+
/*
* Adjust error terms to compare against zero
*/
e3 = e2 - e1;
e = e - e1;
-
+
/* we have bresenham parameters and two points.
all we have to do now is clip and draw.
- */
+ */
if (drawLast)
- len++;
+ len++;
dashoff = *dashOffset;
*dashOffset = dashoff + len;
- while(nBox--)
- {
- oc1 = 0;
- oc2 = 0;
- OUTCODES(oc1, x1, y1, pBox);
- OUTCODES(oc2, x2, y2, pBox);
- if ((oc1 | oc2) == 0)
- {
- (*bres) (pDrawable, pGC, dashoff,
- signdx, signdy, axis, x1, y1,
- e, e1, e3, len);
- break;
- }
- else if (oc1 & oc2)
- {
- pBox++;
- }
- else
- {
- int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
- int clip1 = 0, clip2 = 0;
- int clipdx, clipdy;
- int err;
-
- if (miZeroClipLine(pBox->x1, pBox->y1, pBox->x2-1,
- pBox->y2-1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady, &clip1, &clip2,
- octant, bias, oc1, oc2) == -1)
- {
- pBox++;
- continue;
- }
-
- if (axis == X_AXIS)
- len = abs(new_x2 - new_x1);
- else
- len = abs(new_y2 - new_y1);
- if (clip2 != 0 || drawLast)
- len++;
- if (len)
- {
- /* unwind bresenham error term to first point */
- doff = dashoff;
- err = e;
- if (clip1)
- {
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- if (axis == X_AXIS)
- {
- doff += clipdx;
- err += e3 * clipdy + e1 * clipdx;
- }
- else
- {
- doff += clipdy;
- err += e3 * clipdx + e1 * clipdy;
- }
- }
- (*bres) (pDrawable, pGC, doff,
- signdx, signdy, axis, new_x1, new_y1,
- err, e1, e3, len);
- }
- pBox++;
- }
- } /* while (nBox--) */
+ while (nBox--) {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, x1, y1, pBox);
+ OUTCODES(oc2, x2, y2, pBox);
+ if ((oc1 | oc2) == 0) {
+ (*bres) (pDrawable, pGC, dashoff,
+ signdx, signdy, axis, x1, y1, e, e1, e3, len);
+ break;
+ }
+ else if (oc1 & oc2) {
+ pBox++;
+ }
+ else {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int clipdx, clipdy;
+ int err;
+
+ if (miZeroClipLine(pBox->x1, pBox->y1, pBox->x2 - 1,
+ pBox->y2 - 1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1) {
+ pBox++;
+ continue;
+ }
+
+ if (axis == X_AXIS)
+ len = abs(new_x2 - new_x1);
+ else
+ len = abs(new_y2 - new_y1);
+ if (clip2 != 0 || drawLast)
+ len++;
+ if (len) {
+ /* unwind bresenham error term to first point */
+ doff = dashoff;
+ err = e;
+ if (clip1) {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ if (axis == X_AXIS) {
+ doff += clipdx;
+ err += e3 * clipdy + e1 * clipdx;
+ }
+ else {
+ doff += clipdy;
+ err += e3 * clipdx + e1 * clipdy;
+ }
+ }
+ (*bres) (pDrawable, pGC, doff,
+ signdx, signdy, axis, new_x1, new_y1,
+ err, e1, e3, len);
+ }
+ pBox++;
+ }
+ } /* while (nBox--) */
}
diff --git a/fb/fbsetsp.c b/fb/fbsetsp.c
index 65ec8b874..e09d2e3f3 100644
--- a/fb/fbsetsp.c
+++ b/fb/fbsetsp.c
@@ -27,74 +27,58 @@
#include "fb.h"
void
-fbSetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted)
+fbSetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- FbBits *dst, *d, *s;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxPtr pbox;
- int n;
- int xoff;
- int x1, x2;
-
- if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth))
- {
- fb24_32SetSpans (pDrawable, pGC, src, ppt, pwidth, nspans, fSorted);
- return;
- }
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- while (nspans--)
- {
- d = dst + (ppt->y + dstYoff) * dstStride;
- xoff = (int) (((long) src) & (FB_MASK >> 3));
- s = (FbBits *) (src - xoff);
- xoff <<= 3;
- 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)
- fbBlt ((FbBits *) s,
- 0,
- (x1 - ppt->x) * dstBpp + xoff,
- d,
- dstStride,
- (x1 + dstXoff) * dstBpp,
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ FbBits *dst, *d, *s;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ BoxPtr pbox;
+ int n;
+ int xoff;
+ int x1, x2;
- (x2 - x1) * dstBpp,
- 1,
- pGC->alu,
- pPriv->pm,
- dstBpp,
-
- FALSE,
- FALSE);
- }
- }
- src += PixmapBytePad (*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
+ if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
+ fb24_32SetSpans(pDrawable, pGC, src, ppt, pwidth, nspans, fSorted);
+ return;
+ }
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ while (nspans--) {
+ d = dst + (ppt->y + dstYoff) * dstStride;
+ xoff = (int) (((long) src) & (FB_MASK >> 3));
+ s = (FbBits *) (src - xoff);
+ xoff <<= 3;
+ 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)
+ fbBlt((FbBits *) s,
+ 0,
+ (x1 - ppt->x) * dstBpp + xoff,
+ d,
+ dstStride,
+ (x1 + dstXoff) * dstBpp,
+ (x2 - x1) * dstBpp,
+ 1, pGC->alu, pPriv->pm, dstBpp, FALSE, FALSE);
+ }
+ }
+ src += PixmapBytePad(*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
}
- fbValidateDrawable (pDrawable);
- fbFinishAccess (pDrawable);
+ fbValidateDrawable(pDrawable);
+ fbFinishAccess(pDrawable);
}
-
diff --git a/fb/fbsolid.c b/fb/fbsolid.c
index 414378531..cad286a43 100644
--- a/fb/fbsolid.c
+++ b/fb/fbsolid.c
@@ -29,73 +29,56 @@
#include "fb.h"
void
-fbSolid (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int bpp,
-
- int width,
- int height,
-
- FbBits and,
- FbBits xor)
+fbSolid(FbBits * dst,
+ FbStride dstStride,
+ int dstX, int bpp, int width, int height, FbBits and, FbBits xor)
{
- FbBits startmask, endmask;
- int n, nmiddle;
- int startbyte, endbyte;
+ FbBits startmask, endmask;
+ int n, nmiddle;
+ int startbyte, endbyte;
- if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor)))
- {
- fbSolid24 (dst, dstStride, dstX, width, height, and, xor);
- return;
+ if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor))) {
+ fbSolid24(dst, dstStride, dstX, width, height, and, xor);
+ return;
}
dst += dstX >> FB_SHIFT;
dstX &= FB_MASK;
- FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte,
- nmiddle, endmask, endbyte);
+ FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte,
+ nmiddle, endmask, endbyte);
if (startmask)
- dstStride--;
+ dstStride--;
dstStride -= nmiddle;
- while (height--)
- {
- if (startmask)
- {
- FbDoLeftMaskByteRRop(dst,startbyte,startmask,and,xor);
- dst++;
- }
- n = nmiddle;
- if (!and)
- while (n--)
- WRITE(dst++, xor);
- else
- while (n--)
- {
- WRITE(dst, FbDoRRop (READ(dst), and, xor));
+ while (height--) {
+ if (startmask) {
+ FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
+ dst++;
+ }
+ n = nmiddle;
+ if (!and)
+ while (n--)
+ WRITE(dst++, xor);
+ else
+ while (n--) {
+ WRITE(dst, FbDoRRop(READ(dst), and, xor));
dst++;
- }
- if (endmask)
- FbDoRightMaskByteRRop(dst,endbyte,endmask,and,xor);
- dst += dstStride;
+ }
+ if (endmask)
+ FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
+ dst += dstStride;
}
}
void
-fbSolid24 (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbBits and,
- FbBits xor)
+fbSolid24(FbBits * dst,
+ FbStride dstStride,
+ int dstX, int width, int height, FbBits and, FbBits xor)
{
- FbBits startmask, endmask;
- FbBits xor0 = 0, xor1 = 0, xor2 = 0;
- FbBits and0 = 0, and1 = 0, and2 = 0;
- FbBits xorS = 0, andS = 0, xorE = 0, andE = 0;
- int n, nmiddle;
- int rotS, rot;
+ FbBits startmask, endmask;
+ FbBits xor0 = 0, xor1 = 0, xor2 = 0;
+ FbBits and0 = 0, and1 = 0, and2 = 0;
+ FbBits xorS = 0, andS = 0, xorE = 0, andE = 0;
+ int n, nmiddle;
+ int rotS, rot;
dst += dstX >> FB_SHIFT;
dstX &= FB_MASK;
@@ -103,107 +86,94 @@ fbSolid24 (FbBits *dst,
* Rotate pixel values this far across the word to align on
* screen pixel boundaries
*/
- rot = FbFirst24Rot (dstX);
- FbMaskBits (dstX, width, startmask, nmiddle, endmask);
+ rot = FbFirst24Rot(dstX);
+ FbMaskBits(dstX, width, startmask, nmiddle, endmask);
if (startmask)
- dstStride--;
+ dstStride--;
dstStride -= nmiddle;
-
+
/*
* Precompute rotated versions of the rasterop values
*/
rotS = rot;
- xor = FbRot24(xor,rotS);
- and = FbRot24(and,rotS);
- if (startmask)
- {
- xorS = xor;
- andS = and;
- xor = FbNext24Pix(xor);
- and = FbNext24Pix(and);
+ xor = FbRot24(xor, rotS);
+ and = FbRot24(and, rotS);
+ if (startmask) {
+ xorS = xor;
+ andS = and;
+ xor = FbNext24Pix(xor);
+ and = FbNext24Pix(and);
}
-
- if (nmiddle)
- {
- xor0 = xor;
- and0 = and;
- xor1 = FbNext24Pix(xor0);
- and1 = FbNext24Pix(and0);
- xor2 = FbNext24Pix(xor1);
- and2 = FbNext24Pix(and1);
+
+ if (nmiddle) {
+ xor0 = xor;
+ and0 = and;
+ xor1 = FbNext24Pix(xor0);
+ and1 = FbNext24Pix(and0);
+ xor2 = FbNext24Pix(xor1);
+ and2 = FbNext24Pix(and1);
}
-
- if (endmask)
- {
- switch (nmiddle % 3) {
- case 0:
- xorE = xor;
- andE = and;
- break;
- case 1:
- xorE = xor1;
- andE = and1;
- break;
- case 2:
- xorE = xor2;
- andE = and2;
- break;
- }
+
+ if (endmask) {
+ switch (nmiddle % 3) {
+ case 0:
+ xorE = xor;
+ andE = and;
+ break;
+ case 1:
+ xorE = xor1;
+ andE = and1;
+ break;
+ case 2:
+ xorE = xor2;
+ andE = and2;
+ break;
+ }
}
-
- while (height--)
- {
- if (startmask)
- {
- WRITE(dst, FbDoMaskRRop(READ(dst), andS, xorS, startmask));
+
+ while (height--) {
+ if (startmask) {
+ WRITE(dst, FbDoMaskRRop(READ(dst), andS, xorS, startmask));
dst++;
- }
- n = nmiddle;
- if (!and0)
- {
- while (n >= 3)
- {
- WRITE(dst++, xor0);
- WRITE(dst++, xor1);
- WRITE(dst++, xor2);
- n -= 3;
- }
- if (n)
- {
- WRITE(dst++, xor0);
- n--;
- if (n)
- {
- WRITE(dst++, xor1);
- }
- }
- }
- else
- {
- while (n >= 3)
- {
- WRITE(dst, FbDoRRop (READ(dst), and0, xor0));
+ }
+ n = nmiddle;
+ if (!and0) {
+ while (n >= 3) {
+ WRITE(dst++, xor0);
+ WRITE(dst++, xor1);
+ WRITE(dst++, xor2);
+ n -= 3;
+ }
+ if (n) {
+ WRITE(dst++, xor0);
+ n--;
+ if (n) {
+ WRITE(dst++, xor1);
+ }
+ }
+ }
+ else {
+ while (n >= 3) {
+ WRITE(dst, FbDoRRop(READ(dst), and0, xor0));
dst++;
- WRITE(dst, FbDoRRop (READ(dst), and1, xor1));
+ WRITE(dst, FbDoRRop(READ(dst), and1, xor1));
dst++;
- WRITE(dst, FbDoRRop (READ(dst), and2, xor2));
+ WRITE(dst, FbDoRRop(READ(dst), and2, xor2));
dst++;
- n -= 3;
- }
- if (n)
- {
- WRITE(dst, FbDoRRop (READ(dst), and0, xor0));
+ n -= 3;
+ }
+ if (n) {
+ WRITE(dst, FbDoRRop(READ(dst), and0, xor0));
dst++;
- n--;
- if (n)
- {
- WRITE(dst, FbDoRRop (READ(dst), and1, xor1));
+ n--;
+ if (n) {
+ WRITE(dst, FbDoRRop(READ(dst), and1, xor1));
dst++;
- }
- }
- }
- if (endmask)
- WRITE(dst, FbDoMaskRRop (READ(dst), andE, xorE, endmask));
- dst += dstStride;
+ }
+ }
+ }
+ if (endmask)
+ WRITE(dst, FbDoMaskRRop(READ(dst), andE, xorE, endmask));
+ dst += dstStride;
}
}
diff --git a/fb/fbstipple.c b/fb/fbstipple.c
index dc1fd468f..f6c84a212 100644
--- a/fb/fbstipple.c
+++ b/fb/fbstipple.c
@@ -42,29 +42,26 @@
#define LaneCases64(c,a) LaneCases32(c,a); LaneCases32(c+32,a)
#define LaneCases128(c,a) LaneCases64(c,a); LaneCases64(c+64,a)
#define LaneCases256(c,a) LaneCases128(c,a); LaneCases128(c+128,a)
-
+
#if FB_SHIFT == 6
#define LaneCases(a) LaneCases256(0,a)
#endif
-
+
#if FB_SHIFT == 5
#define LaneCases(a) LaneCases16(0,a)
#endif
-
+
/*
* Repeat a transparent stipple across a scanline n times
*/
void
-fbTransparentSpan (FbBits *dst,
- FbBits stip,
- FbBits fgxor,
- int n)
+fbTransparentSpan(FbBits * dst, FbBits stip, FbBits fgxor, int n)
{
- FbStip s;
+ FbStip s;
- s = ((FbStip) (stip ) & 0x01);
- s |= ((FbStip) (stip >> 8) & 0x02);
+ s = ((FbStip) (stip) & 0x01);
+ s |= ((FbStip) (stip >> 8) & 0x02);
s |= ((FbStip) (stip >> 16) & 0x04);
s |= ((FbStip) (stip >> 24) & 0x08);
#if FB_SHIFT > 5
@@ -74,235 +71,194 @@ fbTransparentSpan (FbBits *dst,
s |= ((FbStip) (stip >> 56) & 0x80);
#endif
switch (s) {
- LaneCases(dst);
+ LaneCases(dst);
}
}
void
-fbEvenStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipHeight,
-
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot)
+fbEvenStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipHeight,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
{
- FbBits startmask, endmask;
- FbBits mask, and, xor;
- int nmiddle, n;
- FbStip *s, *stipEnd, bits;
- int rot, stipX, stipY;
- int pixelsPerDst;
- const FbBits *fbBits;
- Bool transparent;
- int startbyte, endbyte;
-
+ FbBits startmask, endmask;
+ FbBits mask, and, xor;
+ int nmiddle, n;
+ FbStip *s, *stipEnd, bits;
+ int rot, stipX, stipY;
+ int pixelsPerDst;
+ const FbBits *fbBits;
+ Bool transparent;
+ int startbyte, endbyte;
+
/*
* Check for a transparent stipple (stencil)
*/
transparent = FALSE;
- if (dstBpp >= 8 &&
- fgand == 0 && bgand == FB_ALLONES && bgxor == 0)
- transparent = TRUE;
-
+ if (dstBpp >= 8 && fgand == 0 && bgand == FB_ALLONES && bgxor == 0)
+ transparent = TRUE;
+
pixelsPerDst = FB_UNIT / dstBpp;
/*
* Adjust dest pointers
*/
dst += dstX >> FB_SHIFT;
dstX &= FB_MASK;
- FbMaskBitsBytes (dstX, width, fgand == 0 && bgand == 0,
- startmask, startbyte, nmiddle, endmask, endbyte);
-
+ FbMaskBitsBytes(dstX, width, fgand == 0 && bgand == 0,
+ startmask, startbyte, nmiddle, endmask, endbyte);
+
if (startmask)
- dstStride--;
+ dstStride--;
dstStride -= nmiddle;
-
+
xRot *= dstBpp;
/*
* Compute stip start scanline and rotation parameters
*/
stipEnd = stip + stipStride * stipHeight;
- modulus (- yRot, stipHeight, stipY);
+ modulus(-yRot, stipHeight, stipY);
s = stip + stipStride * stipY;
- modulus (- xRot, FB_UNIT, stipX);
+ modulus(-xRot, FB_UNIT, stipX);
rot = stipX;
-
+
/*
* Get pointer to stipple mask array for this depth
*/
/* fbStippleTable covers all valid bpp (4,8,16,32) */
fbBits = fbStippleTable[pixelsPerDst];
-
- while (height--)
- {
- /*
- * Extract stipple bits for this scanline;
- */
- bits = READ(s);
- s += stipStride;
- if (s == stipEnd)
- s = stip;
+
+ while (height--) {
+ /*
+ * Extract stipple bits for this scanline;
+ */
+ bits = READ(s);
+ s += stipStride;
+ if (s == stipEnd)
+ s = stip;
#if FB_UNIT > 32
- if (pixelsPerDst == 16)
- mask = FbStipple16Bits(FbLeftStipBits(bits,16));
- else
+ if (pixelsPerDst == 16)
+ mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
+ else
#endif
- mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
- /*
- * Rotate into position and compute reduced rop values
- */
- mask = FbRotLeft(mask, rot);
- and = (fgand & mask) | (bgand & ~mask);
- xor = (fgxor & mask) | (bgxor & ~mask);
-
- if (transparent)
- {
- if (startmask)
- {
- fbTransparentSpan(dst, mask&startmask, fgxor, 1);
- dst++;
- }
- fbTransparentSpan (dst, mask, fgxor, nmiddle);
- dst += nmiddle;
- if (endmask)
- fbTransparentSpan(dst, mask&endmask, fgxor, 1);
- }
- else
- {
- /*
- * Fill scanline
- */
- if (startmask)
- {
- FbDoLeftMaskByteRRop (dst, startbyte, startmask, and, xor);
- dst++;
- }
- n = nmiddle;
- if (!and)
- while (n--)
- WRITE(dst++, xor);
- else
- {
- while (n--)
- {
- WRITE(dst, FbDoRRop (READ(dst), and, xor));
- dst++;
- }
- }
- if (endmask)
- FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
- }
- dst += dstStride;
+ mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+ /*
+ * Rotate into position and compute reduced rop values
+ */
+ mask = FbRotLeft(mask, rot);
+ and = (fgand & mask) | (bgand & ~mask);
+ xor = (fgxor & mask) | (bgxor & ~mask);
+
+ if (transparent) {
+ if (startmask) {
+ fbTransparentSpan(dst, mask & startmask, fgxor, 1);
+ dst++;
+ }
+ fbTransparentSpan(dst, mask, fgxor, nmiddle);
+ dst += nmiddle;
+ if (endmask)
+ fbTransparentSpan(dst, mask & endmask, fgxor, 1);
+ }
+ else {
+ /*
+ * Fill scanline
+ */
+ if (startmask) {
+ FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
+ dst++;
+ }
+ n = nmiddle;
+ if (!and)
+ while (n--)
+ WRITE(dst++, xor);
+ else {
+ while (n--) {
+ WRITE(dst, FbDoRRop(READ(dst), and, xor));
+ dst++;
+ }
+ }
+ if (endmask)
+ FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
+ }
+ dst += dstStride;
}
}
void
-fbOddStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipWidth,
- int stipHeight,
-
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot)
+fbOddStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipWidth,
+ int stipHeight,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
{
- int stipX, stipY, sx;
- int widthTmp;
- int h, w;
- int x, y;
+ int stipX, stipY, sx;
+ int widthTmp;
+ int h, w;
+ int x, y;
- modulus (- yRot, stipHeight, stipY);
- modulus (dstX / dstBpp - xRot, stipWidth, stipX);
+ modulus(-yRot, stipHeight, stipY);
+ modulus(dstX / dstBpp - xRot, stipWidth, stipX);
y = 0;
- while (height)
- {
- h = stipHeight - stipY;
- if (h > height)
- h = height;
- height -= h;
- widthTmp = width;
- x = dstX;
- sx = stipX;
- while (widthTmp)
- {
- w = (stipWidth - sx) * dstBpp;
- if (w > widthTmp)
- w = widthTmp;
- widthTmp -= w;
- fbBltOne (stip + stipY * stipStride,
- stipStride,
- sx,
-
- dst + y * dstStride,
- dstStride,
- x,
- dstBpp,
-
- w, h,
-
- fgand, fgxor, bgand, bgxor);
- x += w;
- sx = 0;
- }
- y += h;
- stipY = 0;
+ while (height) {
+ h = stipHeight - stipY;
+ if (h > height)
+ h = height;
+ height -= h;
+ widthTmp = width;
+ x = dstX;
+ sx = stipX;
+ while (widthTmp) {
+ w = (stipWidth - sx) * dstBpp;
+ if (w > widthTmp)
+ w = widthTmp;
+ widthTmp -= w;
+ fbBltOne(stip + stipY * stipStride,
+ stipStride,
+ sx,
+ dst + y * dstStride,
+ dstStride, x, dstBpp, w, h, fgand, fgxor, bgand, bgxor);
+ x += w;
+ sx = 0;
+ }
+ y += h;
+ stipY = 0;
}
}
void
-fbStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipWidth,
- int stipHeight,
- Bool even,
-
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot)
+fbStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipWidth,
+ int stipHeight,
+ Bool even,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
{
if (even)
- fbEvenStipple (dst, dstStride, dstX, dstBpp, width, height,
- stip, stipStride, stipHeight,
- fgand, fgxor, bgand, bgxor, xRot, yRot);
+ fbEvenStipple(dst, dstStride, dstX, dstBpp, width, height,
+ stip, stipStride, stipHeight,
+ fgand, fgxor, bgand, bgxor, xRot, yRot);
else
- fbOddStipple (dst, dstStride, dstX, dstBpp, width, height,
- stip, stipStride, stipWidth, stipHeight,
- fgand, fgxor, bgand, bgxor, xRot, yRot);
+ fbOddStipple(dst, dstStride, dstX, dstBpp, width, height,
+ stip, stipStride, stipWidth, stipHeight,
+ fgand, fgxor, bgand, bgxor, xRot, yRot);
}
diff --git a/fb/fbtile.c b/fb/fbtile.c
index 05a27a17b..785c5f0e4 100644
--- a/fb/fbtile.c
+++ b/fb/fbtile.c
@@ -32,172 +32,132 @@
*/
void
-fbEvenTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbBits *tile,
- FbStride tileStride,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int xRot,
- int yRot)
+fbEvenTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileHeight, int alu, FbBits pm, int xRot, int yRot)
{
- FbBits *t, *tileEnd, bits;
- FbBits startmask, endmask;
- FbBits and, xor;
- int n, nmiddle;
- int tileX, tileY;
- int rot;
- int startbyte, endbyte;
+ FbBits *t, *tileEnd, bits;
+ FbBits startmask, endmask;
+ FbBits and, xor;
+ int n, nmiddle;
+ int tileX, tileY;
+ int rot;
+ int startbyte, endbyte;
dst += dstX >> FB_SHIFT;
dstX &= FB_MASK;
FbMaskBitsBytes(dstX, width, FbDestInvarientRop(alu, pm),
- startmask, startbyte, nmiddle, endmask, endbyte);
+ startmask, startbyte, nmiddle, endmask, endbyte);
if (startmask)
- dstStride--;
+ dstStride--;
dstStride -= nmiddle;
-
+
/*
* Compute tile start scanline and rotation parameters
*/
tileEnd = tile + tileHeight * tileStride;
- modulus (- yRot, tileHeight, tileY);
+ modulus(-yRot, tileHeight, tileY);
t = tile + tileY * tileStride;
- modulus (- xRot, FB_UNIT, tileX);
+ modulus(-xRot, FB_UNIT, tileX);
rot = tileX;
-
- while (height--)
- {
-
- /*
- * Pick up bits for this scanline
- */
- bits = READ(t);
- t += tileStride;
- if (t >= tileEnd) t = tile;
- bits = FbRotLeft(bits,rot);
- and = fbAnd(alu,bits,pm);
- xor = fbXor(alu,bits,pm);
-
- if (startmask)
- {
- FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
- dst++;
- }
- n = nmiddle;
- if (!and)
- while (n--)
- WRITE(dst++, xor);
- else
- while (n--)
- {
- WRITE(dst, FbDoRRop (READ(dst), and, xor));
- dst++;
- }
- if (endmask)
- FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
- dst += dstStride;
+
+ while (height--) {
+
+ /*
+ * Pick up bits for this scanline
+ */
+ bits = READ(t);
+ t += tileStride;
+ if (t >= tileEnd)
+ t = tile;
+ bits = FbRotLeft(bits, rot);
+ and = fbAnd(alu, bits, pm);
+ xor = fbXor(alu, bits, pm);
+
+ if (startmask) {
+ FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
+ dst++;
+ }
+ n = nmiddle;
+ if (!and)
+ while (n--)
+ WRITE(dst++, xor);
+ else
+ while (n--) {
+ WRITE(dst, FbDoRRop(READ(dst), and, xor));
+ dst++;
+ }
+ if (endmask)
+ FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
+ dst += dstStride;
}
}
-
-void
-fbOddTile(FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
- FbBits *tile,
- FbStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int bpp,
-
- int xRot,
- int yRot)
+void
+fbOddTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileWidth,
+ int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot)
{
- int tileX, tileY;
- int widthTmp;
- int h, w;
- int x, y;
+ int tileX, tileY;
+ int widthTmp;
+ int h, w;
+ int x, y;
- modulus (- yRot, tileHeight, tileY);
+ modulus(-yRot, tileHeight, tileY);
y = 0;
- while (height)
- {
- h = tileHeight - tileY;
- if (h > height)
- h = height;
- height -= h;
- widthTmp = width;
- x = dstX;
- modulus (dstX - xRot, tileWidth, tileX);
- while (widthTmp)
- {
- w = tileWidth - tileX;
- if (w > widthTmp)
- w = widthTmp;
- widthTmp -= w;
- fbBlt (tile + tileY * tileStride,
- tileStride,
- tileX,
-
- dst + y * dstStride,
- dstStride,
- x,
-
- w, h,
- alu,
- pm,
- bpp,
-
- FALSE,
- FALSE);
- x += w;
- tileX = 0;
- }
- y += h;
- tileY = 0;
+ while (height) {
+ h = tileHeight - tileY;
+ if (h > height)
+ h = height;
+ height -= h;
+ widthTmp = width;
+ x = dstX;
+ modulus(dstX - xRot, tileWidth, tileX);
+ while (widthTmp) {
+ w = tileWidth - tileX;
+ if (w > widthTmp)
+ w = widthTmp;
+ widthTmp -= w;
+ fbBlt(tile + tileY * tileStride,
+ tileStride,
+ tileX,
+ dst + y * dstStride,
+ dstStride, x, w, h, alu, pm, bpp, FALSE, FALSE);
+ x += w;
+ tileX = 0;
+ }
+ y += h;
+ tileY = 0;
}
}
void
-fbTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbBits *tile,
- FbStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int bpp,
-
- int xRot,
- int yRot)
+fbTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileWidth,
+ int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot)
{
- if (FbEvenTile (tileWidth))
- fbEvenTile (dst, dstStride, dstX, width, height,
- tile, tileStride, tileHeight,
- alu, pm, xRot, yRot);
+ if (FbEvenTile(tileWidth))
+ fbEvenTile(dst, dstStride, dstX, width, height,
+ tile, tileStride, tileHeight, alu, pm, xRot, yRot);
else
- fbOddTile (dst, dstStride, dstX, width, height,
- tile, tileStride, tileWidth, tileHeight,
- alu, pm, bpp, xRot, yRot);
+ fbOddTile(dst, dstStride, dstX, width, height,
+ tile, tileStride, tileWidth, tileHeight,
+ alu, pm, bpp, xRot, yRot);
}
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 0b5a6382e..bf82f8f2c 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -32,184 +32,154 @@
#include "damage.h"
void
-fbAddTraps (PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off,
- int ntrap,
- xTrap *traps)
+fbAddTraps(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
{
pixman_image_t *image;
int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
- return;
-
- pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
- ntrap, (pixman_trap_t *)traps);
+ if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ return;
- free_pixman_pict (pPicture, image);
+ pixman_add_traps(image, x_off + dst_xoff, y_off + dst_yoff,
+ ntrap, (pixman_trap_t *) traps);
+
+ free_pixman_pict(pPicture, image);
}
void
-fbRasterizeTrapezoid (PicturePtr pPicture,
- xTrapezoid *trap,
- int x_off,
- int y_off)
+fbRasterizeTrapezoid(PicturePtr pPicture,
+ xTrapezoid * trap, int x_off, int y_off)
{
pixman_image_t *image;
- int dst_xoff, dst_yoff;
+ int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
- return;
+ if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ return;
- pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
- x_off + dst_xoff,
- y_off + dst_yoff);
+ pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *) trap,
+ x_off + dst_xoff, y_off + dst_yoff);
- free_pixman_pict (pPicture, image);
+ free_pixman_pict(pPicture, image);
}
void
-fbAddTriangles (PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off,
- int ntri,
- xTriangle *tris)
+fbAddTriangles(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntri, xTriangle * tris)
{
pixman_image_t *image;
int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
- return;
-
- pixman_add_triangles (image,
- dst_xoff + x_off, dst_yoff + y_off,
- ntri, (pixman_triangle_t *)tris);
+ if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ return;
+
+ pixman_add_triangles(image,
+ dst_xoff + x_off, dst_yoff + y_off,
+ ntri, (pixman_triangle_t *) tris);
- free_pixman_pict (pPicture, image);
+ free_pixman_pict(pPicture, image);
}
-typedef void (* CompositeShapesFunc) (pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *dst,
- pixman_format_code_t mask_format,
- int x_src, int y_src,
- int x_dst, int y_dst,
- int n_shapes, const uint8_t *shapes);
+typedef void (*CompositeShapesFunc) (pixman_op_t op,
+ pixman_image_t * src,
+ pixman_image_t * dst,
+ pixman_format_code_t mask_format,
+ int x_src, int y_src,
+ int x_dst, int y_dst,
+ int n_shapes, const uint8_t * shapes);
static void
-fbShapes (CompositeShapesFunc composite,
- pixman_op_t op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- int16_t xSrc,
- int16_t ySrc,
- int nshapes,
- int shape_size,
- const uint8_t * shapes)
+fbShapes(CompositeShapesFunc composite,
+ pixman_op_t op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ int16_t xSrc,
+ int16_t ySrc, int nshapes, int shape_size, const uint8_t * shapes)
{
pixman_image_t *src, *dst;
int src_xoff, src_yoff;
int dst_xoff, dst_yoff;
- miCompositeSourceValidate (pSrc);
-
- src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
- dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
-
- if (src && dst)
- {
- pixman_format_code_t format;
-
- DamageRegionAppend (pDst->pDrawable, pDst->pCompositeClip);
-
- if (!maskFormat)
- {
- int i;
-
- if (pDst->polyEdge == PolyEdgeSharp)
- format = PIXMAN_a1;
- else
- format = PIXMAN_a8;
-
- for (i = 0; i < nshapes; ++i)
- {
- composite (op, src, dst, format,
- xSrc + src_xoff,
- ySrc + src_yoff,
- dst_xoff,
- dst_yoff,
- 1, shapes + i * shape_size);
- }
- }
- else
- {
- switch (PICT_FORMAT_A (maskFormat->format))
- {
- case 1:
- format = PIXMAN_a1;
- break;
-
- case 4:
- format = PIXMAN_a4;
- break;
-
- default:
- case 8:
- format = PIXMAN_a8;
- break;
- }
-
- composite (op, src, dst, format,
- xSrc + src_xoff,
- ySrc + src_yoff,
- dst_xoff,
- dst_yoff,
- nshapes, shapes);
- }
-
- DamageRegionProcessPending (pDst->pDrawable);
+ miCompositeSourceValidate(pSrc);
+
+ src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff);
+ dst = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff);
+
+ if (src && dst) {
+ pixman_format_code_t format;
+
+ DamageRegionAppend(pDst->pDrawable, pDst->pCompositeClip);
+
+ if (!maskFormat) {
+ int i;
+
+ if (pDst->polyEdge == PolyEdgeSharp)
+ format = PIXMAN_a1;
+ else
+ format = PIXMAN_a8;
+
+ for (i = 0; i < nshapes; ++i) {
+ composite(op, src, dst, format,
+ xSrc + src_xoff,
+ ySrc + src_yoff,
+ dst_xoff, dst_yoff, 1, shapes + i * shape_size);
+ }
+ }
+ else {
+ switch (PICT_FORMAT_A(maskFormat->format)) {
+ case 1:
+ format = PIXMAN_a1;
+ break;
+
+ case 4:
+ format = PIXMAN_a4;
+ break;
+
+ default:
+ case 8:
+ format = PIXMAN_a8;
+ break;
+ }
+
+ composite(op, src, dst, format,
+ xSrc + src_xoff,
+ ySrc + src_yoff, dst_xoff, dst_yoff, nshapes, shapes);
+ }
+
+ DamageRegionProcessPending(pDst->pDrawable);
}
- free_pixman_pict (pSrc, src);
- free_pixman_pict (pDst, dst);
+ free_pixman_pict(pSrc, src);
+ free_pixman_pict(pDst, dst);
}
void
-fbTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps)
+fbTrapezoids(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps)
{
xSrc -= (traps[0].left.p1.x >> 16);
ySrc -= (traps[0].left.p1.y >> 16);
-
- fbShapes ((CompositeShapesFunc)pixman_composite_trapezoids,
- op, pSrc, pDst, maskFormat,
- xSrc, ySrc,
- ntrap, sizeof (xTrapezoid), (const uint8_t *)traps);
+
+ fbShapes((CompositeShapesFunc) pixman_composite_trapezoids,
+ op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, ntrap, sizeof(xTrapezoid), (const uint8_t *) traps);
}
void
-fbTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntris,
- xTriangle *tris)
-{
+fbTriangles(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
+{
xSrc -= (tris[0].p1.x >> 16);
ySrc -= (tris[0].p1.y >> 16);
-
- fbShapes ((CompositeShapesFunc)pixman_composite_triangles,
- op, pSrc, pDst, maskFormat,
- xSrc, ySrc,
- ntris, sizeof (xTriangle), (const uint8_t *)tris);
+
+ fbShapes((CompositeShapesFunc) pixman_composite_triangles,
+ op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, ntris, sizeof(xTriangle), (const uint8_t *) tris);
}
diff --git a/fb/fbutil.c b/fb/fbutil.c
index 5e232971e..2ca80d1c9 100644
--- a/fb/fbutil.c
+++ b/fb/fbutil.c
@@ -27,91 +27,89 @@
#include "fb.h"
FbBits
-fbReplicatePixel (Pixel p, int bpp)
+fbReplicatePixel(Pixel p, int bpp)
{
- FbBits b = p;
-
- b &= FbFullMask (bpp);
- while (bpp < FB_UNIT)
- {
- b |= b << bpp;
- bpp <<= 1;
+ FbBits b = p;
+
+ b &= FbFullMask(bpp);
+ while (bpp < FB_UNIT) {
+ b |= b << bpp;
+ bpp <<= 1;
}
return b;
}
void
-fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp)
+fbReduceRasterOp(int rop, FbBits fg, FbBits pm, FbBits * andp, FbBits * xorp)
{
- FbBits and, xor;
+ FbBits and, xor;
- switch (rop)
- {
+ switch (rop) {
default:
- case GXclear: /* 0 0 0 0 */
- and = 0;
- xor = 0;
- break;
- case GXand: /* 0 0 0 1 */
- and = fg;
- xor = 0;
- break;
- case GXandReverse: /* 0 0 1 0 */
- and = fg;
- xor = fg;
- break;
- case GXcopy: /* 0 0 1 1 */
- and = 0;
- xor = fg;
- break;
- case GXandInverted: /* 0 1 0 0 */
- and = ~fg;
- xor = 0;
- break;
- case GXnoop: /* 0 1 0 1 */
- and = FB_ALLONES;
- xor = 0;
- break;
- case GXxor: /* 0 1 1 0 */
- and = FB_ALLONES;
- xor = fg;
- break;
- case GXor: /* 0 1 1 1 */
- and = ~fg;
- xor = fg;
- break;
- case GXnor: /* 1 0 0 0 */
- and = ~fg;
- xor = ~fg;
- break;
- case GXequiv: /* 1 0 0 1 */
- and = FB_ALLONES;
- xor = ~fg;
- break;
- case GXinvert: /* 1 0 1 0 */
- and = FB_ALLONES;
- xor = FB_ALLONES;
- break;
- case GXorReverse: /* 1 0 1 1 */
- and = ~fg;
- xor = FB_ALLONES;
- break;
- case GXcopyInverted: /* 1 1 0 0 */
- and = 0;
- xor = ~fg;
- break;
- case GXorInverted: /* 1 1 0 1 */
- and = fg;
- xor = ~fg;
- break;
- case GXnand: /* 1 1 1 0 */
- and = fg;
- xor = FB_ALLONES;
- break;
- case GXset: /* 1 1 1 1 */
- and = 0;
- xor = FB_ALLONES;
- break;
+ case GXclear: /* 0 0 0 0 */
+ and = 0;
+ xor = 0;
+ break;
+ case GXand: /* 0 0 0 1 */
+ and = fg;
+ xor = 0;
+ break;
+ case GXandReverse: /* 0 0 1 0 */
+ and = fg;
+ xor = fg;
+ break;
+ case GXcopy: /* 0 0 1 1 */
+ and = 0;
+ xor = fg;
+ break;
+ case GXandInverted: /* 0 1 0 0 */
+ and = ~fg;
+ xor = 0;
+ break;
+ case GXnoop: /* 0 1 0 1 */
+ and = FB_ALLONES;
+ xor = 0;
+ break;
+ case GXxor: /* 0 1 1 0 */
+ and = FB_ALLONES;
+ xor = fg;
+ break;
+ case GXor: /* 0 1 1 1 */
+ and = ~fg;
+ xor = fg;
+ break;
+ case GXnor: /* 1 0 0 0 */
+ and = ~fg;
+ xor = ~fg;
+ break;
+ case GXequiv: /* 1 0 0 1 */
+ and = FB_ALLONES;
+ xor = ~fg;
+ break;
+ case GXinvert: /* 1 0 1 0 */
+ and = FB_ALLONES;
+ xor = FB_ALLONES;
+ break;
+ case GXorReverse: /* 1 0 1 1 */
+ and = ~fg;
+ xor = FB_ALLONES;
+ break;
+ case GXcopyInverted: /* 1 1 0 0 */
+ and = 0;
+ xor = ~fg;
+ break;
+ case GXorInverted: /* 1 1 0 1 */
+ and = fg;
+ xor = ~fg;
+ break;
+ case GXnand: /* 1 1 1 0 */
+ and = fg;
+ xor = FB_ALLONES;
+ break;
+ case GXset: /* 1 1 1 1 */
+ and = 0;
+ xor = FB_ALLONES;
+ break;
}
and |= ~pm;
xor &= pm;
@@ -123,22 +121,22 @@ fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp)
#define I FB_ALLONES
const FbMergeRopRec FbMergeRopBits[16] = {
- { O,O,O,O }, /* clear 0x0 0 */
- { I,O,O,O }, /* and 0x1 src AND dst */
- { I,O,I,O }, /* andReverse 0x2 src AND NOT dst */
- { O,O,I,O }, /* copy 0x3 src */
- { I,I,O,O }, /* andInverted 0x4 NOT src AND dst */
- { O,I,O,O }, /* noop 0x5 dst */
- { O,I,I,O }, /* xor 0x6 src XOR dst */
- { I,I,I,O }, /* or 0x7 src OR dst */
- { I,I,I,I }, /* nor 0x8 NOT src AND NOT dst */
- { O,I,I,I }, /* equiv 0x9 NOT src XOR dst */
- { O,I,O,I }, /* invert 0xa NOT dst */
- { I,I,O,I }, /* orReverse 0xb src OR NOT dst */
- { O,O,I,I }, /* copyInverted 0xc NOT src */
- { I,O,I,I }, /* orInverted 0xd NOT src OR dst */
- { I,O,O,I }, /* nand 0xe NOT src OR NOT dst */
- { O,O,O,I }, /* set 0xf 1 */
+ {O, O, O, O}, /* clear 0x0 0 */
+ {I, O, O, O}, /* and 0x1 src AND dst */
+ {I, O, I, O}, /* andReverse 0x2 src AND NOT dst */
+ {O, O, I, O}, /* copy 0x3 src */
+ {I, I, O, O}, /* andInverted 0x4 NOT src AND dst */
+ {O, I, O, O}, /* noop 0x5 dst */
+ {O, I, I, O}, /* xor 0x6 src XOR dst */
+ {I, I, I, O}, /* or 0x7 src OR dst */
+ {I, I, I, I}, /* nor 0x8 NOT src AND NOT dst */
+ {O, I, I, I}, /* equiv 0x9 NOT src XOR dst */
+ {O, I, O, I}, /* invert 0xa NOT dst */
+ {I, I, O, I}, /* orReverse 0xb src OR NOT dst */
+ {O, O, I, I}, /* copyInverted 0xc NOT src */
+ {I, O, I, I}, /* orInverted 0xd NOT src OR dst */
+ {I, O, O, I}, /* nand 0xe NOT src OR NOT dst */
+ {O, O, O, I}, /* set 0xf 1 */
};
/*
@@ -151,7 +149,6 @@ const FbMergeRopRec FbMergeRopBits[16] = {
#define Mask(x,w) BitsMask((x)*(w),(w))
-
#define SelMask(b,n,w) ((((b) >> n) & 1) * Mask(n,w))
#define C1(b,w) \
@@ -181,175 +178,187 @@ const FbMergeRopRec FbMergeRopBits[16] = {
#define fbStipple16Bits 0
#define fbStipple8Bits 0
const FbBits fbStipple4Bits[16] = {
- C4( 0,4), C4( 1,4), C4( 2,4), C4( 3,4), C4( 4,4), C4( 5,4),
- C4( 6,4), C4( 7,4), C4( 8,4), C4( 9,4), C4( 10,4), C4( 11,4),
- C4( 12,4), C4( 13,4), C4( 14,4), C4( 15,4),};
+ C4(0, 4), C4(1, 4), C4(2, 4), C4(3, 4), C4(4, 4), C4(5, 4),
+ C4(6, 4), C4(7, 4), C4(8, 4), C4(9, 4), C4(10, 4), C4(11, 4),
+ C4(12, 4), C4(13, 4), C4(14, 4), C4(15, 4),
+};
+
const FbBits fbStipple2Bits[4] = {
- C2( 0,8), C2( 1,8), C2( 2,8), C2( 3,8),
+ C2(0, 8), C2(1, 8), C2(2, 8), C2(3, 8),
};
+
const FbBits fbStipple1Bits[2] = {
- C1( 0,16), C1( 1,16),
+ C1(0, 16), C1(1, 16),
};
#endif
#if FB_UNIT == 32
#define fbStipple16Bits 0
const FbBits fbStipple8Bits[256] = {
- C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4),
- C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4),
- C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4),
- C8( 18,4), C8( 19,4), C8( 20,4), C8( 21,4), C8( 22,4), C8( 23,4),
- C8( 24,4), C8( 25,4), C8( 26,4), C8( 27,4), C8( 28,4), C8( 29,4),
- C8( 30,4), C8( 31,4), C8( 32,4), C8( 33,4), C8( 34,4), C8( 35,4),
- C8( 36,4), C8( 37,4), C8( 38,4), C8( 39,4), C8( 40,4), C8( 41,4),
- C8( 42,4), C8( 43,4), C8( 44,4), C8( 45,4), C8( 46,4), C8( 47,4),
- C8( 48,4), C8( 49,4), C8( 50,4), C8( 51,4), C8( 52,4), C8( 53,4),
- C8( 54,4), C8( 55,4), C8( 56,4), C8( 57,4), C8( 58,4), C8( 59,4),
- C8( 60,4), C8( 61,4), C8( 62,4), C8( 63,4), C8( 64,4), C8( 65,4),
- C8( 66,4), C8( 67,4), C8( 68,4), C8( 69,4), C8( 70,4), C8( 71,4),
- C8( 72,4), C8( 73,4), C8( 74,4), C8( 75,4), C8( 76,4), C8( 77,4),
- C8( 78,4), C8( 79,4), C8( 80,4), C8( 81,4), C8( 82,4), C8( 83,4),
- C8( 84,4), C8( 85,4), C8( 86,4), C8( 87,4), C8( 88,4), C8( 89,4),
- C8( 90,4), C8( 91,4), C8( 92,4), C8( 93,4), C8( 94,4), C8( 95,4),
- C8( 96,4), C8( 97,4), C8( 98,4), C8( 99,4), C8(100,4), C8(101,4),
- C8(102,4), C8(103,4), C8(104,4), C8(105,4), C8(106,4), C8(107,4),
- C8(108,4), C8(109,4), C8(110,4), C8(111,4), C8(112,4), C8(113,4),
- C8(114,4), C8(115,4), C8(116,4), C8(117,4), C8(118,4), C8(119,4),
- C8(120,4), C8(121,4), C8(122,4), C8(123,4), C8(124,4), C8(125,4),
- C8(126,4), C8(127,4), C8(128,4), C8(129,4), C8(130,4), C8(131,4),
- C8(132,4), C8(133,4), C8(134,4), C8(135,4), C8(136,4), C8(137,4),
- C8(138,4), C8(139,4), C8(140,4), C8(141,4), C8(142,4), C8(143,4),
- C8(144,4), C8(145,4), C8(146,4), C8(147,4), C8(148,4), C8(149,4),
- C8(150,4), C8(151,4), C8(152,4), C8(153,4), C8(154,4), C8(155,4),
- C8(156,4), C8(157,4), C8(158,4), C8(159,4), C8(160,4), C8(161,4),
- C8(162,4), C8(163,4), C8(164,4), C8(165,4), C8(166,4), C8(167,4),
- C8(168,4), C8(169,4), C8(170,4), C8(171,4), C8(172,4), C8(173,4),
- C8(174,4), C8(175,4), C8(176,4), C8(177,4), C8(178,4), C8(179,4),
- C8(180,4), C8(181,4), C8(182,4), C8(183,4), C8(184,4), C8(185,4),
- C8(186,4), C8(187,4), C8(188,4), C8(189,4), C8(190,4), C8(191,4),
- C8(192,4), C8(193,4), C8(194,4), C8(195,4), C8(196,4), C8(197,4),
- C8(198,4), C8(199,4), C8(200,4), C8(201,4), C8(202,4), C8(203,4),
- C8(204,4), C8(205,4), C8(206,4), C8(207,4), C8(208,4), C8(209,4),
- C8(210,4), C8(211,4), C8(212,4), C8(213,4), C8(214,4), C8(215,4),
- C8(216,4), C8(217,4), C8(218,4), C8(219,4), C8(220,4), C8(221,4),
- C8(222,4), C8(223,4), C8(224,4), C8(225,4), C8(226,4), C8(227,4),
- C8(228,4), C8(229,4), C8(230,4), C8(231,4), C8(232,4), C8(233,4),
- C8(234,4), C8(235,4), C8(236,4), C8(237,4), C8(238,4), C8(239,4),
- C8(240,4), C8(241,4), C8(242,4), C8(243,4), C8(244,4), C8(245,4),
- C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4),
- C8(252,4), C8(253,4), C8(254,4), C8(255,4),
+ C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4),
+ C8(6, 4), C8(7, 4), C8(8, 4), C8(9, 4), C8(10, 4), C8(11, 4),
+ C8(12, 4), C8(13, 4), C8(14, 4), C8(15, 4), C8(16, 4), C8(17, 4),
+ C8(18, 4), C8(19, 4), C8(20, 4), C8(21, 4), C8(22, 4), C8(23, 4),
+ C8(24, 4), C8(25, 4), C8(26, 4), C8(27, 4), C8(28, 4), C8(29, 4),
+ C8(30, 4), C8(31, 4), C8(32, 4), C8(33, 4), C8(34, 4), C8(35, 4),
+ C8(36, 4), C8(37, 4), C8(38, 4), C8(39, 4), C8(40, 4), C8(41, 4),
+ C8(42, 4), C8(43, 4), C8(44, 4), C8(45, 4), C8(46, 4), C8(47, 4),
+ C8(48, 4), C8(49, 4), C8(50, 4), C8(51, 4), C8(52, 4), C8(53, 4),
+ C8(54, 4), C8(55, 4), C8(56, 4), C8(57, 4), C8(58, 4), C8(59, 4),
+ C8(60, 4), C8(61, 4), C8(62, 4), C8(63, 4), C8(64, 4), C8(65, 4),
+ C8(66, 4), C8(67, 4), C8(68, 4), C8(69, 4), C8(70, 4), C8(71, 4),
+ C8(72, 4), C8(73, 4), C8(74, 4), C8(75, 4), C8(76, 4), C8(77, 4),
+ C8(78, 4), C8(79, 4), C8(80, 4), C8(81, 4), C8(82, 4), C8(83, 4),
+ C8(84, 4), C8(85, 4), C8(86, 4), C8(87, 4), C8(88, 4), C8(89, 4),
+ C8(90, 4), C8(91, 4), C8(92, 4), C8(93, 4), C8(94, 4), C8(95, 4),
+ C8(96, 4), C8(97, 4), C8(98, 4), C8(99, 4), C8(100, 4), C8(101, 4),
+ C8(102, 4), C8(103, 4), C8(104, 4), C8(105, 4), C8(106, 4), C8(107, 4),
+ C8(108, 4), C8(109, 4), C8(110, 4), C8(111, 4), C8(112, 4), C8(113, 4),
+ C8(114, 4), C8(115, 4), C8(116, 4), C8(117, 4), C8(118, 4), C8(119, 4),
+ C8(120, 4), C8(121, 4), C8(122, 4), C8(123, 4), C8(124, 4), C8(125, 4),
+ C8(126, 4), C8(127, 4), C8(128, 4), C8(129, 4), C8(130, 4), C8(131, 4),
+ C8(132, 4), C8(133, 4), C8(134, 4), C8(135, 4), C8(136, 4), C8(137, 4),
+ C8(138, 4), C8(139, 4), C8(140, 4), C8(141, 4), C8(142, 4), C8(143, 4),
+ C8(144, 4), C8(145, 4), C8(146, 4), C8(147, 4), C8(148, 4), C8(149, 4),
+ C8(150, 4), C8(151, 4), C8(152, 4), C8(153, 4), C8(154, 4), C8(155, 4),
+ C8(156, 4), C8(157, 4), C8(158, 4), C8(159, 4), C8(160, 4), C8(161, 4),
+ C8(162, 4), C8(163, 4), C8(164, 4), C8(165, 4), C8(166, 4), C8(167, 4),
+ C8(168, 4), C8(169, 4), C8(170, 4), C8(171, 4), C8(172, 4), C8(173, 4),
+ C8(174, 4), C8(175, 4), C8(176, 4), C8(177, 4), C8(178, 4), C8(179, 4),
+ C8(180, 4), C8(181, 4), C8(182, 4), C8(183, 4), C8(184, 4), C8(185, 4),
+ C8(186, 4), C8(187, 4), C8(188, 4), C8(189, 4), C8(190, 4), C8(191, 4),
+ C8(192, 4), C8(193, 4), C8(194, 4), C8(195, 4), C8(196, 4), C8(197, 4),
+ C8(198, 4), C8(199, 4), C8(200, 4), C8(201, 4), C8(202, 4), C8(203, 4),
+ C8(204, 4), C8(205, 4), C8(206, 4), C8(207, 4), C8(208, 4), C8(209, 4),
+ C8(210, 4), C8(211, 4), C8(212, 4), C8(213, 4), C8(214, 4), C8(215, 4),
+ C8(216, 4), C8(217, 4), C8(218, 4), C8(219, 4), C8(220, 4), C8(221, 4),
+ C8(222, 4), C8(223, 4), C8(224, 4), C8(225, 4), C8(226, 4), C8(227, 4),
+ C8(228, 4), C8(229, 4), C8(230, 4), C8(231, 4), C8(232, 4), C8(233, 4),
+ C8(234, 4), C8(235, 4), C8(236, 4), C8(237, 4), C8(238, 4), C8(239, 4),
+ C8(240, 4), C8(241, 4), C8(242, 4), C8(243, 4), C8(244, 4), C8(245, 4),
+ C8(246, 4), C8(247, 4), C8(248, 4), C8(249, 4), C8(250, 4), C8(251, 4),
+ C8(252, 4), C8(253, 4), C8(254, 4), C8(255, 4),
};
+
const FbBits fbStipple4Bits[16] = {
- C4( 0,8), C4( 1,8), C4( 2,8), C4( 3,8), C4( 4,8), C4( 5,8),
- C4( 6,8), C4( 7,8), C4( 8,8), C4( 9,8), C4( 10,8), C4( 11,8),
- C4( 12,8), C4( 13,8), C4( 14,8), C4( 15,8),};
+ C4(0, 8), C4(1, 8), C4(2, 8), C4(3, 8), C4(4, 8), C4(5, 8),
+ C4(6, 8), C4(7, 8), C4(8, 8), C4(9, 8), C4(10, 8), C4(11, 8),
+ C4(12, 8), C4(13, 8), C4(14, 8), C4(15, 8),
+};
+
const FbBits fbStipple2Bits[4] = {
- C2( 0,16), C2( 1,16), C2( 2,16), C2( 3,16),
+ C2(0, 16), C2(1, 16), C2(2, 16), C2(3, 16),
};
+
const FbBits fbStipple1Bits[2] = {
- C1( 0,32), C1( 1,32),
+ C1(0, 32), C1(1, 32),
};
#endif
#if FB_UNIT == 64
const FbBits fbStipple16Bits[256] = {
- C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4),
- C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4),
- C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4),
- C8( 18,4), C8( 19,4), C8( 20,4), C8( 21,4), C8( 22,4), C8( 23,4),
- C8( 24,4), C8( 25,4), C8( 26,4), C8( 27,4), C8( 28,4), C8( 29,4),
- C8( 30,4), C8( 31,4), C8( 32,4), C8( 33,4), C8( 34,4), C8( 35,4),
- C8( 36,4), C8( 37,4), C8( 38,4), C8( 39,4), C8( 40,4), C8( 41,4),
- C8( 42,4), C8( 43,4), C8( 44,4), C8( 45,4), C8( 46,4), C8( 47,4),
- C8( 48,4), C8( 49,4), C8( 50,4), C8( 51,4), C8( 52,4), C8( 53,4),
- C8( 54,4), C8( 55,4), C8( 56,4), C8( 57,4), C8( 58,4), C8( 59,4),
- C8( 60,4), C8( 61,4), C8( 62,4), C8( 63,4), C8( 64,4), C8( 65,4),
- C8( 66,4), C8( 67,4), C8( 68,4), C8( 69,4), C8( 70,4), C8( 71,4),
- C8( 72,4), C8( 73,4), C8( 74,4), C8( 75,4), C8( 76,4), C8( 77,4),
- C8( 78,4), C8( 79,4), C8( 80,4), C8( 81,4), C8( 82,4), C8( 83,4),
- C8( 84,4), C8( 85,4), C8( 86,4), C8( 87,4), C8( 88,4), C8( 89,4),
- C8( 90,4), C8( 91,4), C8( 92,4), C8( 93,4), C8( 94,4), C8( 95,4),
- C8( 96,4), C8( 97,4), C8( 98,4), C8( 99,4), C8(100,4), C8(101,4),
- C8(102,4), C8(103,4), C8(104,4), C8(105,4), C8(106,4), C8(107,4),
- C8(108,4), C8(109,4), C8(110,4), C8(111,4), C8(112,4), C8(113,4),
- C8(114,4), C8(115,4), C8(116,4), C8(117,4), C8(118,4), C8(119,4),
- C8(120,4), C8(121,4), C8(122,4), C8(123,4), C8(124,4), C8(125,4),
- C8(126,4), C8(127,4), C8(128,4), C8(129,4), C8(130,4), C8(131,4),
- C8(132,4), C8(133,4), C8(134,4), C8(135,4), C8(136,4), C8(137,4),
- C8(138,4), C8(139,4), C8(140,4), C8(141,4), C8(142,4), C8(143,4),
- C8(144,4), C8(145,4), C8(146,4), C8(147,4), C8(148,4), C8(149,4),
- C8(150,4), C8(151,4), C8(152,4), C8(153,4), C8(154,4), C8(155,4),
- C8(156,4), C8(157,4), C8(158,4), C8(159,4), C8(160,4), C8(161,4),
- C8(162,4), C8(163,4), C8(164,4), C8(165,4), C8(166,4), C8(167,4),
- C8(168,4), C8(169,4), C8(170,4), C8(171,4), C8(172,4), C8(173,4),
- C8(174,4), C8(175,4), C8(176,4), C8(177,4), C8(178,4), C8(179,4),
- C8(180,4), C8(181,4), C8(182,4), C8(183,4), C8(184,4), C8(185,4),
- C8(186,4), C8(187,4), C8(188,4), C8(189,4), C8(190,4), C8(191,4),
- C8(192,4), C8(193,4), C8(194,4), C8(195,4), C8(196,4), C8(197,4),
- C8(198,4), C8(199,4), C8(200,4), C8(201,4), C8(202,4), C8(203,4),
- C8(204,4), C8(205,4), C8(206,4), C8(207,4), C8(208,4), C8(209,4),
- C8(210,4), C8(211,4), C8(212,4), C8(213,4), C8(214,4), C8(215,4),
- C8(216,4), C8(217,4), C8(218,4), C8(219,4), C8(220,4), C8(221,4),
- C8(222,4), C8(223,4), C8(224,4), C8(225,4), C8(226,4), C8(227,4),
- C8(228,4), C8(229,4), C8(230,4), C8(231,4), C8(232,4), C8(233,4),
- C8(234,4), C8(235,4), C8(236,4), C8(237,4), C8(238,4), C8(239,4),
- C8(240,4), C8(241,4), C8(242,4), C8(243,4), C8(244,4), C8(245,4),
- C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4),
- C8(252,4), C8(253,4), C8(254,4), C8(255,4),
+ C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4),
+ C8(6, 4), C8(7, 4), C8(8, 4), C8(9, 4), C8(10, 4), C8(11, 4),
+ C8(12, 4), C8(13, 4), C8(14, 4), C8(15, 4), C8(16, 4), C8(17, 4),
+ C8(18, 4), C8(19, 4), C8(20, 4), C8(21, 4), C8(22, 4), C8(23, 4),
+ C8(24, 4), C8(25, 4), C8(26, 4), C8(27, 4), C8(28, 4), C8(29, 4),
+ C8(30, 4), C8(31, 4), C8(32, 4), C8(33, 4), C8(34, 4), C8(35, 4),
+ C8(36, 4), C8(37, 4), C8(38, 4), C8(39, 4), C8(40, 4), C8(41, 4),
+ C8(42, 4), C8(43, 4), C8(44, 4), C8(45, 4), C8(46, 4), C8(47, 4),
+ C8(48, 4), C8(49, 4), C8(50, 4), C8(51, 4), C8(52, 4), C8(53, 4),
+ C8(54, 4), C8(55, 4), C8(56, 4), C8(57, 4), C8(58, 4), C8(59, 4),
+ C8(60, 4), C8(61, 4), C8(62, 4), C8(63, 4), C8(64, 4), C8(65, 4),
+ C8(66, 4), C8(67, 4), C8(68, 4), C8(69, 4), C8(70, 4), C8(71, 4),
+ C8(72, 4), C8(73, 4), C8(74, 4), C8(75, 4), C8(76, 4), C8(77, 4),
+ C8(78, 4), C8(79, 4), C8(80, 4), C8(81, 4), C8(82, 4), C8(83, 4),
+ C8(84, 4), C8(85, 4), C8(86, 4), C8(87, 4), C8(88, 4), C8(89, 4),
+ C8(90, 4), C8(91, 4), C8(92, 4), C8(93, 4), C8(94, 4), C8(95, 4),
+ C8(96, 4), C8(97, 4), C8(98, 4), C8(99, 4), C8(100, 4), C8(101, 4),
+ C8(102, 4), C8(103, 4), C8(104, 4), C8(105, 4), C8(106, 4), C8(107, 4),
+ C8(108, 4), C8(109, 4), C8(110, 4), C8(111, 4), C8(112, 4), C8(113, 4),
+ C8(114, 4), C8(115, 4), C8(116, 4), C8(117, 4), C8(118, 4), C8(119, 4),
+ C8(120, 4), C8(121, 4), C8(122, 4), C8(123, 4), C8(124, 4), C8(125, 4),
+ C8(126, 4), C8(127, 4), C8(128, 4), C8(129, 4), C8(130, 4), C8(131, 4),
+ C8(132, 4), C8(133, 4), C8(134, 4), C8(135, 4), C8(136, 4), C8(137, 4),
+ C8(138, 4), C8(139, 4), C8(140, 4), C8(141, 4), C8(142, 4), C8(143, 4),
+ C8(144, 4), C8(145, 4), C8(146, 4), C8(147, 4), C8(148, 4), C8(149, 4),
+ C8(150, 4), C8(151, 4), C8(152, 4), C8(153, 4), C8(154, 4), C8(155, 4),
+ C8(156, 4), C8(157, 4), C8(158, 4), C8(159, 4), C8(160, 4), C8(161, 4),
+ C8(162, 4), C8(163, 4), C8(164, 4), C8(165, 4), C8(166, 4), C8(167, 4),
+ C8(168, 4), C8(169, 4), C8(170, 4), C8(171, 4), C8(172, 4), C8(173, 4),
+ C8(174, 4), C8(175, 4), C8(176, 4), C8(177, 4), C8(178, 4), C8(179, 4),
+ C8(180, 4), C8(181, 4), C8(182, 4), C8(183, 4), C8(184, 4), C8(185, 4),
+ C8(186, 4), C8(187, 4), C8(188, 4), C8(189, 4), C8(190, 4), C8(191, 4),
+ C8(192, 4), C8(193, 4), C8(194, 4), C8(195, 4), C8(196, 4), C8(197, 4),
+ C8(198, 4), C8(199, 4), C8(200, 4), C8(201, 4), C8(202, 4), C8(203, 4),
+ C8(204, 4), C8(205, 4), C8(206, 4), C8(207, 4), C8(208, 4), C8(209, 4),
+ C8(210, 4), C8(211, 4), C8(212, 4), C8(213, 4), C8(214, 4), C8(215, 4),
+ C8(216, 4), C8(217, 4), C8(218, 4), C8(219, 4), C8(220, 4), C8(221, 4),
+ C8(222, 4), C8(223, 4), C8(224, 4), C8(225, 4), C8(226, 4), C8(227, 4),
+ C8(228, 4), C8(229, 4), C8(230, 4), C8(231, 4), C8(232, 4), C8(233, 4),
+ C8(234, 4), C8(235, 4), C8(236, 4), C8(237, 4), C8(238, 4), C8(239, 4),
+ C8(240, 4), C8(241, 4), C8(242, 4), C8(243, 4), C8(244, 4), C8(245, 4),
+ C8(246, 4), C8(247, 4), C8(248, 4), C8(249, 4), C8(250, 4), C8(251, 4),
+ C8(252, 4), C8(253, 4), C8(254, 4), C8(255, 4),
};
+
const FbBits fbStipple8Bits[256] = {
- C8( 0,8), C8( 1,8), C8( 2,8), C8( 3,8), C8( 4,8), C8( 5,8),
- C8( 6,8), C8( 7,8), C8( 8,8), C8( 9,8), C8( 10,8), C8( 11,8),
- C8( 12,8), C8( 13,8), C8( 14,8), C8( 15,8), C8( 16,8), C8( 17,8),
- C8( 18,8), C8( 19,8), C8( 20,8), C8( 21,8), C8( 22,8), C8( 23,8),
- C8( 24,8), C8( 25,8), C8( 26,8), C8( 27,8), C8( 28,8), C8( 29,8),
- C8( 30,8), C8( 31,8), C8( 32,8), C8( 33,8), C8( 34,8), C8( 35,8),
- C8( 36,8), C8( 37,8), C8( 38,8), C8( 39,8), C8( 40,8), C8( 41,8),
- C8( 42,8), C8( 43,8), C8( 44,8), C8( 45,8), C8( 46,8), C8( 47,8),
- C8( 48,8), C8( 49,8), C8( 50,8), C8( 51,8), C8( 52,8), C8( 53,8),
- C8( 54,8), C8( 55,8), C8( 56,8), C8( 57,8), C8( 58,8), C8( 59,8),
- C8( 60,8), C8( 61,8), C8( 62,8), C8( 63,8), C8( 64,8), C8( 65,8),
- C8( 66,8), C8( 67,8), C8( 68,8), C8( 69,8), C8( 70,8), C8( 71,8),
- C8( 72,8), C8( 73,8), C8( 74,8), C8( 75,8), C8( 76,8), C8( 77,8),
- C8( 78,8), C8( 79,8), C8( 80,8), C8( 81,8), C8( 82,8), C8( 83,8),
- C8( 84,8), C8( 85,8), C8( 86,8), C8( 87,8), C8( 88,8), C8( 89,8),
- C8( 90,8), C8( 91,8), C8( 92,8), C8( 93,8), C8( 94,8), C8( 95,8),
- C8( 96,8), C8( 97,8), C8( 98,8), C8( 99,8), C8(100,8), C8(101,8),
- C8(102,8), C8(103,8), C8(104,8), C8(105,8), C8(106,8), C8(107,8),
- C8(108,8), C8(109,8), C8(110,8), C8(111,8), C8(112,8), C8(113,8),
- C8(114,8), C8(115,8), C8(116,8), C8(117,8), C8(118,8), C8(119,8),
- C8(120,8), C8(121,8), C8(122,8), C8(123,8), C8(124,8), C8(125,8),
- C8(126,8), C8(127,8), C8(128,8), C8(129,8), C8(130,8), C8(131,8),
- C8(132,8), C8(133,8), C8(134,8), C8(135,8), C8(136,8), C8(137,8),
- C8(138,8), C8(139,8), C8(140,8), C8(141,8), C8(142,8), C8(143,8),
- C8(144,8), C8(145,8), C8(146,8), C8(147,8), C8(148,8), C8(149,8),
- C8(150,8), C8(151,8), C8(152,8), C8(153,8), C8(154,8), C8(155,8),
- C8(156,8), C8(157,8), C8(158,8), C8(159,8), C8(160,8), C8(161,8),
- C8(162,8), C8(163,8), C8(164,8), C8(165,8), C8(166,8), C8(167,8),
- C8(168,8), C8(169,8), C8(170,8), C8(171,8), C8(172,8), C8(173,8),
- C8(174,8), C8(175,8), C8(176,8), C8(177,8), C8(178,8), C8(179,8),
- C8(180,8), C8(181,8), C8(182,8), C8(183,8), C8(184,8), C8(185,8),
- C8(186,8), C8(187,8), C8(188,8), C8(189,8), C8(190,8), C8(191,8),
- C8(192,8), C8(193,8), C8(194,8), C8(195,8), C8(196,8), C8(197,8),
- C8(198,8), C8(199,8), C8(200,8), C8(201,8), C8(202,8), C8(203,8),
- C8(204,8), C8(205,8), C8(206,8), C8(207,8), C8(208,8), C8(209,8),
- C8(210,8), C8(211,8), C8(212,8), C8(213,8), C8(214,8), C8(215,8),
- C8(216,8), C8(217,8), C8(218,8), C8(219,8), C8(220,8), C8(221,8),
- C8(222,8), C8(223,8), C8(224,8), C8(225,8), C8(226,8), C8(227,8),
- C8(228,8), C8(229,8), C8(230,8), C8(231,8), C8(232,8), C8(233,8),
- C8(234,8), C8(235,8), C8(236,8), C8(237,8), C8(238,8), C8(239,8),
- C8(240,8), C8(241,8), C8(242,8), C8(243,8), C8(244,8), C8(245,8),
- C8(246,8), C8(247,8), C8(248,8), C8(249,8), C8(250,8), C8(251,8),
- C8(252,8), C8(253,8), C8(254,8), C8(255,8),
+ C8(0, 8), C8(1, 8), C8(2, 8), C8(3, 8), C8(4, 8), C8(5, 8),
+ C8(6, 8), C8(7, 8), C8(8, 8), C8(9, 8), C8(10, 8), C8(11, 8),
+ C8(12, 8), C8(13, 8), C8(14, 8), C8(15, 8), C8(16, 8), C8(17, 8),
+ C8(18, 8), C8(19, 8), C8(20, 8), C8(21, 8), C8(22, 8), C8(23, 8),
+ C8(24, 8), C8(25, 8), C8(26, 8), C8(27, 8), C8(28, 8), C8(29, 8),
+ C8(30, 8), C8(31, 8), C8(32, 8), C8(33, 8), C8(34, 8), C8(35, 8),
+ C8(36, 8), C8(37, 8), C8(38, 8), C8(39, 8), C8(40, 8), C8(41, 8),
+ C8(42, 8), C8(43, 8), C8(44, 8), C8(45, 8), C8(46, 8), C8(47, 8),
+ C8(48, 8), C8(49, 8), C8(50, 8), C8(51, 8), C8(52, 8), C8(53, 8),
+ C8(54, 8), C8(55, 8), C8(56, 8), C8(57, 8), C8(58, 8), C8(59, 8),
+ C8(60, 8), C8(61, 8), C8(62, 8), C8(63, 8), C8(64, 8), C8(65, 8),
+ C8(66, 8), C8(67, 8), C8(68, 8), C8(69, 8), C8(70, 8), C8(71, 8),
+ C8(72, 8), C8(73, 8), C8(74, 8), C8(75, 8), C8(76, 8), C8(77, 8),
+ C8(78, 8), C8(79, 8), C8(80, 8), C8(81, 8), C8(82, 8), C8(83, 8),
+ C8(84, 8), C8(85, 8), C8(86, 8), C8(87, 8), C8(88, 8), C8(89, 8),
+ C8(90, 8), C8(91, 8), C8(92, 8), C8(93, 8), C8(94, 8), C8(95, 8),
+ C8(96, 8), C8(97, 8), C8(98, 8), C8(99, 8), C8(100, 8), C8(101, 8),
+ C8(102, 8), C8(103, 8), C8(104, 8), C8(105, 8), C8(106, 8), C8(107, 8),
+ C8(108, 8), C8(109, 8), C8(110, 8), C8(111, 8), C8(112, 8), C8(113, 8),
+ C8(114, 8), C8(115, 8), C8(116, 8), C8(117, 8), C8(118, 8), C8(119, 8),
+ C8(120, 8), C8(121, 8), C8(122, 8), C8(123, 8), C8(124, 8), C8(125, 8),
+ C8(126, 8), C8(127, 8), C8(128, 8), C8(129, 8), C8(130, 8), C8(131, 8),
+ C8(132, 8), C8(133, 8), C8(134, 8), C8(135, 8), C8(136, 8), C8(137, 8),
+ C8(138, 8), C8(139, 8), C8(140, 8), C8(141, 8), C8(142, 8), C8(143, 8),
+ C8(144, 8), C8(145, 8), C8(146, 8), C8(147, 8), C8(148, 8), C8(149, 8),
+ C8(150, 8), C8(151, 8), C8(152, 8), C8(153, 8), C8(154, 8), C8(155, 8),
+ C8(156, 8), C8(157, 8), C8(158, 8), C8(159, 8), C8(160, 8), C8(161, 8),
+ C8(162, 8), C8(163, 8), C8(164, 8), C8(165, 8), C8(166, 8), C8(167, 8),
+ C8(168, 8), C8(169, 8), C8(170, 8), C8(171, 8), C8(172, 8), C8(173, 8),
+ C8(174, 8), C8(175, 8), C8(176, 8), C8(177, 8), C8(178, 8), C8(179, 8),
+ C8(180, 8), C8(181, 8), C8(182, 8), C8(183, 8), C8(184, 8), C8(185, 8),
+ C8(186, 8), C8(187, 8), C8(188, 8), C8(189, 8), C8(190, 8), C8(191, 8),
+ C8(192, 8), C8(193, 8), C8(194, 8), C8(195, 8), C8(196, 8), C8(197, 8),
+ C8(198, 8), C8(199, 8), C8(200, 8), C8(201, 8), C8(202, 8), C8(203, 8),
+ C8(204, 8), C8(205, 8), C8(206, 8), C8(207, 8), C8(208, 8), C8(209, 8),
+ C8(210, 8), C8(211, 8), C8(212, 8), C8(213, 8), C8(214, 8), C8(215, 8),
+ C8(216, 8), C8(217, 8), C8(218, 8), C8(219, 8), C8(220, 8), C8(221, 8),
+ C8(222, 8), C8(223, 8), C8(224, 8), C8(225, 8), C8(226, 8), C8(227, 8),
+ C8(228, 8), C8(229, 8), C8(230, 8), C8(231, 8), C8(232, 8), C8(233, 8),
+ C8(234, 8), C8(235, 8), C8(236, 8), C8(237, 8), C8(238, 8), C8(239, 8),
+ C8(240, 8), C8(241, 8), C8(242, 8), C8(243, 8), C8(244, 8), C8(245, 8),
+ C8(246, 8), C8(247, 8), C8(248, 8), C8(249, 8), C8(250, 8), C8(251, 8),
+ C8(252, 8), C8(253, 8), C8(254, 8), C8(255, 8),
};
+
const FbBits fbStipple4Bits[16] = {
- C4( 0,16), C4( 1,16), C4( 2,16), C4( 3,16), C4( 4,16), C4( 5,16),
- C4( 6,16), C4( 7,16), C4( 8,16), C4( 9,16), C4( 10,16), C4( 11,16),
- C4( 12,16), C4( 13,16), C4( 14,16), C4( 15,16),};
+ C4(0, 16), C4(1, 16), C4(2, 16), C4(3, 16), C4(4, 16), C4(5, 16),
+ C4(6, 16), C4(7, 16), C4(8, 16), C4(9, 16), C4(10, 16), C4(11, 16),
+ C4(12, 16), C4(13, 16), C4(14, 16), C4(15, 16),
+};
+
const FbBits fbStipple2Bits[4] = {
- C2( 0,32), C2( 1,32), C2( 2,32), C2( 3,32),
+ C2(0, 32), C2(1, 32), C2(2, 32), C2(3, 32),
};
+
#define fbStipple1Bits 0
#endif
-const FbBits * const fbStippleTable[] = {
+const FbBits *const fbStippleTable[] = {
0,
fbStipple1Bits,
fbStipple2Bits,
diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index 7906f8dd2..d27ccd4d5 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -32,9 +32,10 @@ Bool
fbCreateWindow(WindowPtr pWin)
{
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(),
- fbGetScreenPixmap(pWin->drawable.pScreen));
+ fbGetScreenPixmap(pWin->drawable.pScreen));
if (pWin->drawable.bitsPerPixel == 32)
- pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
+ pWin->drawable.bitsPerPixel =
+ fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
return TRUE;
}
@@ -63,87 +64,71 @@ fbUnmapWindow(WindowPtr pWindow)
}
void
-fbCopyWindowProc (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fbCopyWindowProc(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
{
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- while (nbox--)
- {
- fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- GXcopy,
- FB_ALLONES,
- dstBpp,
-
- reverse,
- upsidedown);
- pbox++;
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
+ fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
+ while (nbox--) {
+ fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp,
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ (pbox->y2 - pbox->y1),
+ GXcopy, FB_ALLONES, dstBpp, reverse, upsidedown);
+ pbox++;
}
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
}
void
-fbCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
+fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- RegionRec rgnDst;
- int dx, dy;
+ RegionRec rgnDst;
+ int dx, dy;
- PixmapPtr pPixmap = fbGetWindowPixmap (pWin);
- DrawablePtr pDrawable = &pPixmap->drawable;
+ PixmapPtr pPixmap = fbGetWindowPixmap(pWin);
+ DrawablePtr pDrawable = &pPixmap->drawable;
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
RegionTranslate(prgnSrc, -dx, -dy);
RegionNull(&rgnDst);
-
+
RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
#ifdef COMPOSITE
if (pPixmap->screen_x || pPixmap->screen_y)
- RegionTranslate(&rgnDst,
- -pPixmap->screen_x, -pPixmap->screen_y);
+ RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
#endif
- miCopyRegion (pDrawable, pDrawable,
- 0,
- &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
-
+ miCopyRegion(pDrawable, pDrawable,
+ 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
+
RegionUninit(&rgnDst);
- fbValidateDrawable (&pWin->drawable);
+ fbValidateDrawable(&pWin->drawable);
}
static void
@@ -151,79 +136,70 @@ fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
{
PixmapPtr pPixmap = *ppPixmap;
- if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
- {
- pPixmap = fb24_32ReformatTile (pPixmap, pDrawable->bitsPerPixel);
- if (!pPixmap)
- return;
- (*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
- *ppPixmap = pPixmap;
+ if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
+ pPixmap = fb24_32ReformatTile(pPixmap, pDrawable->bitsPerPixel);
+ if (!pPixmap)
+ return;
+ (*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
+ *ppPixmap = pPixmap;
}
- if (FbEvenTile (pPixmap->drawable.width *
- pPixmap->drawable.bitsPerPixel))
- fbPadPixmap (pPixmap);
+ if (FbEvenTile(pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel))
+ fbPadPixmap(pPixmap);
}
Bool
fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
- if (mask & CWBackPixmap)
- {
- if (pWin->backgroundState == BackgroundPixmap)
- fbFixupWindowPixmap(&pWin->drawable, &pWin->background.pixmap);
+ if (mask & CWBackPixmap) {
+ if (pWin->backgroundState == BackgroundPixmap)
+ fbFixupWindowPixmap(&pWin->drawable, &pWin->background.pixmap);
}
- if (mask & CWBorderPixmap)
- {
- if (pWin->borderIsPixel == FALSE)
- fbFixupWindowPixmap(&pWin->drawable, &pWin->border.pixmap);
+ if (mask & CWBorderPixmap) {
+ if (pWin->borderIsPixel == FALSE)
+ fbFixupWindowPixmap(&pWin->drawable, &pWin->border.pixmap);
}
return TRUE;
}
void
-fbFillRegionSolid (DrawablePtr pDrawable,
- RegionPtr pRegion,
- FbBits and,
- FbBits xor)
+fbFillRegionSolid(DrawablePtr pDrawable,
+ RegionPtr pRegion, FbBits and, FbBits xor)
{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int n = RegionNumRects(pRegion);
- BoxPtr pbox = RegionRects(pRegion);
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int n = RegionNumRects(pRegion);
+ BoxPtr pbox = RegionRects(pRegion);
#ifndef FB_ACCESS_WRAPPER
int try_mmx = 0;
+
if (!and)
try_mmx = 1;
#endif
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- while (n--)
- {
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
+ while (n--) {
#ifndef FB_ACCESS_WRAPPER
- if (!try_mmx || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
- pbox->x1 + dstXoff, pbox->y1 + dstYoff,
- (pbox->x2 - pbox->x1),
- (pbox->y2 - pbox->y1),
- xor))
- {
+ if (!try_mmx || !pixman_fill((uint32_t *) dst, dstStride, dstBpp,
+ pbox->x1 + dstXoff, pbox->y1 + dstYoff,
+ (pbox->x2 - pbox->x1),
+ (pbox->y2 - pbox->y1), xor)) {
#endif
- fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
- dstBpp,
- (pbox->x2 - pbox->x1) * dstBpp,
- pbox->y2 - pbox->y1,
- and, xor);
+ fbSolid(dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ pbox->y2 - pbox->y1, and, xor);
#ifndef FB_ACCESS_WRAPPER
- }
+ }
#endif
- fbValidateDrawable (pDrawable);
- pbox++;
+ fbValidateDrawable(pDrawable);
+ pbox++;
}
-
- fbFinishAccess (pDrawable);
+
+ fbFinishAccess(pDrawable);
}