fb: Pulled in all changes to fb from xorg-server-1.4-apple.

This commit is contained in:
Jeremy Huddleston 2008-02-11 12:18:15 -08:00
parent ef3498e92d
commit 7021577a86
43 changed files with 927 additions and 9017 deletions

View file

@ -1,4 +1,4 @@
noinst_LTLIBRARIES = libfb.la libfbmmx.la
noinst_LTLIBRARIES = libfb.la libwfb.la
INCLUDES = \
-I$(top_srcdir)/hw/xfree86/os-support \
@ -7,25 +7,12 @@ INCLUDES = \
AM_CFLAGS = $(DIX_CFLAGS)
if XORG
sdk_HEADERS = fb.h fbrop.h fbpseudocolor.h fboverlay.h
sdk_HEADERS = fb.h fbrop.h fbpseudocolor.h fboverlay.h wfbrename.h
endif
if MMX_CAPABLE
AM_CFLAGS += -DUSE_MMX
libfb_la_CFLAGS = $(AM_CFLAGS)
libfbmmx_la_CFLAGS = \
$(DIX_CFLAGS) \
-DUSE_MMX \
-mmmx \
-msse \
-Winline \
--param inline-unit-growth=10000 \
--param large-function-growth=10000
endif
libfbmmx_la_SOURCES = \
fbmmx.c \
fbmmx.h
libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
libfb_la_SOURCES = \
fb.h \
@ -38,7 +25,6 @@ libfb_la_SOURCES = \
fbblt.c \
fbbltone.c \
fbbstore.c \
fbcompose.c \
fbcopy.c \
fbfill.c \
fbfillrect.c \
@ -66,10 +52,8 @@ libfb_la_SOURCES = \
fbutil.c \
fbwindow.c \
fbpseudocolor.c \
fbpseudocolor.h \
fbedge.c \
fbedgeimp.h
fbpseudocolor.h
libfb_la_LIBADD = libfbmmx.la
libwfb_la_SOURCES = $(libfb_la_SOURCES)
EXTRA_DIST = fbcmap.c
EXTRA_DIST = fbcmap.c fbcmap_mi.c

168
fb/fb.h
View file

@ -26,6 +26,8 @@
#define _FB_H_
#include <X11/X.h>
#include <pixman.h>
#include "scrnintstr.h"
#include "pixmap.h"
#include "pixmapstr.h"
@ -44,6 +46,39 @@
#include "picture.h"
#endif
#ifdef FB_ACCESS_WRAPPER
#include "wfbrename.h"
#define FBPREFIX(x) wfb##x
#define WRITE(ptr, val) ((*wfbWriteMemory)((ptr), (val), sizeof(*(ptr))))
#define READ(ptr) ((*wfbReadMemory)((ptr), sizeof(*(ptr))))
#define MEMCPY_WRAPPED(dst, src, size) do { \
size_t _i; \
CARD8 *_dst = (CARD8*)(dst), *_src = (CARD8*)(src); \
for(_i = 0; _i < size; _i++) { \
WRITE(_dst +_i, READ(_src + _i)); \
} \
} while(0)
#define MEMSET_WRAPPED(dst, val, size) do { \
size_t _i; \
CARD8 *_dst = (CARD8*)(dst); \
for(_i = 0; _i < size; _i++) { \
WRITE(_dst +_i, (val)); \
} \
} while(0)
#else
#define FBPREFIX(x) fb##x
#define WRITE(ptr, val) (*(ptr) = (val))
#define READ(ptr) (*(ptr))
#define MEMCPY_WRAPPED(dst, src, size) memcpy((dst), (src), (size))
#define MEMSET_WRAPPED(dst, val, size) memset((dst), (val), (size))
#endif
/*
* This single define controls the basic size of data manipulated
* by this software; it must be log2(sizeof (FbBits) * 8)
@ -133,11 +168,10 @@ typedef CARD32 FbStip;
typedef int FbStride;
int fb_null_pointer(char *file, unsigned int line);
#define CHECK_NULL(ptr) \
if ((ptr) == NULL) {\
if (fb_null_pointer(__FILE__, __LINE__)) return; \
ErrorF("%s:%d: null pointer\n", __FILE__, __LINE__); \
return; \
}
#ifdef FB_DEBUG
@ -228,8 +262,8 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
#define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o)))
#define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3))
#define FbStorePart(dst,off,t,xor) (*FbPtrOffset(dst,off,t) = \
FbSelectPart(xor,off,t))
#define FbStorePart(dst,off,t,xor) (WRITE(FbPtrOffset(dst,off,t), \
FbSelectPart(xor,off,t)))
#ifndef FbSelectPart
#define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t)
#endif
@ -409,7 +443,7 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \
break; \
default: \
*dst = FbDoMaskRRop(*dst, and, xor, l); \
WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, l)); \
break; \
} \
}
@ -429,7 +463,7 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
break; \
FbDoRightMaskByteRRop6Cases(dst,xor) \
default: \
*dst = FbDoMaskRRop (*dst, and, xor, r); \
WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, r)); \
} \
}
#endif
@ -461,20 +495,20 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
* The term "lane" comes from the hardware term "byte-lane" which
*/
#define FbLaneCase1(n,a,o) ((n) == 0x01 ? \
(*(CARD8 *) ((a)+FbPatternOffset(o,CARD8)) = \
fgxor) : 0)
#define FbLaneCase2(n,a,o) ((n) == 0x03 ? \
(*(CARD16 *) ((a)+FbPatternOffset(o,CARD16)) = \
#define FbLaneCase1(n,a,o) ((n) == 0x01 ? (void) \
WRITE((CARD8 *) ((a)+FbPatternOffset(o,CARD8)), \
fgxor) : (void) 0)
#define FbLaneCase2(n,a,o) ((n) == 0x03 ? (void) \
WRITE((CARD16 *) ((a)+FbPatternOffset(o,CARD16)), \
fgxor) : \
((void)FbLaneCase1((n)&1,a,o), \
FbLaneCase1((n)>>1,a,(o)+1)))
#define FbLaneCase4(n,a,o) ((n) == 0x0f ? \
(*(CARD32 *) ((a)+FbPatternOffset(o,CARD32)) = \
#define FbLaneCase4(n,a,o) ((n) == 0x0f ? (void) \
WRITE((CARD32 *) ((a)+FbPatternOffset(o,CARD32)), \
fgxor) : \
((void)FbLaneCase2((n)&3,a,o), \
FbLaneCase2((n)>>2,a,(o)+2)))
#define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (*(FbBits *) ((a)+(o)) = fgxor) : \
#define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (void) (*(FbBits *) ((a)+(o)) = fgxor) : \
((void)FbLaneCase4((n)&15,a,o), \
FbLaneCase4((n)>>4,a,(o)+4)))
@ -580,20 +614,36 @@ extern int fbGetWinPrivateIndex(void);
extern const GCOps fbGCOps;
extern const GCFuncs fbGCFuncs;
#ifdef TEKX11
#define FB_OLD_GC
#define FB_OLD_SCREEN
#endif
#ifdef FB_OLD_SCREEN
# define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */
extern WindowPtr *WindowTable;
#endif
#ifdef FB_24_32BIT
#define FB_SCREEN_PRIVATE
#endif
/* 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);
#ifdef FB_ACCESS_WRAPPER
#define fbPrepareAccess(pDraw) \
fbGetScreenPrivate((pDraw)->pScreen)->setupWrap( \
&wfbReadMemory, \
&wfbWriteMemory, \
(pDraw))
#define fbFinishAccess(pDraw) \
fbGetScreenPrivate((pDraw)->pScreen)->finishWrap(pDraw)
#else
#define fbPrepareAccess(pPix)
#define fbFinishAccess(pDraw)
#endif
#ifdef FB_SCREEN_PRIVATE
extern int fbScreenPrivateIndex;
extern int fbGetScreenPrivateIndex(void);
@ -602,6 +652,10 @@ extern int fbGetScreenPrivateIndex(void);
typedef struct {
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 */
#endif
} FbScreenPrivRec, *FbScreenPrivPtr;
#define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
@ -610,15 +664,6 @@ typedef struct {
/* private field of GC */
typedef struct {
#ifdef FB_OLD_GC
unsigned char pad1;
unsigned char pad2;
unsigned char pad3;
unsigned fExpose:1;
unsigned freeCompClip:1;
PixmapPtr pRotatedPixmap;
RegionPtr pCompositeClip;
#endif
FbBits and, xor; /* reduced rop values */
FbBits bgand, bgxor; /* for stipples */
FbBits fg, bg, pm; /* expanded and filled */
@ -631,17 +676,10 @@ typedef struct {
#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
(pGC)->devPrivates[fbGetGCPrivateIndex()].ptr)
#ifdef FB_OLD_GC
#define fbGetCompositeClip(pGC) (fbGetGCPrivate(pGC)->pCompositeClip)
#define fbGetExpose(pGC) (fbGetGCPrivate(pGC)->fExpose)
#define fbGetFreeCompClip(pGC) (fbGetGCPrivate(pGC)->freeCompClip)
#define fbGetRotatedPixmap(pGC) (fbGetGCPrivate(pGC)->pRotatedPixmap)
#else
#define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
#define fbGetExpose(pGC) ((pGC)->fExpose)
#define fbGetFreeCompClip(pGC) ((pGC)->freeCompClip)
#define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap)
#endif
#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
#ifdef FB_NO_WINDOW_PIXMAPS
@ -680,6 +718,7 @@ typedef struct {
(xoff) = __fbPixOffXPix(_pPix); \
(yoff) = __fbPixOffYPix(_pPix); \
} \
fbPrepareAccess(pDrawable); \
(pointer) = (FbBits *) _pPix->devPrivate.ptr; \
(stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
@ -697,6 +736,7 @@ typedef struct {
(xoff) = __fbPixOffXPix(_pPix); \
(yoff) = __fbPixOffYPix(_pPix); \
} \
fbPrepareAccess(pDrawable); \
(pointer) = (FbStip *) _pPix->devPrivate.ptr; \
(stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
@ -716,12 +756,6 @@ typedef struct {
((pDrawable)->type == DRAWABLE_PIXMAP ? \
TRUE : fbWindowEnabled((WindowPtr) pDrawable))
#ifdef FB_OLD_SCREEN
#define BitsPerPixel(d) (\
((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
#endif
#define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0)
/*
* Accelerated tiles are power of 2 width <= FB_UNIT
@ -1284,6 +1318,9 @@ fbCreateDefColormap(ScreenPtr pScreen);
void
fbClearVisualTypes(void);
Bool
fbHasVisualTypes (int depth);
Bool
fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);
@ -1728,13 +1765,11 @@ fbQueryBestSize (int class,
unsigned short *width, unsigned short *height,
ScreenPtr pScreen);
#ifndef FB_OLD_SCREEN
PixmapPtr
_fbGetWindowPixmap (WindowPtr pWindow);
void
_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap);
#endif
Bool
fbSetupScreen(ScreenPtr pScreen,
@ -1746,6 +1781,30 @@ fbSetupScreen(ScreenPtr pScreen,
int width, /* pixel width of frame buffer */
int bpp); /* bits per pixel of frame buffer */
Bool
wfbFinishScreenInit(ScreenPtr pScreen,
pointer pbits,
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp,
SetupWrapProcPtr setupWrap,
FinishWrapProcPtr finishWrap);
Bool
wfbScreenInit(ScreenPtr pScreen,
pointer pbits,
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp,
SetupWrapProcPtr setupWrap,
FinishWrapProcPtr finishWrap);
Bool
fbFinishScreenInit(ScreenPtr pScreen,
pointer pbits,
@ -1946,6 +2005,7 @@ fbEvenTile (FbBits *dst,
int height,
FbBits *tile,
FbStride tileStride,
int tileHeight,
int alu,
@ -2002,6 +2062,11 @@ fbReplicatePixel (Pixel p, int bpp);
void
fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
#ifdef FB_ACCESS_WRAPPER
extern ReadMemoryProcPtr wfbReadMemory;
extern WriteMemoryProcPtr wfbWriteMemory;
#endif
/*
* fbwindow.c
*/
@ -2057,4 +2122,9 @@ void
fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
pixman_image_t *image_from_pict (PicturePtr pict,
Bool has_clip);
void free_pixman_pict (PicturePtr, pixman_image_t *);
#endif /* _FB_H_ */

View file

@ -38,18 +38,18 @@
* by reading/writing aligned CARD32s where it's easy
*/
#define Get8(a) ((CARD32) *(a))
#define Get8(a) ((CARD32) READ(a))
#if BITMAP_BIT_ORDER == MSBFirst
#define Get24(a) ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2))
#define Put24(a,p) (((a)[0] = (CARD8) ((p) >> 16)), \
((a)[1] = (CARD8) ((p) >> 8)), \
((a)[2] = (CARD8) (p)))
#define Put24(a,p) ((WRITE((a+0), (CARD8) ((p) >> 16))), \
(WRITE((a+1), (CARD8) ((p) >> 8))), \
(WRITE((a+2), (CARD8) (p))))
#else
#define Get24(a) (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16))
#define Put24(a,p) (((a)[0] = (CARD8) (p)), \
((a)[1] = (CARD8) ((p) >> 8)), \
((a)[2] = (CARD8) ((p) >> 16)))
#define Put24(a,p) ((WRITE((a+0), (CARD8) (p))), \
(WRITE((a+1), (CARD8) ((p) >> 8))), \
(WRITE((a+2), (CARD8) ((p) >> 16))))
#endif
typedef void (*fb24_32BltFunc) (CARD8 *srcLine,
@ -106,7 +106,7 @@ fb24_32BltDown (CARD8 *srcLine,
while (((long) dst & 3) && w)
{
w--;
pixel = *src++;
pixel = READ(src++);
pixel = FbDoDestInvarientMergeRop(pixel);
Put24 (dst, pixel);
dst += 3;
@ -115,35 +115,35 @@ fb24_32BltDown (CARD8 *srcLine,
while (w >= 4)
{
CARD32 s0, s1;
s0 = *src++;
s0 = READ(src++);
s0 = FbDoDestInvarientMergeRop(s0);
s1 = *src++;
s1 = READ(src++);
s1 = FbDoDestInvarientMergeRop(s1);
#if BITMAP_BIT_ORDER == LSBFirst
*(CARD32 *)(dst) = (s0 & 0xffffff) | (s1 << 24);
WRITE((CARD32 *)dst, (s0 & 0xffffff) | (s1 << 24));
#else
*(CARD32 *)(dst) = (s0 << 8) | ((s1 & 0xffffff) >> 16);
WRITE((CARD32 *)dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
#endif
s0 = *src++;
s0 = READ(src++);
s0 = FbDoDestInvarientMergeRop(s0);
#if BITMAP_BIT_ORDER == LSBFirst
*(CARD32 *)(dst+4) = ((s1 & 0xffffff) >> 8) | (s0 << 16);
WRITE((CARD32 *)(dst+4), ((s1 & 0xffffff) >> 8) | (s0 << 16));
#else
*(CARD32 *)(dst+4) = (s1 << 16) | ((s0 & 0xffffff) >> 8);
WRITE((CARD32 *)(dst+4), (s1 << 16) | ((s0 & 0xffffff) >> 8));
#endif
s1 = *src++;
s1 = READ(src++);
s1 = FbDoDestInvarientMergeRop(s1);
#if BITMAP_BIT_ORDER == LSBFirst
*(CARD32 *)(dst+8) = ((s0 & 0xffffff) >> 16) | (s1 << 8);
WRITE((CARD32 *)(dst+8), ((s0 & 0xffffff) >> 16) | (s1 << 8));
#else
*(CARD32 *)(dst+8) = (s0 << 24) | (s1 & 0xffffff);
WRITE((CARD32 *)(dst+8), (s0 << 24) | (s1 & 0xffffff));
#endif
dst += 12;
w -= 4;
}
while (w--)
{
pixel = *src++;
pixel = READ(src++);
pixel = FbDoDestInvarientMergeRop(pixel);
Put24 (dst, pixel);
dst += 3;
@ -153,7 +153,7 @@ fb24_32BltDown (CARD8 *srcLine,
{
while (w--)
{
pixel = *src++;
pixel = READ(src++);
dpixel = Get24 (dst);
pixel = FbDoMergeRop(pixel, dpixel);
Put24 (dst, pixel);
@ -205,40 +205,40 @@ fb24_32BltUp (CARD8 *srcLine,
w--;
pixel = Get24(src);
src += 3;
*dst++ = FbDoDestInvarientMergeRop(pixel);
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
}
/* Do four aligned pixels at a time */
while (w >= 4)
{
CARD32 s0, s1;
s0 = *(CARD32 *)(src);
s0 = READ((CARD32 *)src);
#if BITMAP_BIT_ORDER == LSBFirst
pixel = s0 & 0xffffff;
#else
pixel = s0 >> 8;
#endif
*dst++ = FbDoDestInvarientMergeRop(pixel);
s1 = *(CARD32 *)(src+4);
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
s1 = READ((CARD32 *)(src+4));
#if BITMAP_BIT_ORDER == LSBFirst
pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
#else
pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
#endif
*dst++ = FbDoDestInvarientMergeRop(pixel);
s0 = *(CARD32 *)(src+8);
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
s0 = READ((CARD32 *)(src+8));
#if BITMAP_BIT_ORDER == LSBFirst
pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
#else
pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
#endif
*dst++ = FbDoDestInvarientMergeRop(pixel);
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
#if BITMAP_BIT_ORDER == LSBFirst
pixel = s0 >> 8;
#else
pixel = s0 & 0xffffff;
#endif
*dst++ = FbDoDestInvarientMergeRop(pixel);
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
src += 12;
w -= 4;
}
@ -247,7 +247,7 @@ fb24_32BltUp (CARD8 *srcLine,
w--;
pixel = Get24(src);
src += 3;
*dst++ = FbDoDestInvarientMergeRop(pixel);
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
}
}
else
@ -256,7 +256,7 @@ fb24_32BltUp (CARD8 *srcLine,
{
pixel = Get24(src);
src += 3;
*dst = FbDoMergeRop(pixel, *dst);
WRITE(dst, FbDoMergeRop(pixel, READ(dst)));
dst++;
}
}
@ -305,6 +305,8 @@ fb24_32GetSpans(DrawablePtr pDrawable,
ppt++;
pwidth++;
}
fbFinishAccess (pDrawable);
}
void
@ -366,6 +368,8 @@ fb24_32SetSpans (DrawablePtr pDrawable,
ppt++;
pwidth++;
}
fbFinishAccess (pDrawable);
}
/*
@ -429,6 +433,8 @@ fb24_32PutZImage (DrawablePtr pDrawable,
alu,
pm);
}
fbFinishAccess (pDrawable);
}
void
@ -463,6 +469,8 @@ fb24_32GetImage (DrawablePtr pDrawable,
fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
(CARD8 *) d, dstStride, 0,
w, h, GXcopy, pm);
fbFinishAccess (pDrawable);
}
void
@ -519,6 +527,9 @@ fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
pPriv->pm);
pbox++;
}
fbFinishAccess (pSrcDrawable);
fbFinishAccess (pDstDrawable);
}
PixmapPtr
@ -563,6 +574,9 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
GXcopy,
FB_ALLONES);
fbFinishAccess (&pOldTile->drawable);
fbFinishAccess (&pNewTile->drawable);
return pNewTile;
}

View file

@ -1,6 +1,4 @@
/*
* $XFree86$
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fballpriv.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -49,10 +47,6 @@ int fbGetWinPrivateIndex(void)
#endif
int fbGeneration;
#ifdef FB_OLD_SCREEN
#define miAllocateGCPrivateIndex() AllocateGCPrivateIndex()
#endif
Bool
fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex)
{
@ -90,3 +84,8 @@ fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex)
#endif
return TRUE;
}
#ifdef FB_ACCESS_WRAPPER
ReadMemoryProcPtr wfbReadMemory;
WriteMemoryProcPtr wfbWriteMemory;
#endif

View file

@ -1,6 +1,4 @@
/*
* Id: fbarc.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -109,6 +107,7 @@ fbPolyArc (DrawablePtr pDrawable,
miPolyArc(pDrawable, pGC, 1, parcs);
parcs++;
}
fbFinishAccess (pDrawable);
}
else
#endif

View file

@ -1,6 +1,4 @@
/*
* Id: fbbits.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -103,14 +101,14 @@
#define BITSUNIT BYTE
#define BITSMUL 3
#define FbDoTypeStore(b,t,x,s) (*((t *) (b)) = (x) >> (s))
#define FbDoTypeRRop(b,t,a,x,s) (*((t *) (b)) = FbDoRRop(*((t *) (b)),\
(a) >> (s), \
(x) >> (s)))
#define FbDoTypeMaskRRop(b,t,a,x,m,s) (*((t *) (b)) = FbDoMaskRRop(*((t *) (b)),\
(a) >> (s), \
(x) >> (s), \
(m) >> (s))
#define FbDoTypeStore(b,t,x,s) WRITE(((t *) (b)), (x) >> (s))
#define FbDoTypeRRop(b,t,a,x,s) WRITE((t *) (b), FbDoRRop(READ((t *) (b)),\
(a) >> (s), \
(x) >> (s)))
#define FbDoTypeMaskRRop(b,t,a,x,m,s) WRITE((t *) (b), FbDoMaskRRop(READ((t *) (b)),\
(a) >> (s), \
(x) >> (s), \
(m) >> (s)))
#if BITMAP_BIT_ORDER == LSBFirst
#define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \
(FbDoTypeStore (b, CARD8, x, 0), \

View file

@ -1,6 +1,4 @@
/*
* $XFree86$
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -42,13 +40,13 @@
#ifdef BITSSTORE
#define STORE(b,x) BITSSTORE(b,x)
#else
#define STORE(b,x) (*(b) = (x))
#define STORE(b,x) WRITE((b), (x))
#endif
#ifdef BITSRROP
#define RROP(b,a,x) BITSRROP(b,a,x)
#else
#define RROP(b,a,x) (*(b) = FbDoRRop (*(b), (a), (x)))
#define RROP(b,a,x) WRITE((b), FbDoRRop (READ(b), (a), (x)))
#endif
#ifdef BITSUNIT
@ -119,6 +117,8 @@ BRESSOLID (DrawablePtr pDrawable,
e += e3;
}
}
fbFinishAccess (pDrawable);
}
#endif
@ -263,6 +263,8 @@ onOffOdd:
dashlen = len;
}
}
fbFinishAccess (pDrawable);
}
#endif
@ -541,18 +543,18 @@ ARC (FbBits *dst,
# define WRITE_ADDR4(n) ((n))
#endif
#define WRITE1(d,n,fg) ((d)[WRITE_ADDR1(n)] = (BITS) (fg))
#define WRITE1(d,n,fg) WRITE(d + WRITE_ADDR1(n), (BITS) (fg))
#ifdef BITS2
# define WRITE2(d,n,fg) (*((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)+1,WRITE1(d,n,fg))
# define WRITE2(d,n,fg) (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg))
#endif
#ifdef BITS4
# define WRITE4(d,n,fg) (*((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)+2,WRITE2(d,n,fg))
# define WRITE4(d,n,fg) (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg))
#endif
void
@ -710,8 +712,10 @@ POLYLINE (DrawablePtr pDrawable,
intToX(pt2) + xoff, intToY(pt2) + yoff,
npt == 0 && pGC->capStyle != CapNotLast,
&dashoffset);
if (!npt)
if (!npt) {
fbFinishAccess (pDrawable);
return;
}
pt1 = pt2;
pt2 = *pts++;
npt--;
@ -776,6 +780,7 @@ POLYLINE (DrawablePtr pDrawable,
{
RROP(bits,and,xor);
}
fbFinishAccess (pDrawable);
return;
}
pt1 = pt2;
@ -786,6 +791,8 @@ POLYLINE (DrawablePtr pDrawable,
}
}
}
fbFinishAccess (pDrawable);
}
#endif
@ -883,20 +890,20 @@ POLYSEGMENT (DrawablePtr pDrawable,
FbMaskBits (dstX, width, startmask, nmiddle, endmask);
if (startmask)
{
*dstLine = FbDoMaskRRop (*dstLine, andBits, xorBits, startmask);
WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, startmask));
dstLine++;
}
if (!andBits)
while (nmiddle--)
*dstLine++ = xorBits;
WRITE(dstLine++, xorBits);
else
while (nmiddle--)
{
*dstLine = FbDoRRop (*dstLine, andBits, xorBits);
WRITE(dstLine, FbDoRRop (READ(dstLine), andBits, xorBits));
dstLine++;
}
if (endmask)
*dstLine = FbDoMaskRRop (*dstLine, andBits, xorBits, endmask);
WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, endmask));
}
else
{
@ -950,6 +957,8 @@ POLYSEGMENT (DrawablePtr pDrawable,
}
}
}
fbFinishAccess (pDrawable);
}
#endif

View file

@ -1,6 +1,4 @@
/*
* Id: fbblt.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -92,10 +90,10 @@ fbBlt (FbBits *srcLine,
if (!upsidedown)
for (i = 0; i < height; i++)
memcpy(dst + i * dstStride, src + i * srcStride, width);
MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
else
for (i = height - 1; i >= 0; i--)
memcpy(dst + i * dstStride, src + i * srcStride, width);
MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
return;
}
@ -137,7 +135,7 @@ fbBlt (FbBits *srcLine,
{
if (endmask)
{
bits = *--src;
bits = READ(--src);
--dst;
FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
}
@ -145,20 +143,20 @@ fbBlt (FbBits *srcLine,
if (destInvarient)
{
while (n--)
*--dst = FbDoDestInvarientMergeRop(*--src);
WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src)));
}
else
{
while (n--)
{
bits = *--src;
bits = READ(--src);
--dst;
*dst = FbDoMergeRop (bits, *dst);
WRITE(dst, FbDoMergeRop (bits, READ(dst)));
}
}
if (startmask)
{
bits = *--src;
bits = READ(--src);
--dst;
FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
}
@ -167,7 +165,7 @@ fbBlt (FbBits *srcLine,
{
if (startmask)
{
bits = *src++;
bits = READ(src++);
FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
dst++;
}
@ -198,20 +196,20 @@ fbBlt (FbBits *srcLine,
}
#endif
while (n--)
*dst++ = FbDoDestInvarientMergeRop(*src++);
WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++)));
}
else
{
while (n--)
{
bits = *src++;
*dst = FbDoMergeRop (bits, *dst);
bits = READ(src++);
WRITE(dst, FbDoMergeRop (bits, READ(dst)));
dst++;
}
}
if (endmask)
{
bits = *src;
bits = READ(src);
FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
}
}
@ -240,13 +238,13 @@ fbBlt (FbBits *srcLine,
if (reverse)
{
if (srcX < dstX)
bits1 = *--src;
bits1 = READ(--src);
if (endmask)
{
bits = FbScrRight(bits1, rightShift);
if (FbScrRight(endmask, leftShift))
{
bits1 = *--src;
bits1 = READ(--src);
bits |= FbScrLeft(bits1, leftShift);
}
--dst;
@ -258,10 +256,10 @@ fbBlt (FbBits *srcLine,
while (n--)
{
bits = FbScrRight(bits1, rightShift);
bits1 = *--src;
bits1 = READ(--src);
bits |= FbScrLeft(bits1, leftShift);
--dst;
*dst = FbDoDestInvarientMergeRop(bits);
WRITE(dst, FbDoDestInvarientMergeRop(bits));
}
}
else
@ -269,10 +267,10 @@ fbBlt (FbBits *srcLine,
while (n--)
{
bits = FbScrRight(bits1, rightShift);
bits1 = *--src;
bits1 = READ(--src);
bits |= FbScrLeft(bits1, leftShift);
--dst;
*dst = FbDoMergeRop(bits, *dst);
WRITE(dst, FbDoMergeRop(bits, READ(dst)));
}
}
if (startmask)
@ -280,7 +278,7 @@ fbBlt (FbBits *srcLine,
bits = FbScrRight(bits1, rightShift);
if (FbScrRight(startmask, leftShift))
{
bits1 = *--src;
bits1 = READ(--src);
bits |= FbScrLeft(bits1, leftShift);
}
--dst;
@ -290,13 +288,13 @@ fbBlt (FbBits *srcLine,
else
{
if (srcX > dstX)
bits1 = *src++;
bits1 = READ(src++);
if (startmask)
{
bits = FbScrLeft(bits1, leftShift);
if (FbScrLeft(startmask, rightShift))
{
bits1 = *src++;
bits1 = READ(src++);
bits |= FbScrRight(bits1, rightShift);
}
FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
@ -308,9 +306,9 @@ fbBlt (FbBits *srcLine,
while (n--)
{
bits = FbScrLeft(bits1, leftShift);
bits1 = *src++;
bits1 = READ(src++);
bits |= FbScrRight(bits1, rightShift);
*dst = FbDoDestInvarientMergeRop(bits);
WRITE(dst, FbDoDestInvarientMergeRop(bits));
dst++;
}
}
@ -319,9 +317,9 @@ fbBlt (FbBits *srcLine,
while (n--)
{
bits = FbScrLeft(bits1, leftShift);
bits1 = *src++;
bits1 = READ(src++);
bits |= FbScrRight(bits1, rightShift);
*dst = FbDoMergeRop(bits, *dst);
WRITE(dst, FbDoMergeRop(bits, READ(dst)));
dst++;
}
}
@ -330,7 +328,7 @@ fbBlt (FbBits *srcLine,
bits = FbScrLeft(bits1, leftShift);
if (FbScrLeft(endmask, rightShift))
{
bits1 = *src;
bits1 = READ(src);
bits |= FbScrRight(bits1, rightShift);
}
FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask);
@ -425,45 +423,45 @@ fbBlt24Line (FbBits *src,
{
if (endmask)
{
bits = *--src;
bits = READ(--src);
--dst;
*dst = FbDoMaskMergeRop (bits, *dst, mask & endmask);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
mask = FbPrev24Pix (mask);
}
while (n--)
{
bits = *--src;
bits = READ(--src);
--dst;
*dst = FbDoMaskMergeRop (bits, *dst, mask);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask));
mask = FbPrev24Pix (mask);
}
if (startmask)
{
bits = *--src;
bits = READ(--src);
--dst;
*dst = FbDoMaskMergeRop(bits, *dst, mask & startmask);
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
}
}
else
{
if (startmask)
{
bits = *src++;
*dst = FbDoMaskMergeRop (bits, *dst, mask & startmask);
bits = READ(src++);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
dst++;
mask = FbNext24Pix(mask);
}
while (n--)
{
bits = *src++;
*dst = FbDoMaskMergeRop (bits, *dst, mask);
bits = READ(src++);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask));
dst++;
mask = FbNext24Pix(mask);
}
if (endmask)
{
bits = *src;
*dst = FbDoMaskMergeRop(bits, *dst, mask & endmask);
bits = READ(src);
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
}
}
}
@ -484,26 +482,26 @@ fbBlt24Line (FbBits *src,
if (reverse)
{
if (srcX < dstX)
bits1 = *--src;
bits1 = READ(--src);
if (endmask)
{
bits = FbScrRight(bits1, rightShift);
if (FbScrRight(endmask, leftShift))
{
bits1 = *--src;
bits1 = READ(--src);
bits |= FbScrLeft(bits1, leftShift);
}
--dst;
*dst = FbDoMaskMergeRop (bits, *dst, mask & endmask);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
mask = FbPrev24Pix(mask);
}
while (n--)
{
bits = FbScrRight(bits1, rightShift);
bits1 = *--src;
bits1 = READ(--src);
bits |= FbScrLeft(bits1, leftShift);
--dst;
*dst = FbDoMaskMergeRop(bits, *dst, mask);
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
mask = FbPrev24Pix(mask);
}
if (startmask)
@ -511,32 +509,32 @@ fbBlt24Line (FbBits *src,
bits = FbScrRight(bits1, rightShift);
if (FbScrRight(startmask, leftShift))
{
bits1 = *--src;
bits1 = READ(--src);
bits |= FbScrLeft(bits1, leftShift);
}
--dst;
*dst = FbDoMaskMergeRop (bits, *dst, mask & startmask);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
}
}
else
{
if (srcX > dstX)
bits1 = *src++;
bits1 = READ(src++);
if (startmask)
{
bits = FbScrLeft(bits1, leftShift);
bits1 = *src++;
bits1 = READ(src++);
bits |= FbScrRight(bits1, rightShift);
*dst = FbDoMaskMergeRop (bits, *dst, mask & startmask);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
dst++;
mask = FbNext24Pix(mask);
}
while (n--)
{
bits = FbScrLeft(bits1, leftShift);
bits1 = *src++;
bits1 = READ(src++);
bits |= FbScrRight(bits1, rightShift);
*dst = FbDoMaskMergeRop(bits, *dst, mask);
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
dst++;
mask = FbNext24Pix(mask);
}
@ -545,10 +543,10 @@ fbBlt24Line (FbBits *src,
bits = FbScrLeft(bits1, leftShift);
if (FbScrLeft(endmask, rightShift))
{
bits1 = *src;
bits1 = READ(src);
bits |= FbScrRight(bits1, rightShift);
}
*dst = FbDoMaskMergeRop (bits, *dst, mask & endmask);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
}
}
}
@ -707,8 +705,8 @@ fbBltOdd (FbBits *srcLine,
{
if (startmask)
{
bits = *src++;
*dst = FbDoMaskMergeRop (bits, *dst, startmask);
bits = READ(src++);
WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), startmask));
dst++;
}
n = nmiddle;
@ -716,8 +714,8 @@ fbBltOdd (FbBits *srcLine,
{
while (n--)
{
bits = *src++;
*dst = FbDoDestInvarientMergeRop(bits);
bits = READ(src++);
WRITE(dst, FbDoDestInvarientMergeRop(bits));
dst++;
}
}
@ -725,28 +723,28 @@ fbBltOdd (FbBits *srcLine,
{
while (n--)
{
bits = *src++;
*dst = FbDoMergeRop (bits, *dst);
bits = READ(src++);
WRITE(dst, FbDoMergeRop (bits, READ(dst)));
dst++;
}
}
if (endmask)
{
bits = *src;
*dst = FbDoMaskMergeRop(bits, *dst, endmask);
bits = READ(src);
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask));
}
}
else
{
bits = 0;
if (srcX > dstX)
bits = *src++;
bits = READ(src++);
if (startmask)
{
bits1 = FbScrLeft(bits, leftShift);
bits = *src++;
bits = READ(src++);
bits1 |= FbScrRight(bits, rightShift);
*dst = FbDoMaskMergeRop (bits1, *dst, startmask);
WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), startmask));
dst++;
}
n = nmiddle;
@ -755,9 +753,9 @@ fbBltOdd (FbBits *srcLine,
while (n--)
{
bits1 = FbScrLeft(bits, leftShift);
bits = *src++;
bits = READ(src++);
bits1 |= FbScrRight(bits, rightShift);
*dst = FbDoDestInvarientMergeRop(bits1);
WRITE(dst, FbDoDestInvarientMergeRop(bits1));
dst++;
}
}
@ -766,9 +764,9 @@ fbBltOdd (FbBits *srcLine,
while (n--)
{
bits1 = FbScrLeft(bits, leftShift);
bits = *src++;
bits = READ(src++);
bits1 |= FbScrRight(bits, rightShift);
*dst = FbDoMergeRop(bits1, *dst);
WRITE(dst, FbDoMergeRop(bits1, READ(dst)));
dst++;
}
}
@ -777,10 +775,10 @@ fbBltOdd (FbBits *srcLine,
bits1 = FbScrLeft(bits, leftShift);
if (FbScrLeft(endmask, rightShift))
{
bits = *src;
bits = READ(src);
bits1 |= FbScrRight(bits, rightShift);
}
*dst = FbDoMaskMergeRop (bits1, *dst, endmask);
WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), endmask));
}
}
}

View file

@ -1,6 +1,4 @@
/*
* Id: fbbltone.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -51,12 +49,12 @@
#define LoadBits {\
if (leftShift) { \
bitsRight = (src < srcEnd ? *src++ : 0); \
bitsRight = (src < srcEnd ? READ(src++) : 0); \
bits = (FbStipLeft (bitsLeft, leftShift) | \
FbStipRight(bitsRight, rightShift)); \
bitsLeft = bitsRight; \
} else \
bits = (src < srcEnd ? *src++ : 0); \
bits = (src < srcEnd ? READ(src++) : 0); \
}
#define CHECK_BOUNDS(pointer, limit) \
@ -293,7 +291,7 @@ fbBltOne (FbStip *src,
bitsLeft = 0;
if (srcX > dstS)
bitsLeft = *src++;
bitsLeft = READ(src++);
if (n)
{
/*
@ -348,7 +346,7 @@ fbBltOne (FbStip *src,
#endif
mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
CHECK_BOUNDS(dst, dstEnd);
*dst = FbOpaqueStipple (mask, fgxor, bgxor);
WRITE(dst, FbOpaqueStipple (mask, fgxor, bgxor));
dst++;
bits = FbStipLeft(bits, pixelsPerDst);
}
@ -380,8 +378,8 @@ fbBltOne (FbStip *src,
{
mask = fbBits[left];
CHECK_BOUNDS(dst, dstEnd);
*dst = FbStippleRRop (*dst, mask,
fgand, fgxor, bgand, bgxor);
WRITE(dst, FbStippleRRop (READ(dst), mask,
fgand, fgxor, bgand, bgxor));
}
dst++;
bits = FbStipLeft(bits, pixelsPerDst);
@ -549,7 +547,7 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
stip = FbLeftStipBits(bits, len); \
} else { \
stip = FbLeftStipBits(bits, remain); \
bits = (src < srcEnd ? *src++ : 0); \
bits = (src < srcEnd ? READ(src++) : 0); \
__len = (len) - remain; \
stip = FbMergePartStip24Bits(stip, FbLeftStipBits(bits, __len), \
remain, __len); \
@ -560,7 +558,7 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
}
#define fbInitStipBits(offset,len,stip) {\
bits = FbStipLeft (*src++,offset); \
bits = FbStipLeft (READ(src++),offset); \
remain = FB_STIP_UNIT - offset; \
fbFirstStipBits(len,stip); \
stip = FbMergeStip24Bits (0, stip, len); \
@ -645,10 +643,11 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot >> 3][stip];
CHECK_BOUNDS(dst, dstEnd);
*dst = (*dst & ~leftMask) | (FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
FbRot24(bgxor, rot))
& leftMask);
WRITE(dst, (READ(dst) & ~leftMask) |
(FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
FbRot24(bgxor, rot))
& leftMask));
dst++;
fbNextStipBits(rot,stip);
}
@ -657,9 +656,9 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot>>3][stip];
CHECK_BOUNDS(dst, dstEnd);
*dst = FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
FbRot24(bgxor, rot));
WRITE(dst, FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
FbRot24(bgxor, rot)));
dst++;
fbNextStipBits(rot,stip);
}
@ -667,10 +666,11 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot >> 3][stip];
CHECK_BOUNDS(dst, dstEnd);
*dst = (*dst & ~rightMask) | (FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
FbRot24(bgxor, rot))
& rightMask);
WRITE(dst, (READ(dst) & ~rightMask) |
(FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
FbRot24(bgxor, rot))
& rightMask));
}
dst += dstStride;
src += srcStride;
@ -691,7 +691,7 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
CHECK_BOUNDS(dst, dstEnd);
*dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask);
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
}
dst++;
fbNextStipBits (rot, stip);
@ -703,7 +703,7 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot>>3][stip];
CHECK_BOUNDS(dst, dstEnd);
*dst = (*dst & ~mask) | (FbRot24(fgxor,rot) & mask);
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor,rot) & mask));
}
dst++;
fbNextStipBits (rot, stip);
@ -714,7 +714,7 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
CHECK_BOUNDS(dst, dstEnd);
*dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask);
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
}
}
dst += dstStride;
@ -732,12 +732,12 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot >> 3][stip];
CHECK_BOUNDS(dst, dstEnd);
*dst = FbStippleRRopMask (*dst, mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
FbRot24(bgand, rot),
FbRot24(bgxor, rot),
leftMask);
WRITE(dst, FbStippleRRopMask (READ(dst), mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
FbRot24(bgand, rot),
FbRot24(bgxor, rot),
leftMask));
dst++;
fbNextStipBits(rot,stip);
}
@ -746,11 +746,11 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot >> 3][stip];
CHECK_BOUNDS(dst, dstEnd);
*dst = FbStippleRRop (*dst, mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
FbRot24(bgand, rot),
FbRot24(bgxor, rot));
WRITE(dst, FbStippleRRop (READ(dst), mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
FbRot24(bgand, rot),
FbRot24(bgxor, rot)));
dst++;
fbNextStipBits(rot,stip);
}
@ -758,12 +758,12 @@ fbBltOne24 (FbStip *srcLine,
{
mask = fbStipple24Bits[rot >> 3][stip];
CHECK_BOUNDS(dst, dstEnd);
*dst = FbStippleRRopMask (*dst, mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
FbRot24(bgand, rot),
FbRot24(bgxor, rot),
rightMask);
WRITE(dst, FbStippleRRopMask (READ(dst), mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
FbRot24(bgand, rot),
FbRot24(bgxor, rot),
rightMask));
}
dst += dstStride;
}
@ -854,7 +854,7 @@ fbBltPlane (FbBits *src,
if (srcBpp == 24)
srcMask0 = FbRot24(pm,rot0) & FbBitsMask(0, srcBpp);
#endif
srcBits = *s++;
srcBits = READ(s++);
dstMask = dstMaskFirst;
dstUnion = 0;
@ -866,7 +866,7 @@ fbBltPlane (FbBits *src,
{
if (!srcMask)
{
srcBits = *s++;
srcBits = READ(s++);
#ifdef FB_24BIT
if (srcBpp == 24)
srcMask0 = FbNext24Pix(srcMask0) & FbBitsMask(0,24);
@ -875,9 +875,9 @@ fbBltPlane (FbBits *src,
}
if (!dstMask)
{
*d = FbStippleRRopMask(*d, dstBits,
fgand, fgxor, bgand, bgxor,
dstUnion);
WRITE(d, FbStippleRRopMask(READ(d), dstBits,
fgand, fgxor, bgand, bgxor,
dstUnion));
d++;
dstMask = FbStipMask(0,1);
dstUnion = 0;
@ -893,9 +893,9 @@ fbBltPlane (FbBits *src,
dstMask = FbStipRight(dstMask,1);
}
if (dstUnion)
*d = FbStippleRRopMask(*d,dstBits,
fgand, fgxor, bgand, bgxor,
dstUnion);
WRITE(d, FbStippleRRopMask(READ(d),dstBits,
fgand, fgxor, bgand, bgxor,
dstUnion));
}
}

View file

@ -1,6 +1,4 @@
/*
* Id: fbbstore.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -39,7 +39,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "resource.h"
#include "fb.h"
#ifndef XFree86Server
#ifdef XFree86Server
#error "You should be compiling fbcmap_mi.c instead of fbcmap.c!"
#endif
ColormapPtr FbInstalledMaps[MAXSCREENS];
int
@ -584,87 +589,3 @@ fbInitVisuals (VisualPtr *visualp,
*defaultVisp = depth[i].vids[j];
return TRUE;
}
#else
#include "micmap.h"
int
fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
return miListInstalledColormaps(pScreen, pmaps);
}
void
fbInstallColormap(ColormapPtr pmap)
{
miInstallColormap(pmap);
}
void
fbUninstallColormap(ColormapPtr pmap)
{
miUninstallColormap(pmap);
}
void
fbResolveColor(unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue,
VisualPtr pVisual)
{
miResolveColor(pred, pgreen, pblue, pVisual);
}
Bool
fbInitializeColormap(ColormapPtr pmap)
{
return miInitializeColormap(pmap);
}
int
fbExpandDirectColors (ColormapPtr pmap,
int ndef,
xColorItem *indefs,
xColorItem *outdefs)
{
return miExpandDirectColors(pmap, ndef, indefs, outdefs);
}
Bool
fbCreateDefColormap(ScreenPtr pScreen)
{
return miCreateDefColormap(pScreen);
}
void
fbClearVisualTypes(void)
{
miClearVisualTypes();
}
Bool
fbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
{
return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
}
/*
* Given a list of formats for a screen, create a list
* of visuals and depths for the screen which coorespond to
* 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)
{
return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
defaultVisp, sizes, bitsPerRGB, -1);
}
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,4 @@
/*
* Id: fbcopy.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -29,7 +27,6 @@
#include <stdlib.h>
#include "fb.h"
#include "fbmmx.h"
void
fbCopyNtoN (DrawablePtr pSrcDrawable,
@ -60,21 +57,17 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
while (nbox--)
{
#ifdef USE_MMX
#ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */
if (pm == FB_ALLONES && alu == GXcopy && !reverse &&
!upsidedown && fbHaveMMX())
!upsidedown)
{
if (!fbCopyAreammx (pSrcDrawable,
pDstDrawable,
(pbox->x1 + dx),
(pbox->y1 + dy),
(pbox->x1),
(pbox->y1),
(pbox->x2 - pbox->x1),
(pbox->y2 - pbox->y1)))
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;
@ -98,11 +91,13 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
reverse,
upsidedown);
#ifdef USE_MMX
#ifndef FB_ACCESS_WRAPPER
next:
#endif
pbox++;
}
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
}
void
@ -173,6 +168,9 @@ fbCopy1toN (DrawablePtr pSrcDrawable,
}
pbox++;
}
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
}
void
@ -221,6 +219,8 @@ fbCopyNto1 (DrawablePtr pSrcDrawable,
(FbStip) pPriv->and, (FbStip) pPriv->xor,
(FbStip) pPriv->bgand, (FbStip) pPriv->bgxor,
bitplane);
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
}
else
{
@ -281,6 +281,9 @@ fbCopyNto1 (DrawablePtr pSrcDrawable,
pPriv->and, pPriv->xor,
pPriv->bgand, pPriv->bgxor);
xfree (tmp);
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
}
pbox++;
}

View file

@ -1,314 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <string.h>
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "fb.h"
#ifdef RENDER
#include "picturestr.h"
#include "mipict.h"
#include "renderedge.h"
#include "fbpict.h"
/*
* 4 bit alpha
*/
#define N_BITS 4
#define rasterizeEdges fbRasterizeEdges4
#if BITMAP_BIT_ORDER == LSBFirst
#define Shift4(o) ((o) << 2)
#else
#define Shift4(o) ((1-(o)) << 2)
#endif
#define Get4(x,o) (((x) >> Shift4(o)) & 0xf)
#define Put4(x,o,v) (((x) & ~(0xf << Shift4(o))) | (((v) & 0xf) << Shift4(o)))
#define DefineAlpha(line,x) \
CARD8 *__ap = (CARD8 *) line + ((x) >> 1); \
int __ao = (x) & 1
#define StepAlpha ((__ap += __ao), (__ao ^= 1))
#define AddAlpha(a) { \
CARD8 __o = *__ap; \
CARD8 __a = (a) + Get4(__o, __ao); \
*__ap = Put4 (__o, __ao, __a | (0 - ((__a) >> 4))); \
}
#include "fbedgeimp.h"
#undef AddAlpha
#undef StepAlpha
#undef DefineAlpha
#undef rasterizeEdges
#undef N_BITS
/*
* 1 bit alpha
*/
#define N_BITS 1
#define rasterizeEdges fbRasterizeEdges1
#include "fbedgeimp.h"
#undef rasterizeEdges
#undef N_BITS
/*
* 8 bit alpha
*/
static INLINE CARD8
clip255 (int x)
{
if (x > 255) return 255;
return x;
}
static INLINE void
add_saturate_8 (CARD8 *buf, int value, int length)
{
while (length--)
{
*buf = clip255 (*buf + value);
buf++;
}
}
/*
* We want to detect the case where we add the same value to a long
* span of pixels. The triangles on the end are filled in while we
* count how many sub-pixel scanlines contribute to the middle section.
*
* +--------------------------+
* fill_height =| \ /
* +------------------+
* |================|
* fill_start fill_end
*/
static void
fbRasterizeEdges8 (FbBits *buf,
int width,
int stride,
RenderEdge *l,
RenderEdge *r,
xFixed t,
xFixed b)
{
xFixed y = t;
FbBits *line;
int fill_start = -1, fill_end = -1;
int fill_size = 0;
line = buf + xFixedToInt (y) * stride;
for (;;)
{
CARD8 *ap = (CARD8 *) line;
xFixed lx, rx;
int lxi, rxi;
/* clip X */
lx = l->x;
if (lx < 0)
lx = 0;
rx = r->x;
if (xFixedToInt (rx) >= width)
rx = IntToxFixed (width);
/* Skip empty (or backwards) sections */
if (rx > lx)
{
int lxs, rxs;
/* Find pixel bounds for span. */
lxi = xFixedToInt (lx);
rxi = xFixedToInt (rx);
/* Sample coverage for edge pixels */
lxs = RenderSamplesX (lx, 8);
rxs = RenderSamplesX (rx, 8);
/* Add coverage across row */
if (lxi == rxi)
{
ap[lxi] = clip255 (ap[lxi] + rxs - lxs);
}
else
{
ap[lxi] = clip255 (ap[lxi] + N_X_FRAC(8) - lxs);
/* Move forward so that lxi/rxi is the pixel span */
lxi++;
/* Don't bother trying to optimize the fill unless
* the span is longer than 4 pixels. */
if (rxi - lxi > 4)
{
if (fill_start < 0)
{
fill_start = lxi;
fill_end = rxi;
fill_size++;
}
else
{
if (lxi >= fill_end || rxi < fill_start)
{
/* We're beyond what we saved, just fill it */
add_saturate_8 (ap + fill_start,
fill_size * N_X_FRAC(8),
fill_end - fill_start);
fill_start = lxi;
fill_end = rxi;
fill_size = 1;
}
else
{
/* Update fill_start */
if (lxi > fill_start)
{
add_saturate_8 (ap + fill_start,
fill_size * N_X_FRAC(8),
lxi - fill_start);
fill_start = lxi;
}
else if (lxi < fill_start)
{
add_saturate_8 (ap + lxi, N_X_FRAC(8),
fill_start - lxi);
}
/* Update fill_end */
if (rxi < fill_end)
{
add_saturate_8 (ap + rxi,
fill_size * N_X_FRAC(8),
fill_end - rxi);
fill_end = rxi;
}
else if (fill_end < rxi)
{
add_saturate_8 (ap + fill_end,
N_X_FRAC(8),
rxi - fill_end);
}
fill_size++;
}
}
}
else
{
add_saturate_8 (ap + lxi, N_X_FRAC(8), rxi - lxi);
}
/* Do not add in a 0 alpha here. This check is
* necessary to avoid a buffer overrun, (when rx
* is exactly on a pixel boundary). */
if (rxs)
ap[rxi] = clip255 (ap[rxi] + rxs);
}
}
if (y == b) {
/* We're done, make sure we clean up any remaining fill. */
if (fill_start != fill_end) {
if (fill_size == N_Y_FRAC(8))
{
memset (ap + fill_start, 0xff, fill_end - fill_start);
}
else
{
add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8),
fill_end - fill_start);
}
}
break;
}
if (xFixedFrac (y) != Y_FRAC_LAST(8))
{
RenderEdgeStepSmall (l);
RenderEdgeStepSmall (r);
y += STEP_Y_SMALL(8);
}
else
{
RenderEdgeStepBig (l);
RenderEdgeStepBig (r);
y += STEP_Y_BIG(8);
if (fill_start != fill_end)
{
if (fill_size == N_Y_FRAC(8))
{
memset (ap + fill_start, 0xff, fill_end - fill_start);
}
else
{
add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8),
fill_end - fill_start);
}
fill_start = fill_end = -1;
fill_size = 0;
}
line += stride;
}
}
}
void
fbRasterizeEdges (FbBits *buf,
int bpp,
int width,
int stride,
RenderEdge *l,
RenderEdge *r,
xFixed t,
xFixed b)
{
switch (bpp) {
case 1:
fbRasterizeEdges1 (buf, width, stride, l, r, t, b);
break;
case 4:
fbRasterizeEdges4 (buf, width, stride, l, r, t, b);
break;
case 8:
fbRasterizeEdges8 (buf, width, stride, l, r, t, b);
break;
}
}
#endif /* RENDER */

View file

@ -1,143 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef rasterizeSpan
#endif
static void
rasterizeEdges (FbBits *buf,
int width,
int stride,
RenderEdge *l,
RenderEdge *r,
xFixed t,
xFixed b)
{
xFixed y = t;
FbBits *line;
line = buf + xFixedToInt (y) * stride;
for (;;)
{
xFixed lx, rx;
int lxi, rxi;
/* clip X */
lx = l->x;
if (lx < 0)
lx = 0;
rx = r->x;
if (xFixedToInt (rx) >= width)
rx = IntToxFixed (width);
/* Skip empty (or backwards) sections */
if (rx > lx)
{
/* Find pixel bounds for span */
lxi = xFixedToInt (lx);
rxi = xFixedToInt (rx);
#if N_BITS == 1
{
FbBits *a = line;
FbBits startmask, endmask;
int nmiddle;
int width = rxi - lxi;
int x = lxi;
a += x >> FB_SHIFT;
x &= FB_MASK;
FbMaskBits (x, width, startmask, nmiddle, endmask);
if (startmask)
*a++ |= startmask;
while (nmiddle--)
*a++ = FB_ALLONES;
if (endmask)
*a |= endmask;
}
#else
{
DefineAlpha(line,lxi);
int lxs, rxs;
/* Sample coverage for edge pixels */
lxs = RenderSamplesX (lx, N_BITS);
rxs = RenderSamplesX (rx, N_BITS);
/* Add coverage across row */
if (lxi == rxi)
{
AddAlpha (rxs - lxs);
}
else
{
int xi;
AddAlpha (N_X_FRAC(N_BITS) - lxs);
StepAlpha;
for (xi = lxi + 1; xi < rxi; xi++)
{
AddAlpha (N_X_FRAC(N_BITS));
StepAlpha;
}
/* Do not add in a 0 alpha here. This check is necessary
* to avoid a buffer overrun when rx is exactly on a pixel
* boundary.
*/
if (rxs != 0)
AddAlpha (rxs);
}
}
#endif
}
if (y == b)
break;
#if N_BITS > 1
if (xFixedFrac (y) != Y_FRAC_LAST(N_BITS))
{
RenderEdgeStepSmall (l);
RenderEdgeStepSmall (r);
y += STEP_Y_SMALL(N_BITS);
}
else
#endif
{
RenderEdgeStepBig (l);
RenderEdgeStepBig (r);
y += STEP_Y_BIG(N_BITS);
line += stride;
}
}
}
#undef rasterizeSpan

View file

@ -1,6 +1,4 @@
/*
* Id: fbfill.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -27,7 +25,6 @@
#endif
#include "fb.h"
#include "fbmmx.h"
void
fbFill (DrawablePtr pDrawable,
@ -47,17 +44,18 @@ fbFill (DrawablePtr pDrawable,
switch (pGC->fillStyle) {
case FillSolid:
#ifdef USE_MMX
if (!pPriv->and && fbHaveMMX())
if (fbSolidFillmmx (pDrawable, x, y, width, height, pPriv->xor))
return;
#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);
fbSolid (dst + (y + dstYoff) * dstStride,
dstStride,
(x + dstXoff) * dstBpp,
dstBpp,
width * dstBpp, height,
pPriv->and, pPriv->xor);
break;
case FillStippled:
case FillOpaqueStippled: {
@ -92,6 +90,7 @@ fbFill (DrawablePtr pDrawable,
(pGC->patOrg.x + pDrawable->x + dstXoff),
pGC->patOrg.y + pDrawable->y - y);
fbFinishAccess (&pStip->drawable);
}
else
{
@ -129,6 +128,7 @@ fbFill (DrawablePtr pDrawable,
bgand, bgxor,
pGC->patOrg.x + pDrawable->x + dstXoff,
pGC->patOrg.y + pDrawable->y - y);
fbFinishAccess (&pStip->drawable);
}
break;
}
@ -157,10 +157,12 @@ fbFill (DrawablePtr pDrawable,
dstBpp,
(pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
pGC->patOrg.y + pDrawable->y - y);
fbFinishAccess (&pTile->drawable);
break;
}
}
fbValidateDrawable (pDrawable);
fbFinishAccess (pDrawable);
}
void
@ -209,23 +211,20 @@ fbSolidBoxClipped (DrawablePtr pDrawable,
if (partY2 <= partY1)
continue;
#ifdef USE_MMX
if (!and && fbHaveMMX())
{
if (fbSolidFillmmx (pDrawable,
partX1, partY1,
(partX2 - partX1), (partY2 - partY1),
xor))
return;
}
#ifndef FB_ACCESS_WRAPPER
if (and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
partX1 + dstXoff, partY1 + dstYoff,
(partX2 - partX1), (partY2 - partY1),
xor))
#endif
fbSolid (dst + (partY1 + dstYoff) * dstStride,
dstStride,
(partX1 + dstXoff) * dstBpp,
dstBpp,
(partX2 - partX1) * dstBpp,
(partY2 - partY1),
and, xor);
fbSolid (dst + (partY1 + dstYoff) * dstStride,
dstStride,
(partX1 + dstXoff) * dstBpp,
dstBpp,
(partX2 - partX1) * dstBpp,
(partY2 - partY1),
and, xor);
}
fbFinishAccess (pDrawable);
}

View file

@ -1,6 +1,4 @@
/*
* Id: fbfillrect.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbfillsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbgc.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -106,16 +104,18 @@ fbPadPixmap (PixmapPtr pPixmap)
mask = FbBitsMask (0, width);
while (height--)
{
b = *bits & mask;
b = READ(bits) & mask;
w = width;
while (w < FB_UNIT)
{
b = b | FbScrRight(b, w);
w <<= 1;
}
*bits = b;
WRITE(bits, b);
bits += stride;
}
fbFinishAccess (&pPixmap->drawable);
}
/*
@ -153,7 +153,7 @@ fbLineRepeat (FbBits *bits, int len, int width)
width = (width + FB_UNIT-1) >> FB_SHIFT;
bits++;
while (--width)
if (*bits != first)
if (READ(bits) != first)
return FALSE;
return TRUE;
}
@ -183,10 +183,13 @@ fbCanEvenStipple (PixmapPtr pStipple, int bpp)
/* check to see that the stipple repeats horizontally */
while (h--)
{
if (!fbLineRepeat (bits, len, pStipple->drawable.width))
if (!fbLineRepeat (bits, len, pStipple->drawable.width)) {
fbFinishAccess (&pStipple->drawable);
return FALSE;
}
bits += stride;
}
fbFinishAccess (&pStipple->drawable);
return TRUE;
}

View file

@ -1,6 +1,4 @@
/*
* Id: fbgetsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -84,4 +82,6 @@ fbGetSpans(DrawablePtr pDrawable,
ppt++;
pwidth++;
}
fbFinishAccess (pDrawable);
}

View file

@ -62,11 +62,11 @@ fbGlyphIn (RegionPtr pRegion,
#ifdef FB_24BIT
#ifndef FBNOPIXADDR
#define WRITE1(d,n,fg) ((d)[n] = (CARD8) fg)
#define WRITE2(d,n,fg) (*(CARD16 *) &(d[n]) = (CARD16) fg)
#define WRITE4(d,n,fg) (*(CARD32 *) &(d[n]) = (CARD32) fg)
#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)
#if FB_UNIT == 6 && IMAGE_BYTE_ORDER == LSBFirst
#define WRITE8(d) (*(FbBits *) &(d[0]) = fg)
#define WRITE8(d) WRITE((FbBits *) &(d[0]), fg)
#else
#define WRITE8(d) WRITE4(d,0,_ABCA), WRITE4(d,4,_BCAB)
#endif
@ -157,7 +157,7 @@ fbGlyph24 (FbBits *dstBits,
lshift = 4 - shift;
while (height--)
{
bits = *stipple++;
bits = READ(stipple++);
n = lshift;
dst = dstLine;
while (bits)
@ -284,7 +284,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable,
glyph = 0;
if (pGC->fillStyle == FillSolid && pPriv->and == 0)
{
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
dstBpp = pDrawable->bitsPerPixel;
switch (dstBpp) {
case 8: glyph = fbGlyph8; break;
case 16: glyph = fbGlyph16; break;
@ -312,6 +312,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable,
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,
@ -319,6 +320,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable,
pPriv->xor,
gx + dstXoff,
gHeight);
fbFinishAccess (pDrawable);
}
else
#endif
@ -375,7 +377,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable,
glyph = 0;
if (pPriv->and == 0)
{
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
dstBpp = pDrawable->bitsPerPixel;
switch (dstBpp) {
case 8: glyph = fbGlyph8; break;
case 16: glyph = fbGlyph16; break;
@ -443,6 +445,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable,
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,
@ -450,6 +453,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable,
pPriv->fg,
gx + dstXoff,
gHeight);
fbFinishAccess (pDrawable);
}
else
#endif

View file

@ -1,6 +1,4 @@
/*
* Id: fbimage.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -170,6 +168,8 @@ fbPutZImage (DrawablePtr pDrawable,
pm,
dstBpp);
}
fbFinishAccess (pDrawable);
}
void
@ -277,6 +277,8 @@ fbPutXYImage (DrawablePtr pDrawable,
fgand, fgxor, bgand, bgxor);
}
}
fbFinishAccess (pDrawable);
}
void
@ -361,4 +363,6 @@ fbGetImage (DrawablePtr pDrawable,
fbXorStip(GXcopy,0,FB_STIP_ALLONES),
planeMask);
}
fbFinishAccess (pDrawable);
}

View file

@ -1,6 +1,4 @@
/*
* $XFree86$
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

2314
fb/fbmmx.c

File diff suppressed because it is too large Load diff

View file

@ -1,220 +0,0 @@
/*
* Copyright © 2004 Red Hat, Inc.
* Copyright © 2005 Trolltech AS
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Red Hat not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Red Hat makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Søren Sandmann (sandmann@redhat.com)
* Lars Knoll (lars@trolltech.com)
*
* Based on work by Owen Taylor
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef USE_MMX
#if !defined(__amd64__) && !defined(__x86_64__)
Bool fbHaveMMX(void);
#else
#define fbHaveMMX() TRUE
#endif
#else
#define fbHaveMMX() FALSE
#endif
#ifdef USE_MMX
void fbComposeSetupMMX(void);
void fbCompositeSolidMask_nx8888x0565Cmmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrcAdd_8888x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolidMask_nx8888x8888Cmmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolidMask_nx8x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrcAdd_8000x8000mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888RevNPx8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888RevNPx0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolid_nx8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolid_nx0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolidMask_nx8x0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888x8x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
Bool fbCopyAreammx (DrawablePtr pSrc,
DrawablePtr pDst,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height);
void fbCompositeCopyAreammx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
Bool fbSolidFillmmx (DrawablePtr pDraw,
int x,
int y,
int width,
int height,
FbBits xor);
#endif /* USE_MMX */

View file

@ -413,11 +413,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
return FALSE;
if (! miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0,
depth1, ndepths, depths,
defaultVisual, nvisuals, visuals
#ifdef FB_OLD_MISCREENINIT
, (miBSFuncPtr) 0
#endif
))
defaultVisual, nvisuals, visuals))
return FALSE;
/* MI thinks there's no frame buffer */
#ifdef MITSHM

File diff suppressed because it is too large Load diff

View file

@ -114,14 +114,22 @@ fbCanGetSolid(PicturePtr pict)
fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \
switch (__bpp__) { \
case 32: \
(bits) = *(CARD32 *) __bits__; \
(bits) = READ((CARD32 *) __bits__); \
break; \
case 24: \
(bits) = Fetch24 ((CARD8 *) __bits__); \
break; \
case 16: \
(bits) = *(CARD16 *) __bits__; \
(bits) = cvt0565to8888(bits); \
(bits) = READ((CARD16 *) __bits__); \
(bits) = cvt0565to0888(bits); \
break; \
case 8: \
(bits) = READ((CARD8 *) __bits__); \
(bits) = (bits) << 24; \
break; \
case 1: \
(bits) = READ((CARD32 *) __bits__); \
(bits) = FbLeftStipBits((bits),1) ? 0xff000000 : 0x00000000;\
break; \
default: \
return; \
@ -137,6 +145,7 @@ fbCanGetSolid(PicturePtr pict)
/* manage missing src alpha */ \
if ((pict)->pFormat->direct.alphaMask == 0) \
(bits) |= 0xff000000; \
fbFinishAccess ((pict)->pDrawable); \
}
#define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\
@ -152,28 +161,28 @@ fbCanGetSolid(PicturePtr pict)
#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
(((s) >> 5) & 0x07e0) | \
(((s) >> 8) & 0xf800))
#define cvt0565to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
#define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
#if IMAGE_BYTE_ORDER == MSBFirst
#define Fetch24(a) ((unsigned long) (a) & 1 ? \
((*(a) << 16) | *((CARD16 *) ((a)+1))) : \
((*((CARD16 *) (a)) << 8) | *((a)+2)))
((READ(a) << 16) | READ((CARD16 *) ((a)+1))) : \
((READ((CARD16 *) (a)) << 8) | READ((a)+2)))
#define Store24(a,v) ((unsigned long) (a) & 1 ? \
((*(a) = (CARD8) ((v) >> 16)), \
(*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \
((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \
(*((a)+2) = (CARD8) (v))))
(WRITE(a, (CARD8) ((v) >> 16)), \
WRITE((CARD16 *) ((a)+1), (CARD16) (v))) : \
(WRITE((CARD16 *) (a), (CARD16) ((v) >> 8)), \
WRITE((a)+2, (CARD8) (v))))
#else
#define Fetch24(a) ((unsigned long) (a) & 1 ? \
((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \
((*((CARD16 *) (a))) | (*((a)+2) << 16)))
(READ(a) | (READ((CARD16 *) ((a)+1)) << 8)) : \
(READ((CARD16 *) (a)) | (READ((a)+2) << 16)))
#define Store24(a,v) ((unsigned long) (a) & 1 ? \
((*(a) = (CARD8) (v)), \
(*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \
((*((CARD16 *) (a)) = (CARD16) (v)),\
(*((a)+2) = (CARD8) ((v) >> 16))))
(WRITE(a, (CARD8) (v)), \
WRITE((CARD16 *) ((a)+1), (CARD16) ((v) >> 8))) : \
(WRITE((CARD16 *) (a), (CARD16) (v)),\
WRITE((a)+2, (CARD8) ((v) >> 16))))
#endif
/*
@ -374,6 +383,9 @@ typedef struct _FbComposeData {
CARD16 height;
} FbComposeData;
void
fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer);
typedef FASTCALL void (*CombineMaskU) (CARD32 *src, const CARD32 *mask, int width);
typedef FASTCALL void (*CombineFuncU) (CARD32 *dest, const CARD32 *src, int width);
typedef FASTCALL void (*CombineFuncC) (CARD32 *dest, CARD32 *src, CARD32 *mask, int width);
@ -400,210 +412,7 @@ fbCompositeGeneral (CARD8 op,
CARD16 width,
CARD16 height);
/* fbedge.c */
void
fbRasterizeEdges (FbBits *buf,
int bpp,
int width,
int stride,
RenderEdge *l,
RenderEdge *r,
xFixed t,
xFixed b);
/* fbpict.c */
CARD32
fbOver (CARD32 x, CARD32 y);
CARD32
fbOver24 (CARD32 x, CARD32 y);
CARD32
fbIn (CARD32 x, CARD8 y);
void
fbCompositeSolidMask_nx8x8888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx8x0888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx8888x8888C (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx8x0565 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx8888x0565C (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_8888x8888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_8888x0888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_8888x0565 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_0565x0565 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrcAdd_8000x8000 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrcAdd_8888x8888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrcAdd_1000x1000 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx1xn (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbComposite (CARD8 op,
PicturePtr pSrc,
@ -618,19 +427,18 @@ fbComposite (CARD8 op,
CARD16 width,
CARD16 height);
typedef void (*CompositeFunc) (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
typedef void (*CompositeFunc) (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbWalkCompositeRegion (CARD8 op,

View file

@ -1,6 +1,4 @@
/*
* Id: fbpixmap.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -43,11 +41,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp)
if (paddedWidth / 4 > 32767 || height > 32767)
return NullPixmap;
datasize = height * paddedWidth;
#ifdef PIXPRIV
base = pScreen->totalPixmapSize;
#else
base = sizeof (PixmapRec);
#endif
adjust = 0;
if (base & 7)
adjust = 8 - (base & 7);
@ -160,6 +154,8 @@ fbPixmapToRegion(PixmapPtr pPix)
FirstRect = REGION_BOXPTR(pReg);
rects = FirstRect;
fbPrepareAccess(&pPix->drawable);
pwLine = (FbBits *) pPix->devPrivate.ptr;
nWidth = pPix->devKind >> (FB_SHIFT-3);
@ -174,7 +170,7 @@ fbPixmapToRegion(PixmapPtr pPix)
irectLineStart = rects - FirstRect;
/* If the Screen left most bit of the word is set, we're starting in
* a box */
if(*pw & mask0)
if(READ(pw) & mask0)
{
fInBox = TRUE;
rx1 = 0;
@ -185,7 +181,7 @@ fbPixmapToRegion(PixmapPtr pPix)
pwLineEnd = pw + (width >> FB_SHIFT);
for (base = 0; pw < pwLineEnd; base += FB_UNIT)
{
w = *pw++;
w = READ(pw++);
if (fInBox)
{
if (!~w)
@ -226,7 +222,7 @@ fbPixmapToRegion(PixmapPtr pPix)
if(width & FB_MASK)
{
/* Process final partial word on line */
w = *pw++;
w = READ(pw++);
for(ib = 0; ib < (width & FB_MASK); ib++)
{
/* If the Screen left most bit of the word is set, we're
@ -311,6 +307,8 @@ fbPixmapToRegion(PixmapPtr pPix)
pReg->data = (RegDataPtr)NULL;
}
}
fbFinishAccess(&pPix->drawable);
#ifdef DEBUG
if (!miValidRegion(pReg))
FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
@ -318,15 +316,6 @@ fbPixmapToRegion(PixmapPtr pPix)
return(pReg);
}
int fb_null_pointer(char *file, unsigned int line) {
ErrorF("%s:%u: null pointer (break on fb_null_pointer to debug)\n", file, line);
#ifdef FB_DEBUG
return 0; // ignore error, die horrible death
#else
return 1; // harmlessly return to caller, hope we don't crash later
#endif
}
#ifdef FB_DEBUG
#ifndef WIN32
@ -366,14 +355,12 @@ fbValidateDrawable (DrawablePtr pDrawable)
if (pDrawable->type != DRAWABLE_PIXMAP)
pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable);
fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff);
#ifdef __APPLE__
if (bits >= 0xb0000000) return; // don't validate CG memory
#endif
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);
}
void
@ -395,5 +382,6 @@ fbInitializeDrawable (DrawablePtr pDrawable)
last = bits + stride * pDrawable->height;
fbSetBits (first, stride, FB_HEAD_BITS);
fbSetBits (last, stride, FB_TAIL_BITS);
fbFinishAccess (pDrawable);
}
#endif /* FB_DEBUG */

View file

@ -1,6 +1,4 @@
/*
* Id: fbpoint.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -90,20 +88,20 @@ fbDots (FbBits *dstOrig,
FbMaskStip (x, 24, leftMask, n, rightMask);
if (leftMask)
{
*d = FbDoMaskRRop (*d, andT, xorT, leftMask);
WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
andT = FbNext24Stip(andT);
xorT = FbNext24Stip(xorT);
d++;
}
if (rightMask)
*d = FbDoMaskRRop(*d, andT, xorT, rightMask);
WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
}
else
#endif
{
FbStip mask;
mask = FbStipMask(x, dstBpp);
*d = FbDoMaskRRop (*d, and, xor, mask);
WRITE(d, FbDoMaskRRop (READ(d), and, xor, mask));
}
}
}
@ -160,4 +158,5 @@ fbPolyPoint (DrawablePtr pDrawable,
nBox--; pBox++)
(*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit,
pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor);
fbFinishAccess (pDrawable);
}

View file

@ -875,6 +875,8 @@ xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg,
register CARD16 *d;
int w;
fbPrepareAccess((DrawablePtr)pScreen->devPrivate);
dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr;
dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind
/ sizeof (CARD16);
@ -899,6 +901,8 @@ xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg,
}
pbox++;
}
fbFinishAccess(&((PixmapPtr)pScreen->devPrivate)->drawable);
}
static void
@ -1200,7 +1204,7 @@ GCFuncs xxGCFuncs = {
xxChangeClip, xxDestroyClip, xxCopyClip
};
GCOps xxGCOps = {
static GCOps xxGCOps = {
xxFillSpans, xxSetSpans,
xxPutImage, xxCopyArea,
xxCopyPlane, xxPolyPoint,

View file

@ -1,6 +1,4 @@
/*
* Id: fbpush.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -58,7 +56,7 @@ fbPushPattern (DrawablePtr pDrawable,
w = width;
s = src;
src += srcStride;
bits = *s++;
bits = READ(s++);
xspan = x;
while (w)
{
@ -73,7 +71,7 @@ fbPushPattern (DrawablePtr pDrawable,
bitsMask = FbStipRight (bitsMask, 1);
if (!bitsMask)
{
bits = *s++;
bits = READ(s++);
bitsMask = FbBitsMask(0,1);
}
} while (bits & bitsMask);
@ -92,7 +90,7 @@ fbPushPattern (DrawablePtr pDrawable,
bitsMask = FbStipRight (bitsMask, 1);
if (!bitsMask)
{
bits = *s++;
bits = READ(s++);
bitsMask = FbBitsMask(0,1);
}
} while (!(bits & bitsMask));
@ -165,6 +163,7 @@ fbPushFill (DrawablePtr pDrawable,
fbAnd(GXnoop,(FbBits) 0,FB_ALLONES),
fbXor(GXnoop,(FbBits) 0,FB_ALLONES));
}
fbFinishAccess (pDrawable);
}
else
{

View file

@ -1,6 +1,4 @@
/*
* Id: fbrop.h,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -81,7 +81,6 @@ fbQueryBestSize (int class,
}
}
#ifndef FB_OLD_SCREEN
PixmapPtr
_fbGetWindowPixmap (WindowPtr pWindow)
{
@ -97,7 +96,6 @@ _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
pWindow->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap;
#endif
}
#endif
Bool
fbSetupScreen(ScreenPtr pScreen,
@ -141,7 +139,6 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->ResolveColor = fbResolveColor;
pScreen->BitmapToRegion = fbPixmapToRegion;
#ifndef FB_OLD_SCREEN
pScreen->GetWindowPixmap = _fbGetWindowPixmap;
pScreen->SetWindowPixmap = _fbSetWindowPixmap;
@ -150,11 +147,23 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->BackingStoreFuncs.SetClipmaskRgn = 0;
pScreen->BackingStoreFuncs.GetImagePixmap = 0;
pScreen->BackingStoreFuncs.GetSpansPixmap = 0;
#endif
return TRUE;
}
#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)
#else
Bool
fbFinishScreenInit(ScreenPtr pScreen,
pointer pbits,
@ -164,6 +173,7 @@ fbFinishScreenInit(ScreenPtr pScreen,
int dpiy,
int width,
int bpp)
#endif
{
VisualPtr visuals;
DepthPtr depths;
@ -222,6 +232,10 @@ fbFinishScreenInit(ScreenPtr pScreen,
fbGetScreenPrivate(pScreen)->win32bpp = 32;
fbGetScreenPrivate(pScreen)->pix32bpp = 32;
}
#ifdef FB_ACCESS_WRAPPER
fbGetScreenPrivate(pScreen)->setupWrap = setupWrap;
fbGetScreenPrivate(pScreen)->finishWrap = finishWrap;
#endif
#endif
rootdepth = 0;
if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
@ -229,11 +243,7 @@ fbFinishScreenInit(ScreenPtr pScreen,
return FALSE;
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
rootdepth, ndepths, depths,
defaultVisual, nvisuals, visuals
#ifdef FB_OLD_MISCREENINIT
, (miBSFuncPtr) 0
#endif
))
defaultVisual, nvisuals, visuals))
return FALSE;
/* overwrite miCloseScreen with our own */
pScreen->CloseScreen = fbCloseScreen;
@ -256,6 +266,27 @@ 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)
{
if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
return FALSE;
if (!wfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
width, bpp, setupWrap, finishWrap))
return FALSE;
return TRUE;
}
#else
Bool
fbScreenInit(ScreenPtr pScreen,
pointer pbits,
@ -273,26 +304,4 @@ fbScreenInit(ScreenPtr pScreen,
return FALSE;
return TRUE;
}
#ifdef FB_OLD_SCREEN
const miBSFuncRec fbBSFuncRec = {
fbSaveAreas,
fbRestoreAreas,
(void (*)(GCPtr, RegionPtr)) 0,
(PixmapPtr (*)(void)) 0,
(PixmapPtr (*)(void)) 0,
};
#endif
#if 0
void
fbInitializeBackingStore (ScreenPtr pScreen)
{
#ifdef FB_OLD_SCREEN
miInitializeBackingStore (pScreen, (miBSFuncRec *) &fbBSFuncRec);
#else
miInitializeBackingStore (pScreen);
#endif
}
#endif

View file

@ -1,6 +1,4 @@
/*
* Id: fbseg.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -79,7 +77,7 @@ fbBresSolid (DrawablePtr pDrawable,
mask = fbBresShiftMask(mask,signdx,dstBpp);
if (!mask)
{
*dst = FbDoMaskRRop (*dst, and, xor, bits);
WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
bits = 0;
dst += signdx;
mask = mask0;
@ -87,20 +85,20 @@ fbBresSolid (DrawablePtr pDrawable,
e += e1;
if (e >= 0)
{
*dst = FbDoMaskRRop (*dst, and, xor, bits);
WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
bits = 0;
dst += dstStride;
e += e3;
}
}
if (bits)
*dst = FbDoMaskRRop (*dst, and, xor, bits);
WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
}
else
{
while (len--)
{
*dst = FbDoMaskRRop (*dst, and, xor, mask);
WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, mask));
dst += dstStride;
e += e1;
if (e >= 0)
@ -115,6 +113,8 @@ fbBresSolid (DrawablePtr pDrawable,
}
}
}
fbFinishAccess (pDrawable);
}
void
@ -164,9 +164,9 @@ fbBresDash (DrawablePtr pDrawable,
while (len--)
{
if (even)
*dst = FbDoMaskRRop (*dst, and, xor, mask);
WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, mask));
else if (doOdd)
*dst = FbDoMaskRRop (*dst, bgand, bgxor, mask);
WRITE(dst, FbDoMaskRRop (READ(dst), bgand, bgxor, mask));
if (axis == X_AXIS)
{
mask = fbBresShiftMask(mask,signdx,dstBpp);
@ -199,6 +199,8 @@ fbBresDash (DrawablePtr pDrawable,
}
FbDashStep (dashlen, even);
}
fbFinishAccess (pDrawable);
}
void
@ -371,13 +373,13 @@ fbBresSolid24RRop (DrawablePtr pDrawable,
FbMaskStip (x, 24, leftMask, nl, rightMask);
if (leftMask)
{
*d = FbDoMaskRRop (*d, andT, xorT, leftMask);
WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
d++;
andT = FbNext24Stip (andT);
xorT = FbNext24Stip (xorT);
}
if (rightMask)
*d = FbDoMaskRRop (*d, andT, xorT, rightMask);
WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, rightMask));
if (axis == X_AXIS)
{
x1 += signdx;
@ -399,6 +401,8 @@ fbBresSolid24RRop (DrawablePtr pDrawable,
}
}
}
fbFinishAccess (pDrawable);
}
static void
@ -468,13 +472,13 @@ fbBresDash24RRop (DrawablePtr pDrawable,
FbMaskStip (x, 24, leftMask, nl, rightMask);
if (leftMask)
{
*d = FbDoMaskRRop (*d, andT, xorT, leftMask);
WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
d++;
andT = FbNext24Stip (andT);
xorT = FbNext24Stip (xorT);
}
if (rightMask)
*d = FbDoMaskRRop (*d, andT, xorT, rightMask);
WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, rightMask));
}
if (axis == X_AXIS)
{
@ -498,6 +502,8 @@ fbBresDash24RRop (DrawablePtr pDrawable,
}
FbDashStep (dashlen, even);
}
fbFinishAccess (pDrawable);
}
#endif

View file

@ -1,6 +1,4 @@
/*
* Id: fbsetsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -99,5 +97,6 @@ fbSetSpans (DrawablePtr pDrawable,
pwidth++;
}
fbValidateDrawable (pDrawable);
fbFinishAccess (pDrawable);
}

View file

@ -1,6 +1,4 @@
/*
* $XFree86$
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -70,12 +68,12 @@ fbSolid (FbBits *dst,
n = nmiddle;
if (!and)
while (n--)
*dst++ = xor;
WRITE(dst++, xor);
else
while (n--)
{
*dst = FbDoRRop (*dst, and, xor);
dst++;
WRITE(dst, FbDoRRop (READ(dst), and, xor));
dst++;
}
if (endmask)
FbDoRightMaskByteRRop(dst,endbyte,endmask,and,xor);
@ -160,26 +158,26 @@ fbSolid24 (FbBits *dst,
{
if (startmask)
{
*dst = FbDoMaskRRop(*dst, andS, xorS, startmask);
dst++;
WRITE(dst, FbDoMaskRRop(READ(dst), andS, xorS, startmask));
dst++;
}
n = nmiddle;
if (!and0)
{
while (n >= 3)
{
*dst++ = xor0;
*dst++ = xor1;
*dst++ = xor2;
WRITE(dst++, xor0);
WRITE(dst++, xor1);
WRITE(dst++, xor2);
n -= 3;
}
if (n)
{
*dst++ = xor0;
WRITE(dst++, xor0);
n--;
if (n)
{
*dst++ = xor1;
WRITE(dst++, xor1);
}
}
}
@ -187,28 +185,28 @@ fbSolid24 (FbBits *dst,
{
while (n >= 3)
{
*dst = FbDoRRop (*dst, and0, xor0);
dst++;
*dst = FbDoRRop (*dst, and1, xor1);
dst++;
*dst = FbDoRRop (*dst, and2, xor2);
dst++;
WRITE(dst, FbDoRRop (READ(dst), and0, xor0));
dst++;
WRITE(dst, FbDoRRop (READ(dst), and1, xor1));
dst++;
WRITE(dst, FbDoRRop (READ(dst), and2, xor2));
dst++;
n -= 3;
}
if (n)
{
*dst = FbDoRRop (*dst, and0, xor0);
dst++;
WRITE(dst, FbDoRRop (READ(dst), and0, xor0));
dst++;
n--;
if (n)
{
*dst = FbDoRRop (*dst, and1, xor1);
dst++;
WRITE(dst, FbDoRRop (READ(dst), and1, xor1));
dst++;
}
}
}
if (endmask)
*dst = FbDoMaskRRop (*dst, andE, xorE, endmask);
WRITE(dst, FbDoMaskRRop (READ(dst), andE, xorE, endmask));
dst += dstStride;
}
}

View file

@ -1,6 +1,4 @@
/*
* Id: fbstipple.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -155,7 +153,7 @@ fbEvenStipple (FbBits *dst,
/*
* Extract stipple bits for this scanline;
*/
bits = *s;
bits = READ(s);
s += stipStride;
if (s == stipEnd)
s = stip;
@ -199,12 +197,12 @@ fbEvenStipple (FbBits *dst,
n = nmiddle;
if (!and)
while (n--)
*dst++ = xor;
WRITE(dst++, xor);
else
{
while (n--)
{
*dst = FbDoRRop (*dst, and, xor);
WRITE(dst, FbDoRRop (READ(dst), and, xor));
dst++;
}
}

View file

@ -1,6 +1,4 @@
/*
* Id: fbtile.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -42,6 +40,7 @@ fbEvenTile (FbBits *dst,
int height,
FbBits *tile,
FbStride tileStride,
int tileHeight,
int alu,
@ -68,9 +67,9 @@ fbEvenTile (FbBits *dst,
/*
* Compute tile start scanline and rotation parameters
*/
tileEnd = tile + tileHeight;
tileEnd = tile + tileHeight * tileStride;
modulus (- yRot, tileHeight, tileY);
t = tile + tileY;
t = tile + tileY * tileStride;
modulus (- xRot, FB_UNIT, tileX);
rot = tileX;
@ -80,8 +79,9 @@ fbEvenTile (FbBits *dst,
/*
* Pick up bits for this scanline
*/
bits = *t++;
if (t == tileEnd) t = tile;
bits = READ(t);
t += tileStride;
if (t >= tileEnd) t = tile;
bits = FbRotLeft(bits,rot);
and = fbAnd(alu,bits,pm);
xor = fbXor(alu,bits,pm);
@ -94,11 +94,11 @@ fbEvenTile (FbBits *dst,
n = nmiddle;
if (!and)
while (n--)
*dst++ = xor;
WRITE(dst++, xor);
else
while (n--)
{
*dst = FbDoRRop (*dst, and, xor);
WRITE(dst, FbDoRRop (READ(dst), and, xor));
dst++;
}
if (endmask)
@ -194,7 +194,7 @@ fbTile (FbBits *dst,
{
if (FbEvenTile (tileWidth))
fbEvenTile (dst, dstStride, dstX, width, height,
tile, tileHeight,
tile, tileStride, tileHeight,
alu, pm, xRot, yRot);
else
fbOddTile (dst, dstStride, dstX, width, height,

View file

@ -1,6 +1,4 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -42,59 +40,14 @@ fbAddTraps (PicturePtr pPicture,
int ntrap,
xTrap *traps)
{
FbBits *buf;
int bpp;
int width;
int stride;
int height;
int pxoff, pyoff;
pixman_image_t *image = image_from_pict (pPicture, FALSE);
xFixed x_off_fixed;
xFixed y_off_fixed;
RenderEdge l, r;
xFixed t, b;
if (!image)
return;
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps);
width = pPicture->pDrawable->width;
height = pPicture->pDrawable->height;
x_off += pxoff;
y_off += pyoff;
x_off_fixed = IntToxFixed(y_off);
y_off_fixed = IntToxFixed(y_off);
while (ntrap--)
{
t = traps->top.y + y_off_fixed;
if (t < 0)
t = 0;
t = RenderSampleCeilY (t, bpp);
b = traps->bot.y + y_off_fixed;
if (xFixedToInt (b) >= height)
b = IntToxFixed (height) - 1;
b = RenderSampleFloorY (b, bpp);
if (b >= t)
{
/* initialize edge walkers */
RenderEdgeInit (&l, bpp, t,
traps->top.l + x_off_fixed,
traps->top.y + y_off_fixed,
traps->bot.l + x_off_fixed,
traps->bot.y + y_off_fixed);
RenderEdgeInit (&r, bpp, t,
traps->top.r + x_off_fixed,
traps->top.y + y_off_fixed,
traps->bot.r + x_off_fixed,
traps->bot.y + y_off_fixed);
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
}
traps++;
}
free_pixman_pict (pPicture, image);
}
void
@ -103,45 +56,14 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
int x_off,
int y_off)
{
FbBits *buf;
int bpp;
int width;
int stride;
int height;
int pxoff, pyoff;
pixman_image_t *image = image_from_pict (pPicture, FALSE);
xFixed x_off_fixed;
xFixed y_off_fixed;
RenderEdge l, r;
xFixed t, b;
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
if (!image)
return;
width = pPicture->pDrawable->width;
height = pPicture->pDrawable->height;
x_off += pxoff;
y_off += pyoff;
x_off_fixed = IntToxFixed(x_off);
y_off_fixed = IntToxFixed(y_off);
t = trap->top + y_off_fixed;
if (t < 0)
t = 0;
t = RenderSampleCeilY (t, bpp);
pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off);
b = trap->bottom + y_off_fixed;
if (xFixedToInt (b) >= height)
b = IntToxFixed (height) - 1;
b = RenderSampleFloorY (b, bpp);
if (b >= t)
{
/* initialize edge walkers */
RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off);
RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off);
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
}
free_pixman_pict (pPicture, image);
}
static int

View file

@ -1,6 +1,4 @@
/*
* Id: fbutil.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbwindow.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -30,10 +28,6 @@
#include "fb.h"
#ifdef USE_MMX
#include "fbmmx.h"
#endif
Bool
fbCreateWindow(WindowPtr pWin)
{
@ -118,6 +112,9 @@ fbCopyWindowProc (DrawablePtr pSrcDrawable,
upsidedown);
pbox++;
}
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
}
void
@ -219,36 +216,39 @@ fbFillRegionSolid (DrawablePtr pDrawable,
int n = REGION_NUM_RECTS(pRegion);
BoxPtr pbox = REGION_RECTS(pRegion);
#ifdef USE_MMX
int has_mmx = 0;
if (!and && fbHaveMMX())
has_mmx = 1;
#ifndef FB_ACCESS_WRAPPER
int try_mmx = 0;
if (!and)
try_mmx = 1;
#endif
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
while (n--)
{
#ifdef USE_MMX
if (!has_mmx || !fbSolidFillmmx (pDrawable,
pbox->x1,
pbox->y1,
(pbox->x2 - pbox->x1),
(pbox->y2 - pbox->y1), xor)) {
#ifndef FB_ACCESS_WRAPPER
if (!try_mmx || !pixman_fill (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);
#ifdef USE_MMX
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++;
}
fbFinishAccess (pDrawable);
}
#ifdef PANORAMIX
@ -311,6 +311,9 @@ fbFillRegionTiled (DrawablePtr pDrawable,
yRot - (pbox->y1 + dstYoff));
pbox++;
}
fbFinishAccess (&pTile->drawable);
fbFinishAccess (pDrawable);
}
void