diff options
| author | Mihai Moldovan <ionic@ionic.de> | 2017-12-15 12:55:17 +0100 |
|---|---|---|
| committer | Mihai Moldovan <ionic@ionic.de> | 2017-12-15 12:55:17 +0100 |
| commit | 1dad092caf01d733990648e6df64cbf964df5143 (patch) | |
| tree | 39de0e643e76754a3e23ca9dd0350b8ba4f76250 /nx-X11/programs/Xserver/fb | |
| parent | 6d70b9e3c47f27a166f4aacb522c5c1e49092dd9 (diff) | |
| parent | 2b9025f797ee322e21077e100c2ee27c2e7fa0e0 (diff) | |
| download | nx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.gz nx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.bz2 nx-libs-1dad092caf01d733990648e6df64cbf964df5143.zip | |
Merge branch '3.6.x'
Diffstat (limited to 'nx-X11/programs/Xserver/fb')
49 files changed, 250 insertions, 6426 deletions
diff --git a/nx-X11/programs/Xserver/fb/Imakefile b/nx-X11/programs/Xserver/fb/Imakefile index cb560e7a0..5daa10c6f 100644 --- a/nx-X11/programs/Xserver/fb/Imakefile +++ b/nx-X11/programs/Xserver/fb/Imakefile @@ -1,45 +1,13 @@ -XCOMM $XFree86: xc/programs/Xserver/fb/Imakefile,v 1.16 2002/05/31 16:12:17 dawes Exp $ -XCOMM -XCOMM -XCOMM Id: Imakefile,v 1.1 1999/11/02 03:54:44 keithp Exp $ - -/* - * The X.org 6.8.99.16 snapshot fails to compile with GCC 4. - * Temporarily disable the MMX features until the bug is - * fixed. - * -#if defined(HasGcc34) && HasGcc34 -MMXOPTIONS= -mmmx -msse -Winline --param inline-unit-growth=10000 \ - --param large-function-growth=10000 -DUSE_MMX -USEMMXOPTIONS= -DUSE_MMX -#if defined(i386Architecture) || defined(AMD64Architecture) -SpecialCObjectRule(fbmmx,fbmmx.c,$(MMXOPTIONS)) -SpecialCObjectRule(fbpict,fbpict.c,$(USEMMXOPTIONS)) -SpecialCObjectRule(fbfill,fbfill.c,$(USEMMXOPTIONS)) -SpecialCObjectRule(fbcopy,fbcopy.c,$(USEMMXOPTIONS)) -#endif - -#endif - */ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif +NULL = #include <Server.tmpl> #ifdef FbNoPixelAddrCode -DEFINES=-DFBNOPIXADDR -DFBNO24BIT +FB_DEFINES=-DFBNOPIXADDR -DFBNO24BIT #endif -#if defined(IHaveModules) -XFMODSRC = fbmodule.c -XFMODOBJ = fbmodule.o +#if HasShm +SHM_DEFINES = ShmDefines #endif #if BuildRender @@ -47,6 +15,16 @@ RENDERSRC = fbcompose.c RENDEROBJ = fbcompose.o #endif +#if defined(NXAgentServer) && NXAgentServer +NX_DEFINES = -DNXAGENT_SERVER +#endif + +#if defined(NXAgentServer) && NXAgentServer + DEFINES = $(FB_DEFINES) $(NX_DEFINES) +#else + DEFINES = $(FB_DEFINES) +#endif + SRCS = $(XFMODSRC) \ fballpriv.c \ fbbits.c \ @@ -80,8 +58,7 @@ SRCS = $(XFMODSRC) \ fbwindow.c \ fb24_32.c \ fbpict.c \ - fbmmx.c \ - fbpseudocolor.c + $(NULL) OBJS = $(XFMODOBJ) \ fbarc.o \ @@ -117,31 +94,23 @@ OBJS = $(XFMODOBJ) \ fbwindow.o \ fb24_32.o \ fbpict.o \ - fbmmx.o \ - fbpseudocolor.o + $(NULL) INCLUDES = -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) \ - -I$(FONTINCSRC) -I$(XF86SRC)/common $(EXTRAINCLUDES) \ - -I$(SERVERSRC)/render -I$(EXTINCSRC) -I$(SERVERSRC)/Xext + -I$(XF86SRC)/common $(EXTRAINCLUDES) \ + -I$(SERVERSRC)/render -I$(EXTINCSRC) -I$(SERVERSRC)/Xext \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln $(SERVERSRC)/os/llib-los.ln \ $(SERVERSRC)/mi/llib-lmi.ln -#ifdef IHaveModules -ModuleObjectRule() -LibraryModuleTarget(fb,$(OBJS)) -#else NormalLibraryObjectRule() NormalLibraryTarget(fb,$(OBJS)) -#endif LintLibraryTarget(fb,$(SRCS)) NormalLintTarget($(SRCS)) -#ifdef IHaveModules -InstallLibraryModule(fb,$(MODULEDIR),.) -#endif DependTarget() @@ -150,6 +119,8 @@ MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif +SpecialCObjectRule(fboverlay,$(ICONFIGFILES),$(SHM_DEFINES)) + #ifdef LinkDirectory LinkSourceFile(fb24_32.c,LinkDirectory) LinkSourceFile(fballpriv.c,LinkDirectory) @@ -186,7 +157,6 @@ LinkSourceFile(fbtile.c,LinkDirectory) LinkSourceFile(fbtrap.c,LinkDirectory) LinkSourceFile(fbutil.c,LinkDirectory) LinkSourceFile(fbwindow.c,LinkDirectory) -LinkSourceFile(fbmmx.c,LinkDirectory) #endif InstallDriverSDKLibraryModule(fb,$(DRIVERSDKMODULEDIR),.) diff --git a/nx-X11/programs/Xserver/fb/Imakefile.NX.original b/nx-X11/programs/Xserver/fb/Imakefile.NX.original deleted file mode 100644 index cb560e7a0..000000000 --- a/nx-X11/programs/Xserver/fb/Imakefile.NX.original +++ /dev/null @@ -1,194 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/fb/Imakefile,v 1.16 2002/05/31 16:12:17 dawes Exp $ -XCOMM -XCOMM -XCOMM Id: Imakefile,v 1.1 1999/11/02 03:54:44 keithp Exp $ - -/* - * The X.org 6.8.99.16 snapshot fails to compile with GCC 4. - * Temporarily disable the MMX features until the bug is - * fixed. - * -#if defined(HasGcc34) && HasGcc34 -MMXOPTIONS= -mmmx -msse -Winline --param inline-unit-growth=10000 \ - --param large-function-growth=10000 -DUSE_MMX -USEMMXOPTIONS= -DUSE_MMX -#if defined(i386Architecture) || defined(AMD64Architecture) -SpecialCObjectRule(fbmmx,fbmmx.c,$(MMXOPTIONS)) -SpecialCObjectRule(fbpict,fbpict.c,$(USEMMXOPTIONS)) -SpecialCObjectRule(fbfill,fbfill.c,$(USEMMXOPTIONS)) -SpecialCObjectRule(fbcopy,fbcopy.c,$(USEMMXOPTIONS)) -#endif - -#endif - */ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include <Server.tmpl> - -#ifdef FbNoPixelAddrCode -DEFINES=-DFBNOPIXADDR -DFBNO24BIT -#endif - -#if defined(IHaveModules) -XFMODSRC = fbmodule.c -XFMODOBJ = fbmodule.o -#endif - -#if BuildRender -RENDERSRC = fbcompose.c -RENDEROBJ = fbcompose.o -#endif - -SRCS = $(XFMODSRC) \ - fballpriv.c \ - fbbits.c \ - fbblt.c \ - fbbltone.c \ - fbbstore.c \ - fbcmap.c \ - $(RENDERSRC) \ - fbcopy.c \ - fbedge.c \ - fbfill.c \ - fbfillrect.c \ - fbfillsp.c \ - fbgc.c \ - fbgetsp.c \ - fbglyph.c \ - fbimage.c \ - fbline.c \ - fboverlay.c \ - fbpixmap.c \ - fbpoint.c \ - fbpush.c \ - fbscreen.c \ - fbseg.c \ - fbsetsp.c \ - fbsolid.c \ - fbstipple.c \ - fbtile.c \ - fbtrap.c \ - fbutil.c \ - fbwindow.c \ - fb24_32.c \ - fbpict.c \ - fbmmx.c \ - fbpseudocolor.c - -OBJS = $(XFMODOBJ) \ - fbarc.o \ - fballpriv.o \ - fbbits.o \ - fbblt.o \ - fbbltone.o \ - fbbstore.o \ - fbcmap.o \ - $(RENDEROBJ) \ - fbcopy.o \ - fbedge.o \ - fbfill.o \ - fbfillrect.o \ - fbfillsp.o \ - fbgc.o \ - fbgetsp.o \ - fbglyph.o \ - fbimage.o \ - fbline.o \ - fboverlay.o \ - fbpixmap.o \ - fbpoint.o \ - fbpush.o \ - fbscreen.o \ - fbseg.o \ - fbsetsp.o \ - fbsolid.o \ - fbstipple.o \ - fbtile.o \ - fbtrap.o \ - fbutil.o \ - fbwindow.o \ - fb24_32.o \ - fbpict.o \ - fbmmx.o \ - fbpseudocolor.o - - INCLUDES = -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) \ - -I$(FONTINCSRC) -I$(XF86SRC)/common $(EXTRAINCLUDES) \ - -I$(SERVERSRC)/render -I$(EXTINCSRC) -I$(SERVERSRC)/Xext - LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln $(SERVERSRC)/os/llib-los.ln \ - $(SERVERSRC)/mi/llib-lmi.ln - -#ifdef IHaveModules -ModuleObjectRule() -LibraryModuleTarget(fb,$(OBJS)) -#else -NormalLibraryObjectRule() -NormalLibraryTarget(fb,$(OBJS)) -#endif - -LintLibraryTarget(fb,$(SRCS)) - -NormalLintTarget($(SRCS)) - -#ifdef IHaveModules -InstallLibraryModule(fb,$(MODULEDIR),.) -#endif - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -#ifdef LinkDirectory -LinkSourceFile(fb24_32.c,LinkDirectory) -LinkSourceFile(fballpriv.c,LinkDirectory) -LinkSourceFile(fbarc.c,LinkDirectory) -LinkSourceFile(fbbits.c,LinkDirectory) -LinkSourceFile(fbblt.c,LinkDirectory) -LinkSourceFile(fbbltone.c,LinkDirectory) -LinkSourceFile(fbbstore.c,LinkDirectory) -LinkSourceFile(fbcmap.c,LinkDirectory) -#if BuildRender -LinkSourceFile(fbcompose.c,LinkDirectory) -#endif -LinkSourceFile(fbcopy.c,LinkDirectory) -LinkSourceFile(fbfill.c,LinkDirectory) -LinkSourceFile(fbfillrect.c,LinkDirectory) -LinkSourceFile(fbfillsp.c,LinkDirectory) -LinkSourceFile(fbgc.c,LinkDirectory) -LinkSourceFile(fbgetsp.c,LinkDirectory) -LinkSourceFile(fbglyph.c,LinkDirectory) -LinkSourceFile(fbimage.c,LinkDirectory) -LinkSourceFile(fbline.c,LinkDirectory) -LinkSourceFile(fbmodule.c,LinkDirectory) -LinkSourceFile(fboverlay.c,LinkDirectory) -LinkSourceFile(fbpict.c,LinkDirectory) -LinkSourceFile(fbpixmap.c,LinkDirectory) -LinkSourceFile(fbpoint.c,LinkDirectory) -LinkSourceFile(fbpush.c,LinkDirectory) -LinkSourceFile(fbscreen.c,LinkDirectory) -LinkSourceFile(fbseg.c,LinkDirectory) -LinkSourceFile(fbsetsp.c,LinkDirectory) -LinkSourceFile(fbsolid.c,LinkDirectory) -LinkSourceFile(fbstipple.c,LinkDirectory) -LinkSourceFile(fbtile.c,LinkDirectory) -LinkSourceFile(fbtrap.c,LinkDirectory) -LinkSourceFile(fbutil.c,LinkDirectory) -LinkSourceFile(fbwindow.c,LinkDirectory) -LinkSourceFile(fbmmx.c,LinkDirectory) -#endif - -InstallDriverSDKLibraryModule(fb,$(DRIVERSDKMODULEDIR),.) -InstallDriverSDKNonExecFile(fb.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(fbrop.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/fb/Imakefile.X.original b/nx-X11/programs/Xserver/fb/Imakefile.X.original deleted file mode 100644 index df867016a..000000000 --- a/nx-X11/programs/Xserver/fb/Imakefile.X.original +++ /dev/null @@ -1,188 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/fb/Imakefile,v 1.16 2002/05/31 16:12:17 dawes Exp $ -XCOMM -XCOMM -XCOMM Id: Imakefile,v 1.1 1999/11/02 03:54:44 keithp Exp $ - -#if defined(HasGcc34) && HasGcc34 -MMXOPTIONS= -mmmx -msse -Winline --param inline-unit-growth=10000 \ - --param large-function-growth=10000 -DUSE_MMX -USEMMXOPTIONS= -DUSE_MMX -#if defined(i386Architecture) || defined(AMD64Architecture) -SpecialCObjectRule(fbmmx,fbmmx.c,$(MMXOPTIONS)) -SpecialCObjectRule(fbpict,fbpict.c,$(USEMMXOPTIONS)) -SpecialCObjectRule(fbfill,fbfill.c,$(USEMMXOPTIONS)) -SpecialCObjectRule(fbcopy,fbcopy.c,$(USEMMXOPTIONS)) -#endif - -#endif - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include <Server.tmpl> - -#ifdef FbNoPixelAddrCode -DEFINES=-DFBNOPIXADDR -DFBNO24BIT -#endif - -#if defined(IHaveModules) -XFMODSRC = fbmodule.c -XFMODOBJ = fbmodule.o -#endif - -#if BuildRender -RENDERSRC = fbcompose.c -RENDEROBJ = fbcompose.o -#endif - -SRCS = $(XFMODSRC) \ - fballpriv.c \ - fbbits.c \ - fbblt.c \ - fbbltone.c \ - fbbstore.c \ - fbcmap.c \ - $(RENDERSRC) \ - fbcopy.c \ - fbedge.c \ - fbfill.c \ - fbfillrect.c \ - fbfillsp.c \ - fbgc.c \ - fbgetsp.c \ - fbglyph.c \ - fbimage.c \ - fbline.c \ - fboverlay.c \ - fbpixmap.c \ - fbpoint.c \ - fbpush.c \ - fbscreen.c \ - fbseg.c \ - fbsetsp.c \ - fbsolid.c \ - fbstipple.c \ - fbtile.c \ - fbtrap.c \ - fbutil.c \ - fbwindow.c \ - fb24_32.c \ - fbpict.c \ - fbmmx.c \ - fbpseudocolor.c - -OBJS = $(XFMODOBJ) \ - fbarc.o \ - fballpriv.o \ - fbbits.o \ - fbblt.o \ - fbbltone.o \ - fbbstore.o \ - fbcmap.o \ - $(RENDEROBJ) \ - fbcopy.o \ - fbedge.o \ - fbfill.o \ - fbfillrect.o \ - fbfillsp.o \ - fbgc.o \ - fbgetsp.o \ - fbglyph.o \ - fbimage.o \ - fbline.o \ - fboverlay.o \ - fbpixmap.o \ - fbpoint.o \ - fbpush.o \ - fbscreen.o \ - fbseg.o \ - fbsetsp.o \ - fbsolid.o \ - fbstipple.o \ - fbtile.o \ - fbtrap.o \ - fbutil.o \ - fbwindow.o \ - fb24_32.o \ - fbpict.o \ - fbmmx.o \ - fbpseudocolor.o - - INCLUDES = -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) \ - -I$(FONTINCSRC) -I$(XF86SRC)/common $(EXTRAINCLUDES) \ - -I$(SERVERSRC)/render -I$(EXTINCSRC) -I$(SERVERSRC)/Xext - LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln $(SERVERSRC)/os/llib-los.ln \ - $(SERVERSRC)/mi/llib-lmi.ln - -#ifdef IHaveModules -ModuleObjectRule() -LibraryModuleTarget(fb,$(OBJS)) -#else -NormalLibraryObjectRule() -NormalLibraryTarget(fb,$(OBJS)) -#endif - -LintLibraryTarget(fb,$(SRCS)) - -NormalLintTarget($(SRCS)) - -#ifdef IHaveModules -InstallLibraryModule(fb,$(MODULEDIR),.) -#endif - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -#ifdef LinkDirectory -LinkSourceFile(fb24_32.c,LinkDirectory) -LinkSourceFile(fballpriv.c,LinkDirectory) -LinkSourceFile(fbarc.c,LinkDirectory) -LinkSourceFile(fbbits.c,LinkDirectory) -LinkSourceFile(fbblt.c,LinkDirectory) -LinkSourceFile(fbbltone.c,LinkDirectory) -LinkSourceFile(fbbstore.c,LinkDirectory) -LinkSourceFile(fbcmap.c,LinkDirectory) -#if BuildRender -LinkSourceFile(fbcompose.c,LinkDirectory) -#endif -LinkSourceFile(fbcopy.c,LinkDirectory) -LinkSourceFile(fbfill.c,LinkDirectory) -LinkSourceFile(fbfillrect.c,LinkDirectory) -LinkSourceFile(fbfillsp.c,LinkDirectory) -LinkSourceFile(fbgc.c,LinkDirectory) -LinkSourceFile(fbgetsp.c,LinkDirectory) -LinkSourceFile(fbglyph.c,LinkDirectory) -LinkSourceFile(fbimage.c,LinkDirectory) -LinkSourceFile(fbline.c,LinkDirectory) -LinkSourceFile(fbmodule.c,LinkDirectory) -LinkSourceFile(fboverlay.c,LinkDirectory) -LinkSourceFile(fbpict.c,LinkDirectory) -LinkSourceFile(fbpixmap.c,LinkDirectory) -LinkSourceFile(fbpoint.c,LinkDirectory) -LinkSourceFile(fbpush.c,LinkDirectory) -LinkSourceFile(fbscreen.c,LinkDirectory) -LinkSourceFile(fbseg.c,LinkDirectory) -LinkSourceFile(fbsetsp.c,LinkDirectory) -LinkSourceFile(fbsolid.c,LinkDirectory) -LinkSourceFile(fbstipple.c,LinkDirectory) -LinkSourceFile(fbtile.c,LinkDirectory) -LinkSourceFile(fbtrap.c,LinkDirectory) -LinkSourceFile(fbutil.c,LinkDirectory) -LinkSourceFile(fbwindow.c,LinkDirectory) -LinkSourceFile(fbmmx.c,LinkDirectory) -#endif - -InstallDriverSDKLibraryModule(fb,$(DRIVERSDKMODULEDIR),.) -InstallDriverSDKNonExecFile(fb.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(fbrop.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/fb/fb.h b/nx-X11/programs/Xserver/fb/fb.h index 3ee79d4af..61bf18caf 100644 --- a/nx-X11/programs/Xserver/fb/fb.h +++ b/nx-X11/programs/Xserver/fb/fb.h @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/fb/fb.h,v 1.36tsi Exp $ - * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -22,12 +20,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XdotOrg: xc/programs/Xserver/fb/fb.h,v 1.13 2005/10/02 08:28:26 anholt Exp $ */ #ifndef _FB_H_ #define _FB_H_ -#include <X11/X.h> +#include <nx-X11/X.h> #include "scrnintstr.h" #include "pixmap.h" #include "pixmapstr.h" @@ -67,9 +64,6 @@ #if GLYPHPADBYTES != 4 #error "GLYPHPADBYTES must be 4" #endif -#if GETLEFTBITS_ALIGNMENT != 1 -#error "GETLEFTBITS_ALIGNMENT must be 1" -#endif /* whether to bother to include 24bpp support */ #ifndef FBNO24BIT #define FB_24BIT @@ -108,8 +102,7 @@ typedef unsigned __int64 FbBits; defined(__sparc64__) || defined(_LP64) || \ defined(__s390x__) || \ defined(amd64) || defined (__amd64__) || \ - defined (__powerpc64__) || \ - (defined(sgi) && (_MIPS_SZLONG == 64)) + defined (__powerpc64__) typedef unsigned long FbBits; # else typedef unsigned long long FbBits; @@ -582,8 +575,7 @@ extern const GCFuncs fbGCFuncs; #endif #ifdef FB_OLD_SCREEN -# define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */ -extern WindowPtr *WindowTable; +# define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */ #endif #ifdef FB_24_32BIT @@ -703,8 +695,8 @@ typedef struct { */ #define fbWindowEnabled(pWin) \ - REGION_NOTEMPTY((pWin)->drawable.pScreen, \ - &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip) + RegionNotEmpty(\ + &(pWin)->drawable.pScreen->root->borderClip) #define fbDrawableEnabled(pDrawable) \ ((pDrawable)->type == DRAWABLE_PIXMAP ? \ @@ -795,7 +787,7 @@ fb24_32ModifyPixmapHeader (PixmapPtr pPixmap, int depth, int bitsPerPixel, int devKind, - pointer pPixData); + void *pPixData); /* * fballpriv.c @@ -1486,7 +1478,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable, int y, unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase); + void *pglyphBase); void fbImageGlyphBlt (DrawablePtr pDrawable, @@ -1495,7 +1487,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable, int y, unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase); + void *pglyphBase); /* * fbimage.c @@ -1602,10 +1594,11 @@ fbPictureInit (ScreenPtr pScreen, */ PixmapPtr -fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp); +fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, + unsigned usage_hint); PixmapPtr -fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth); +fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); Bool fbDestroyPixmap (PixmapPtr pPixmap); @@ -1709,7 +1702,7 @@ fbPushPixels (GCPtr pGC, */ Bool -fbCloseScreen (int indx, ScreenPtr pScreen); +fbCloseScreen (ScreenPtr pScreen); Bool fbRealizeFont(ScreenPtr pScreen, FontPtr pFont); @@ -1732,7 +1725,7 @@ _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap); Bool fbSetupScreen(ScreenPtr pScreen, - pointer pbits, /* pointer to screen bitmap */ + void *pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ int ysize, int dpix, /* dots per inch */ @@ -1742,7 +1735,7 @@ fbSetupScreen(ScreenPtr pScreen, Bool fbFinishScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, @@ -1752,7 +1745,7 @@ fbFinishScreenInit(ScreenPtr pScreen, Bool fbScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, diff --git a/nx-X11/programs/Xserver/fb/fb24_32.c b/nx-X11/programs/Xserver/fb/fb24_32.c index 214e2e6dd..7255b5021 100644 --- a/nx-X11/programs/Xserver/fb/fb24_32.c +++ b/nx-X11/programs/Xserver/fb/fb24_32.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/fb/fb24_32.c,v 1.4 2000/08/09 17:50:51 keithp Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -27,11 +25,7 @@ #include <dix-config.h> #endif -#ifdef XFree86LOADER -#include "xf86.h" -#include "xf86_ansic.h" -#endif - +#include <string.h> #include "fb.h" /* X apps don't like 24bpp images, this code exposes 32bpp images */ @@ -338,8 +332,8 @@ fb24_32SetSpans (DrawablePtr pDrawable, { d = dst + (ppt->y + dstYoff) * dstStride; s = (CARD8 *) src; - n = REGION_NUM_RECTS(pClip); - pbox = REGION_RECTS (pClip); + n = RegionNumRects(pClip); + pbox = RegionRects (pClip); while (n--) { if (pbox->y1 > ppt->y) @@ -400,8 +394,8 @@ fb24_32PutZImage (DrawablePtr pDrawable, dstStride *= sizeof(FbBits); dst = (CARD8 *) dstBits; - for (nbox = REGION_NUM_RECTS (pClip), - pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects (pClip), + pbox = RegionRects(pClip); nbox--; pbox++) { @@ -534,14 +528,14 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) FbStride oldStride, newStride; int oldBpp, newBpp; fb24_32BltFunc blt; - int oldXoff, oldYoff; - int newXoff, newYoff; + _X_UNUSED int oldXoff, oldYoff; + _X_UNUSED int newXoff, newYoff; pNewTile = fbCreatePixmapBpp (pScreen, pOldTile->drawable.width, pOldTile->drawable.height, pOldTile->drawable.depth, - bitsPerPixel); + bitsPerPixel, 0); if (!pNewTile) return 0; fbGetDrawable (&pOldTile->drawable, @@ -571,7 +565,7 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) } typedef struct { - pointer pbits; + void * pbits; int width; } miScreenInitParmsRec, *miScreenInitParmsPtr; @@ -603,7 +597,7 @@ fb24_32ModifyPixmapHeader (PixmapPtr pPixmap, int depth, int bitsPerPixel, int devKind, - pointer pPixData) + void *pPixData) { int bpp, w; diff --git a/nx-X11/programs/Xserver/fb/fb24_32.h b/nx-X11/programs/Xserver/fb/fb24_32.h deleted file mode 100644 index 3c83f3423..000000000 --- a/nx-X11/programs/Xserver/fb/fb24_32.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $XFree86$ - * - * Copyright © 2000 SuSE, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _FB24_32_H_ -#define _FB24_32_H_ - -Bool -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); - -#endif diff --git a/nx-X11/programs/Xserver/fb/fballpriv.c b/nx-X11/programs/Xserver/fb/fballpriv.c index 75b577049..d2d8866e2 100644 --- a/nx-X11/programs/Xserver/fb/fballpriv.c +++ b/nx-X11/programs/Xserver/fb/fballpriv.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fballpriv.c,v 1.3 2000/02/23 20:29:41 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -83,10 +82,10 @@ fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex) { FbScreenPrivPtr pScreenPriv; - pScreenPriv = (FbScreenPrivPtr) xalloc (sizeof (FbScreenPrivRec)); + pScreenPriv = (FbScreenPrivPtr) malloc (sizeof (FbScreenPrivRec)); if (!pScreenPriv) return FALSE; - pScreen->devPrivates[fbScreenPrivateIndex].ptr = (pointer) pScreenPriv; + pScreen->devPrivates[fbScreenPrivateIndex].ptr = (void *) pScreenPriv; } #endif return TRUE; diff --git a/nx-X11/programs/Xserver/fb/fbarc.c b/nx-X11/programs/Xserver/fb/fbarc.c index 315aa181c..ae89e44d8 100644 --- a/nx-X11/programs/Xserver/fb/fbarc.c +++ b/nx-X11/programs/Xserver/fb/fbarc.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbarc.c,v 1.7tsi Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -29,9 +28,7 @@ #include "fb.h" #include "mizerarc.h" -#ifdef IN_MODULE -#include "xf86_ansic.h" -#endif +#include <limits.h> typedef void (*FbArc) (FbBits *dst, FbStride dstStride, @@ -100,8 +97,8 @@ fbPolyArc (DrawablePtr pDrawable, box.x2 = x2; y2 = box.y1 + (int)parcs->height + 1; box.y2 = y2; - if ( (x2 <= MAXSHORT) && (y2 <= MAXSHORT) && - (RECT_IN_REGION(pDrawable->pScreen, cclip, &box) == rgnIN) ) + if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && + (RegionContainsRect(cclip, &box) == rgnIN) ) (*arc) (dst, dstStride, dstBpp, parcs, pDrawable->x + dstXoff, pDrawable->y + dstYoff, pPriv->and, pPriv->xor); diff --git a/nx-X11/programs/Xserver/fb/fbbits.c b/nx-X11/programs/Xserver/fb/fbbits.c index ab67b4cf3..56b58df4e 100644 --- a/nx-X11/programs/Xserver/fb/fbbits.c +++ b/nx-X11/programs/Xserver/fb/fbbits.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbbits.c,v 1.5 2000/02/17 14:16:22 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/fb/fbbits.h b/nx-X11/programs/Xserver/fb/fbbits.h index 7dfff58b4..30fa21f1e 100644 --- a/nx-X11/programs/Xserver/fb/fbbits.h +++ b/nx-X11/programs/Xserver/fb/fbbits.h @@ -1,6 +1,4 @@ /* - * $XFree86$ - * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -668,7 +666,7 @@ POLYLINE (DrawablePtr pDrawable, int xoff = pDrawable->x; int yoff = pDrawable->y; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - BoxPtr pBox = REGION_EXTENTS (pDrawable->pScreen, fbGetCompositeClip (pGC)); + BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC)); FbBits *dst; int dstStride; @@ -800,7 +798,7 @@ POLYSEGMENT (DrawablePtr pDrawable, int xoff = pDrawable->x; int yoff = pDrawable->y; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - BoxPtr pBox = REGION_EXTENTS (pDrawable->pScreen, fbGetCompositeClip (pGC)); + BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC)); FbBits *dst; int dstStride; @@ -829,8 +827,6 @@ POLYSEGMENT (DrawablePtr pDrawable, ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff); lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1); - bits += bitsStride * yoff + xoff * MUL; - capNotLast = pGC->capStyle == CapNotLast; while (nseg--) diff --git a/nx-X11/programs/Xserver/fb/fbblt.c b/nx-X11/programs/Xserver/fb/fbblt.c index c2617a718..085a8e639 100644 --- a/nx-X11/programs/Xserver/fb/fbblt.c +++ b/nx-X11/programs/Xserver/fb/fbblt.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbblt.c,v 1.7 2000/09/22 05:58:01 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/fb/fbbltone.c b/nx-X11/programs/Xserver/fb/fbbltone.c index b271318d1..f06357a37 100644 --- a/nx-X11/programs/Xserver/fb/fbbltone.c +++ b/nx-X11/programs/Xserver/fb/fbbltone.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbbltone.c,v 1.11 2001/09/07 15:15:31 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/fb/fbbstore.c b/nx-X11/programs/Xserver/fb/fbbstore.c index 01ec9b7e0..75f6084c0 100644 --- a/nx-X11/programs/Xserver/fb/fbbstore.c +++ b/nx-X11/programs/Xserver/fb/fbbstore.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbbstore.c,v 1.1 1999/11/19 13:53:42 hohndel Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -39,8 +38,8 @@ fbSaveAreas(PixmapPtr pPixmap, fbCopyWindowProc (&pWin->drawable, &pPixmap->drawable, 0, - REGION_RECTS(prgnSave), - REGION_NUM_RECTS(prgnSave), + RegionRects(prgnSave), + RegionNumRects(prgnSave), xorg, yorg, FALSE, FALSE, @@ -57,8 +56,8 @@ fbRestoreAreas(PixmapPtr pPixmap, fbCopyWindowProc (&pPixmap->drawable, &pWin->drawable, 0, - REGION_RECTS(prgnRestore), - REGION_NUM_RECTS(prgnRestore), + RegionRects(prgnRestore), + RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, diff --git a/nx-X11/programs/Xserver/fb/fbcmap.c b/nx-X11/programs/Xserver/fb/fbcmap.c index 762c51c9d..ec8ddff4f 100644 --- a/nx-X11/programs/Xserver/fb/fbcmap.c +++ b/nx-X11/programs/Xserver/fb/fbcmap.c @@ -1,5 +1,4 @@ /* $XConsortium: fbcmap.c,v 4.19 94/04/17 20:28:46 dpw Exp $ */ -/* $XFree86: xc/programs/Xserver/fb/fbcmap.c,v 1.5 2000/09/20 00:09:13 keithp Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -34,8 +33,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <dix-config.h> #endif -#include <X11/X.h> -#include <X11/Xproto.h> +#include <nx-X11/X.h> +#include <nx-X11/Xproto.h> #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" @@ -390,7 +389,7 @@ fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB, { fbVisualsPtr new, *prev, v; - new = (fbVisualsPtr) xalloc (sizeof *new); + new = (fbVisualsPtr) malloc (sizeof *new); if (!new) return FALSE; if (!redMask || !greenMask || !blueMask) @@ -487,12 +486,12 @@ fbInitVisuals (VisualPtr *visualp, ndepth++; nvisual += visuals->count; } - depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec)); - visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec)); + depth = (DepthPtr) malloc (ndepth * sizeof (DepthRec)); + visual = (VisualPtr) malloc (nvisual * sizeof (VisualRec)); if (!depth || !visual) { - xfree (depth); - xfree (visual); + free (depth); + free (visual); return FALSE; } *depthp = depth; @@ -508,7 +507,7 @@ fbInitVisuals (VisualPtr *visualp, vid = NULL; if (nvtype) { - vid = (VisualID *) xalloc (nvtype * sizeof (VisualID)); + vid = (VisualID *) malloc (nvtype * sizeof (VisualID)); if (!vid) return FALSE; } @@ -549,7 +548,7 @@ fbInitVisuals (VisualPtr *visualp, vid++; visual++; } - xfree (visuals); + free (visuals); } fbVisuals = NULL; visual = *visualp; diff --git a/nx-X11/programs/Xserver/fb/fbcompose.c b/nx-X11/programs/Xserver/fb/fbcompose.c index f8169995f..3f4e6ec20 100644 --- a/nx-X11/programs/Xserver/fb/fbcompose.c +++ b/nx-X11/programs/Xserver/fb/fbcompose.c @@ -1,7 +1,4 @@ /* - * $XdotOrg: xc/programs/Xserver/fb/fbcompose.c,v 1.26 2005/12/09 18:35:20 ajax Exp $ - * $XFree86: xc/programs/Xserver/fb/fbcompose.c,v 1.17tsi Exp $ - * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * 2005 Lars Knoll & Zack Rusin, Trolltech * @@ -33,10 +30,14 @@ #ifdef RENDER +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <assert.h> + #include "picturestr.h" #include "mipict.h" #include "fbpict.h" -#include <math.h> #define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) @@ -2896,7 +2897,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 if (pict->filter == PictFilterNearest) { if (pict->repeatType == RepeatNormal) { - if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { + if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { @@ -2927,7 +2928,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 y = MOD(v.vector[1]>>16, pict->pDrawable->height); x = MOD(v.vector[0]>>16, pict->pDrawable->width); } - if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box)) + if (RegionContainsPoint(pict->pCompositeClip, x, y, &box)) buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed); else buffer[i] = 0; @@ -2938,7 +2939,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 } } } else { - if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { + if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { @@ -2970,7 +2971,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 y = v.vector[1]>>16; x = v.vector[0]>>16; } - if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box)) + if (RegionContainsPoint(pict->pCompositeClip, x, y, &box)) buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed); else buffer[i] = 0; @@ -2983,7 +2984,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 } } else if (pict->filter == PictFilterBilinear) { if (pict->repeatType == RepeatNormal) { - if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { + if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { @@ -3082,14 +3083,14 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 b = bits + (y1 + pict->pDrawable->y)*stride; - tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box) + tl = RegionContainsPoint(pict->pCompositeClip, x1, y1, &box) ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0; - tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box) + tr = RegionContainsPoint(pict->pCompositeClip, x2, y1, &box) ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0; b = bits + (y2 + pict->pDrawable->y)*stride; - bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box) + bl = RegionContainsPoint(pict->pCompositeClip, x1, y2, &box) ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0; - br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box) + br = RegionContainsPoint(pict->pCompositeClip, x2, y2, &box) ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; @@ -3112,7 +3113,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 } } } else { - if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { + if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { @@ -3209,14 +3210,14 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 b = bits + (y1 + pict->pDrawable->y)*stride; x_off = x1 + pict->pDrawable->x; - tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box) + tl = RegionContainsPoint(pict->pCompositeClip, x1, y1, &box) ? fetch(b, x_off, indexed) : 0; - tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box) + tr = RegionContainsPoint(pict->pCompositeClip, x2, y1, &box) ? fetch(b, x_off + 1, indexed) : 0; b += stride; - bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box) + bl = RegionContainsPoint(pict->pCompositeClip, x1, y2, &box) ? fetch(b, x_off, indexed) : 0; - br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box) + br = RegionContainsPoint(pict->pCompositeClip, x2, y2, &box) ? fetch(b, x_off + 1, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; @@ -3274,7 +3275,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 for (x = x1; x < x2; x++) { if (*p) { int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x; - if (POINT_IN_REGION (0, pict->pCompositeClip, tx, ty, &box)) { + if (RegionContainsPoint(pict->pCompositeClip, tx, ty, &box)) { FbBits *b = bits + (ty + pict->pDrawable->y)*stride; CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed); @@ -3563,8 +3564,8 @@ fbCompositeGeneral (CARD8 op, if (width > SCANLINE_BUFFER_LENGTH) scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - n = REGION_NUM_RECTS (®ion); - pbox = REGION_RECTS (®ion); + n = RegionNumRects (®ion); + pbox = RegionRects (®ion); while (n--) { h = pbox->y2 - pbox->y1; @@ -3618,7 +3619,7 @@ fbCompositeGeneral (CARD8 op, } pbox++; } - REGION_UNINIT (pDst->pDrawable->pScreen, ®ion); + RegionUninit(®ion); if (scanline_buffer != _scanline_buffer) free(scanline_buffer); diff --git a/nx-X11/programs/Xserver/fb/fbcopy.c b/nx-X11/programs/Xserver/fb/fbcopy.c index 1e7b93435..7a1dbb5aa 100644 --- a/nx-X11/programs/Xserver/fb/fbcopy.c +++ b/nx-X11/programs/Xserver/fb/fbcopy.c @@ -21,17 +21,14 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbcopy.c,v 1.13 2003/11/10 18:21:47 tsi Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <stdlib.h> + #include "fb.h" -#ifdef IN_MODULE -#include "xf86_ansic.h" -#endif -#include "fbmmx.h" void fbCopyNtoN (DrawablePtr pSrcDrawable, @@ -62,27 +59,6 @@ fbCopyNtoN (DrawablePtr pSrcDrawable, while (nbox--) { -#ifdef USE_MMX - if (pm == FB_ALLONES && alu == GXcopy && !reverse && - !upsidedown && fbHaveMMX()) - { - if (!fbCopyAreammx (pSrcDrawable, - pDstDrawable, - - (pbox->x1 + dx), - (pbox->y1 + dy), - - (pbox->x1), - (pbox->y1), - - (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, @@ -100,9 +76,6 @@ fbCopyNtoN (DrawablePtr pSrcDrawable, reverse, upsidedown); -#ifdef USE_MMX - next: -#endif pbox++; } } @@ -244,7 +217,7 @@ fbCopyNto1 (DrawablePtr pSrcDrawable, height = pbox->y2 - pbox->y1; tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT); - tmp = xalloc (tmpStride * height * sizeof (FbStip)); + tmp = malloc (tmpStride * height * sizeof (FbStip)); if (!tmp) return; @@ -282,7 +255,7 @@ fbCopyNto1 (DrawablePtr pSrcDrawable, pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor); - xfree (tmp); + free (tmp); } pbox++; } @@ -306,8 +279,8 @@ fbCopyRegion (DrawablePtr pSrcDrawable, int nbox; BoxPtr pboxNew1, pboxNew2, pboxBase, pboxNext, pboxTmp; - pbox = REGION_RECTS(pDstRegion); - nbox = REGION_NUM_RECTS(pDstRegion); + pbox = RegionRects(pDstRegion); + nbox = RegionNumRects(pDstRegion); /* XXX we have to err on the side of safety when both are windows, * because we don't know if IncludeInferiors is being used. @@ -325,7 +298,7 @@ fbCopyRegion (DrawablePtr pSrcDrawable, if (nbox > 1) { /* keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); if(!pboxNew1) return; pboxBase = pboxNext = pbox+nbox-1; @@ -362,11 +335,11 @@ fbCopyRegion (DrawablePtr pSrcDrawable, if (nbox > 1) { /* reverse order of rects in each band */ - pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); if(!pboxNew2) { if (pboxNew1) - DEALLOCATE_LOCAL(pboxNew1); + free(pboxNew1); return; } pboxBase = pboxNext = pbox; @@ -401,9 +374,9 @@ fbCopyRegion (DrawablePtr pSrcDrawable, reverse, upsidedown, bitPlane, closure); if (pboxNew1) - DEALLOCATE_LOCAL (pboxNew1); + free (pboxNew1); if (pboxNew2) - DEALLOCATE_LOCAL (pboxNew2); + free (pboxNew2); } RegionPtr @@ -466,7 +439,7 @@ fbDoCopy (DrawablePtr pSrcDrawable, * VT is inactive, make sure the region isn't empty */ if (!((WindowPtr) pSrcDrawable)->parent && - REGION_NOTEMPTY (pSrcDrawable->pScreen, + RegionNotEmpty( &((WindowPtr) pSrcDrawable)->borderClip)) { /* @@ -548,9 +521,9 @@ fbDoCopy (DrawablePtr pSrcDrawable, blown region and call intersect */ cclip = fbGetCompositeClip(pGC); - if (REGION_NUM_RECTS(cclip) == 1) + if (RegionNumRects(cclip) == 1) { - BoxPtr pBox = REGION_RECTS(cclip); + BoxPtr pBox = RegionRects(cclip); if (box_x1 < pBox->x1) box_x1 = pBox->x1; if (box_x2 > pBox->x2) box_x2 = pBox->x2; @@ -563,7 +536,7 @@ fbDoCopy (DrawablePtr pSrcDrawable, /* Check to see if the region is empty */ if (box_x1 >= box_x2 || box_y1 >= box_y2) { - REGION_NULL(pGC->pScreen, &rgnDst); + RegionNull(&rgnDst); } else { @@ -572,25 +545,25 @@ fbDoCopy (DrawablePtr pSrcDrawable, box.y1 = box_y1; box.x2 = box_x2; box.y2 = box_y2; - REGION_INIT(pGC->pScreen, &rgnDst, &box, 1); + RegionInit(&rgnDst, &box, 1); } /* Clip against complex source if needed */ if (!fastSrc) { - REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); - REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); + RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip); + RegionTranslate(&rgnDst, -dx, -dy); } /* Clip against complex dest if needed */ if (!fastDst) { - REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, + RegionIntersect(&rgnDst, &rgnDst, fbGetCompositeClip(pGC)); } /* Do bit blitting */ - numRects = REGION_NUM_RECTS(&rgnDst); + numRects = RegionNumRects(&rgnDst); if (numRects && widthSrc && heightSrc) fbCopyRegion (pSrcDrawable, pDstDrawable, pGC, &rgnDst, dx, dy, copyProc, bitPlane, closure); @@ -604,9 +577,9 @@ fbDoCopy (DrawablePtr pSrcDrawable, xOut - pDstDrawable->x, yOut - pDstDrawable->y, (unsigned long) bitPlane); - REGION_UNINIT(pGC->pScreen, &rgnDst); + RegionUninit(&rgnDst); if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); + RegionDestroy(prgnSrcClip); fbValidateDrawable (pDstDrawable); return prgnExposed; } diff --git a/nx-X11/programs/Xserver/fb/fbfill.c b/nx-X11/programs/Xserver/fb/fbfill.c index c61ff3b4c..2d1d163f6 100644 --- a/nx-X11/programs/Xserver/fb/fbfill.c +++ b/nx-X11/programs/Xserver/fb/fbfill.c @@ -21,14 +21,12 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbfill.c,v 1.5 2003/01/29 00:43:33 torrey Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #include "fb.h" -#include "fbmmx.h" void fbFill (DrawablePtr pDrawable, @@ -48,11 +46,6 @@ 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; -#endif fbSolid (dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, @@ -72,7 +65,7 @@ fbFill (DrawablePtr pDrawable, FbBits *stip; FbStride stipStride; int stipBpp; - int stipXoff, stipYoff; /* XXX assumed to be zero */ + _X_UNUSED int stipXoff, stipYoff; /* XXX assumed to be zero */ if (pGC->fillStyle == FillStippled) alu = FbStipple1Rop(pGC->alu,pGC->fgPixel); @@ -99,7 +92,7 @@ fbFill (DrawablePtr pDrawable, FbStip *stip; FbStride stipStride; int stipBpp; - int stipXoff, stipYoff; /* XXX assumed to be zero */ + _X_UNUSED int stipXoff, stipYoff; /* XXX assumed to be zero */ FbBits fgand, fgxor, bgand, bgxor; fgand = pPriv->and; @@ -140,7 +133,7 @@ fbFill (DrawablePtr pDrawable, int tileBpp; int tileWidth; int tileHeight; - int tileXoff, tileYoff; /* XXX assumed to be zero */ + _X_UNUSED int tileXoff, tileYoff; /* XXX assumed to be zero */ fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); tileWidth = pTile->drawable.width; @@ -184,7 +177,7 @@ fbSolidBoxClipped (DrawablePtr pDrawable, fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); - for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip); nbox--; pbox++) { diff --git a/nx-X11/programs/Xserver/fb/fbfillrect.c b/nx-X11/programs/Xserver/fb/fbfillrect.c index 2a60da165..2a19fa7d2 100644 --- a/nx-X11/programs/Xserver/fb/fbfillrect.c +++ b/nx-X11/programs/Xserver/fb/fbfillrect.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbfillrect.c,v 1.1 1999/11/19 13:53:43 hohndel Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -47,7 +46,7 @@ fbPolyFillRect(DrawablePtr pDrawable, xorg = pDrawable->x; yorg = pDrawable->y; - pextent = REGION_EXTENTS(pGC->pScreen, pClip); + pextent = RegionExtents(pClip); extentX1 = pextent->x1; extentY1 = pextent->y1; extentX2 = pextent->x2; @@ -74,7 +73,7 @@ fbPolyFillRect(DrawablePtr pDrawable, if ((fullX1 >= fullX2) || (fullY1 >= fullY2)) continue; - n = REGION_NUM_RECTS (pClip); + n = RegionNumRects (pClip); if (n == 1) { fbFill (pDrawable, @@ -83,7 +82,7 @@ fbPolyFillRect(DrawablePtr pDrawable, } else { - pbox = REGION_RECTS(pClip); + pbox = RegionRects(pClip); /* * clip the rectangle to each box in the clip region * this is logically equivalent to calling Intersect() diff --git a/nx-X11/programs/Xserver/fb/fbfillsp.c b/nx-X11/programs/Xserver/fb/fbfillsp.c index e2bb71e3a..ca9fdbb0a 100644 --- a/nx-X11/programs/Xserver/fb/fbfillsp.c +++ b/nx-X11/programs/Xserver/fb/fbfillsp.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbfillsp.c,v 1.1 1999/11/19 13:53:43 hohndel Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -44,7 +43,7 @@ fbFillSpans (DrawablePtr pDrawable, int fullX1, fullX2, fullY1; int partX1, partX2; - pextent = REGION_EXTENTS(pGC->pScreen, pClip); + pextent = RegionExtents(pClip); extentX1 = pextent->x1; extentY1 = pextent->y1; extentX2 = pextent->x2; @@ -69,7 +68,7 @@ fbFillSpans (DrawablePtr pDrawable, if (fullX1 >= fullX2) continue; - nbox = REGION_NUM_RECTS (pClip); + nbox = RegionNumRects (pClip); if (nbox == 1) { fbFill (pDrawable, @@ -78,7 +77,7 @@ fbFillSpans (DrawablePtr pDrawable, } else { - pbox = REGION_RECTS(pClip); + pbox = RegionRects(pClip); while(nbox--) { if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) diff --git a/nx-X11/programs/Xserver/fb/fbgc.c b/nx-X11/programs/Xserver/fb/fbgc.c index fdd7a319c..437bc5df3 100644 --- a/nx-X11/programs/Xserver/fb/fbgc.c +++ b/nx-X11/programs/Xserver/fb/fbgc.c @@ -21,17 +21,14 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XdotOrg: xc/programs/Xserver/fb/fbgc.c,v 1.5 2005/07/03 07:01:23 daniels Exp $ */ -/* $XFree86: xc/programs/Xserver/fb/fbgc.c,v 1.14 2003/12/18 15:22:32 alanh Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <stdlib.h> + #include "fb.h" -#ifdef IN_MODULE -#include "xf86_ansic.h" -#endif const GCFuncs fbGCFuncs = { fbValidateGC, @@ -170,7 +167,7 @@ fbCanEvenStipple (PixmapPtr pStipple, int bpp) FbBits *bits; int stride; int stip_bpp; - int stipXoff, stipYoff; + _X_UNUSED int stipXoff, stipYoff; int h; /* can't even stipple 24bpp drawables */ @@ -211,7 +208,7 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) ) { miComputeCompositeClip (pGC, pDrawable); - pPriv->oneRect = REGION_NUM_RECTS(fbGetCompositeClip(pGC)) == 1; + pPriv->oneRect = RegionNumRects(fbGetCompositeClip(pGC)) == 1; } #ifdef FB_24_32BIT diff --git a/nx-X11/programs/Xserver/fb/fbgetsp.c b/nx-X11/programs/Xserver/fb/fbgetsp.c index 7c58dcb82..f77ea8c52 100644 --- a/nx-X11/programs/Xserver/fb/fbgetsp.c +++ b/nx-X11/programs/Xserver/fb/fbgetsp.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbgetsp.c,v 1.5 2000/05/06 21:09:33 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/fb/fbglyph.c b/nx-X11/programs/Xserver/fb/fbglyph.c index 46334db50..6ff90e54a 100644 --- a/nx-X11/programs/Xserver/fb/fbglyph.c +++ b/nx-X11/programs/Xserver/fb/fbglyph.c @@ -1,7 +1,4 @@ /* - * $XdotOrg: xc/programs/Xserver/fb/fbglyph.c,v 1.5 2005/07/03 07:01:23 daniels Exp $ - * $XFree86: xc/programs/Xserver/fb/fbglyph.c,v 1.12tsi Exp $ - * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -41,7 +38,7 @@ fbGlyphIn (RegionPtr pRegion, int height) { BoxRec box; - BoxPtr pExtents = REGION_EXTENTS (dummyScreen, pRegion); + BoxPtr pExtents = RegionExtents(pRegion); /* * Check extents by hand to avoid 16 bit overflows @@ -58,7 +55,7 @@ fbGlyphIn (RegionPtr pRegion, box.x2 = x + width; box.y1 = y; box.y2 = y + height; - return RECT_IN_REGION (dummyScreen, pRegion, &box) == rgnIN; + return RegionContainsRect(pRegion, &box) == rgnIN; } #ifdef FB_24BIT @@ -262,7 +259,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable, int y, unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase) + void * pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); CharInfoPtr pci; @@ -350,7 +347,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable, int y, unsigned int nglyph, CharInfoPtr *ppciInit, - pointer pglyphBase) + void * pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); CharInfoPtr *ppci; diff --git a/nx-X11/programs/Xserver/fb/fbimage.c b/nx-X11/programs/Xserver/fb/fbimage.c index 96bd8cf95..9894faf02 100644 --- a/nx-X11/programs/Xserver/fb/fbimage.c +++ b/nx-X11/programs/Xserver/fb/fbimage.c @@ -21,18 +21,14 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbimage.c,v 1.7 2001/05/29 04:54:09 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif -#include "fb.h" -#ifdef XFree86LOADER -#include "xf86.h" -#include "xf86_ansic.h" -#endif +#include <string.h> +#include "fb.h" void fbPutImage (DrawablePtr pDrawable, @@ -140,8 +136,8 @@ fbPutZImage (DrawablePtr pDrawable, fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); - for (nbox = REGION_NUM_RECTS (pClip), - pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects (pClip), + pbox = RegionRects(pClip); nbox--; pbox++) { @@ -228,8 +224,8 @@ fbPutXYImage (DrawablePtr pDrawable, } } - for (nbox = REGION_NUM_RECTS (pClip), - pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects (pClip), + pbox = RegionRects(pClip); nbox--; pbox++) { diff --git a/nx-X11/programs/Xserver/fb/fbline.c b/nx-X11/programs/Xserver/fb/fbline.c index 8e99dd99f..fa80573e2 100644 --- a/nx-X11/programs/Xserver/fb/fbline.c +++ b/nx-X11/programs/Xserver/fb/fbline.c @@ -1,6 +1,4 @@ /* - * $XFree86$ - * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -119,7 +117,7 @@ fbPolyLine (DrawablePtr pDrawable, #ifndef FBNOPIXADDR if (pGC->fillStyle == FillSolid && pGC->lineStyle == LineSolid && - REGION_NUM_RECTS (fbGetCompositeClip(pGC)) == 1) + RegionNumRects (fbGetCompositeClip(pGC)) == 1) { switch (pDrawable->bitsPerPixel) { case 8: line = fbPolyline8; break; @@ -156,7 +154,7 @@ fbPolySegment (DrawablePtr pDrawable, #ifndef FBNOPIXADDR if (pGC->fillStyle == FillSolid && pGC->lineStyle == LineSolid && - REGION_NUM_RECTS (fbGetCompositeClip(pGC)) == 1) + RegionNumRects (fbGetCompositeClip(pGC)) == 1) { switch (pDrawable->bitsPerPixel) { case 8: seg = fbPolySegment8; break; diff --git a/nx-X11/programs/Xserver/fb/fbmmx.c b/nx-X11/programs/Xserver/fb/fbmmx.c deleted file mode 100644 index fef5c3820..000000000 --- a/nx-X11/programs/Xserver/fb/fbmmx.c +++ /dev/null @@ -1,2276 +0,0 @@ -/* - * Copyright © 2004, 2005 Red Hat, Inc. - * Copyright © 2004 Nicholas Miell - * 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) - * Minor Improvements: Nicholas Miell (nmiell@gmail.com) - * MMX code paths for fbcompose.c by 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__) -#define USE_SSE -#endif - -#include <mmintrin.h> -#include <xmmintrin.h> /* for _mm_shuffle_pi16 and _MM_SHUFFLE */ - -#ifdef RENDER - -#include "fb.h" -#include "fbmmx.h" - -#include "picturestr.h" -#include "mipict.h" -#include "fbpict.h" - -#define noVERBOSE - -#ifdef VERBOSE -#define CHECKPOINT() ErrorF ("at %s %d\n", __FUNCTION__, __LINE__) -#else -#define CHECKPOINT() -#endif - -/* Notes about writing mmx code - * - * give memory operands as the second operand. If you give it as the - * first, gcc will first load it into a register, then use that - * register - * - * ie. use - * - * _mm_mullo_pi16 (x, mmx_constant); - * - * not - * - * _mm_mullo_pi16 (mmx_constant, x); - * - * Also try to minimize dependencies. i.e. when you need a value, try - * to calculate it from a value that was calculated as early as - * possible. - */ - -/* --------------- MMX primitivess ------------------------------------ */ - -typedef unsigned long long ullong; - -typedef struct -{ - ullong mmx_4x00ff; - ullong mmx_4x0080; - ullong mmx_565_rgb; - ullong mmx_565_unpack_multiplier; - ullong mmx_565_r; - ullong mmx_565_g; - ullong mmx_565_b; - ullong mmx_mask_0; - ullong mmx_mask_1; - ullong mmx_mask_2; - ullong mmx_mask_3; - ullong mmx_full_alpha; - ullong mmx_ffff0000ffff0000; - ullong mmx_0000ffff00000000; - ullong mmx_000000000000ffff; -} MMXData; - -static const MMXData c = -{ - .mmx_4x00ff = 0x00ff00ff00ff00ffULL, - .mmx_4x0080 = 0x0080008000800080ULL, - .mmx_565_rgb = 0x000001f0003f001fULL, - .mmx_565_r = 0x000000f800000000ULL, - .mmx_565_g = 0x0000000000fc0000ULL, - .mmx_565_b = 0x00000000000000f8ULL, - .mmx_mask_0 = 0xffffffffffff0000ULL, - .mmx_mask_1 = 0xffffffff0000ffffULL, - .mmx_mask_2 = 0xffff0000ffffffffULL, - .mmx_mask_3 = 0x0000ffffffffffffULL, - .mmx_full_alpha = 0x00ff000000000000ULL, - .mmx_565_unpack_multiplier = 0x0000008404100840ULL, - .mmx_ffff0000ffff0000 = 0xffff0000ffff0000ULL, - .mmx_0000ffff00000000 = 0x0000ffff00000000ULL, - .mmx_000000000000ffff = 0x000000000000ffffULL, -}; - -#define MC(x) ((__m64) c.mmx_##x) - -static __inline__ __m64 -shift (__m64 v, int s) -{ - if (s > 0) - return _mm_slli_si64 (v, s); - else if (s < 0) - return _mm_srli_si64 (v, -s); - else - return v; -} - -static __inline__ __m64 -negate (__m64 mask) -{ - return _mm_xor_si64 (mask, MC(4x00ff)); -} - -static __inline__ __m64 -pix_multiply (__m64 a, __m64 b) -{ - __m64 res; - - res = _mm_mullo_pi16 (a, b); - res = _mm_adds_pu16 (res, MC(4x0080)); - res = _mm_adds_pu16 (res, _mm_srli_pi16 (res, 8)); - res = _mm_srli_pi16 (res, 8); - - return res; -} - -static __inline__ __m64 -pix_add (__m64 a, __m64 b) -{ - return _mm_adds_pu8 (a, b); -} - -#ifdef USE_SSE - -static __inline__ __m64 -expand_alpha (__m64 pixel) -{ - return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE(3, 3, 3, 3)); -} - -static __inline__ __m64 -expand_alpha_rev (__m64 pixel) -{ - return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE(0, 0, 0, 0)); -} - -static __inline__ __m64 -invert_colors (__m64 pixel) -{ - return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE(3, 0, 1, 2)); -} - -#else - -static __inline__ __m64 -expand_alpha (__m64 pixel) -{ - __m64 t1, t2; - - t1 = shift (pixel, -48); - t2 = shift (t1, 16); - t1 = _mm_or_si64 (t1, t2); - t2 = shift (t1, 32); - t1 = _mm_or_si64 (t1, t2); - - return t1; -} - -static __inline__ __m64 -expand_alpha_rev (__m64 pixel) -{ - __m64 t1, t2; - - /* move alpha to low 16 bits and zero the rest */ - t1 = shift (pixel, 48); - t1 = shift (t1, -48); - - t2 = shift (t1, 16); - t1 = _mm_or_si64 (t1, t2); - t2 = shift (t1, 32); - t1 = _mm_or_si64 (t1, t2); - - return t1; -} - -static __inline__ __m64 -invert_colors (__m64 pixel) -{ - __m64 x, y, z; - - x = y = z = pixel; - - x = _mm_and_si64 (x, MC(ffff0000ffff0000)); - y = _mm_and_si64 (y, MC(000000000000ffff)); - z = _mm_and_si64 (z, MC(0000ffff00000000)); - - y = shift (y, 32); - z = shift (z, -32); - - x = _mm_or_si64 (x, y); - x = _mm_or_si64 (x, z); - - return x; -} - -#endif - -static __inline__ __m64 -over (__m64 src, __m64 srca, __m64 dest) -{ - return _mm_adds_pu8 (src, pix_multiply(dest, negate(srca))); -} - -static __inline__ __m64 -over_rev_non_pre (__m64 src, __m64 dest) -{ - __m64 srca = expand_alpha (src); - __m64 srcfaaa = _mm_or_si64 (srca, MC(full_alpha)); - - return over(pix_multiply(invert_colors(src), srcfaaa), srca, dest); -} - -static __inline__ __m64 -in (__m64 src, - __m64 mask) -{ - return pix_multiply (src, mask); -} - -static __inline__ __m64 -in_over (__m64 src, - __m64 srca, - __m64 mask, - __m64 dest) -{ - return over(in(src, mask), pix_multiply(srca, mask), dest); -} - -static __inline__ __m64 -load8888 (CARD32 v) -{ - return _mm_unpacklo_pi8 (_mm_cvtsi32_si64 (v), _mm_setzero_si64()); -} - -static __inline__ __m64 -pack8888 (__m64 lo, __m64 hi) -{ - return _mm_packs_pu16 (lo, hi); -} - -static __inline__ CARD32 -store8888 (__m64 v) -{ - return _mm_cvtsi64_si32(pack8888(v, _mm_setzero_si64())); -} - -/* Expand 16 bits positioned at @pos (0-3) of a mmx register into - * - * 00RR00GG00BB - * - * --- Expanding 565 in the low word --- - * - * m = (m << (32 - 3)) | (m << (16 - 5)) | m; - * m = m & (01f0003f001f); - * m = m * (008404100840); - * m = m >> 8; - * - * Note the trick here - the top word is shifted by another nibble to - * avoid it bumping into the middle word - */ -static __inline__ __m64 -expand565 (__m64 pixel, int pos) -{ - __m64 p = pixel; - __m64 t1, t2; - - /* move pixel to low 16 bit and zero the rest */ - p = shift (shift (p, (3 - pos) * 16), -48); - - t1 = shift (p, 36 - 11); - t2 = shift (p, 16 - 5); - - p = _mm_or_si64 (t1, p); - p = _mm_or_si64 (t2, p); - p = _mm_and_si64 (p, MC(565_rgb)); - - pixel = _mm_mullo_pi16 (p, MC(565_unpack_multiplier)); - return _mm_srli_pi16 (pixel, 8); -} - -static __inline__ __m64 -expand8888 (__m64 in, int pos) -{ - if (pos == 0) - return _mm_unpacklo_pi8 (in, _mm_setzero_si64()); - else - return _mm_unpackhi_pi8 (in, _mm_setzero_si64()); -} - -static __inline__ __m64 -pack565 (__m64 pixel, __m64 target, int pos) -{ - __m64 p = pixel; - __m64 t = target; - __m64 r, g, b; - - r = _mm_and_si64 (p, MC(565_r)); - g = _mm_and_si64 (p, MC(565_g)); - b = _mm_and_si64 (p, MC(565_b)); - - r = shift (r, - (32 - 8) + pos * 16); - g = shift (g, - (16 - 3) + pos * 16); - b = shift (b, - (0 + 3) + pos * 16); - - if (pos == 0) - t = _mm_and_si64 (t, MC(mask_0)); - else if (pos == 1) - t = _mm_and_si64 (t, MC(mask_1)); - else if (pos == 2) - t = _mm_and_si64 (t, MC(mask_2)); - else if (pos == 3) - t = _mm_and_si64 (t, MC(mask_3)); - - p = _mm_or_si64 (r, t); - p = _mm_or_si64 (g, p); - - return _mm_or_si64 (b, p); -} - -static __inline__ __m64 -pix_add_mul (__m64 x, __m64 a, __m64 y, __m64 b) -{ - x = _mm_mullo_pi16 (x, a); - y = _mm_mullo_pi16 (y, b); - x = _mm_srli_pi16(x, 1); - y = _mm_srli_pi16(y, 1); - x = _mm_adds_pu16 (x, y); - x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8)); - x = _mm_adds_pu16 (x, MC(4x0080)); - x = _mm_srli_pi16 (x, 7); - - return x; -} - -/* --------------- MMX code patch for fbcompose.c --------------------- */ - -static FASTCALL void -mmxCombineMaskU (CARD32 *src, const CARD32 *mask, int width) -{ - const CARD32 *end = mask + width; - while (mask < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - a = expand_alpha(a); - s = pix_multiply(s, a); - *src = store8888(s); - ++src; - ++mask; - } - _mm_empty(); -} - - -static FASTCALL void -mmxCombineOverU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - - while (dest < end) { - __m64 s, sa; - s = load8888(*src); - sa = expand_alpha(s); - *dest = store8888(over(s, sa, load8888(*dest))); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineOverReverseU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - - while (dest < end) { - __m64 d, da; - d = load8888(*dest); - da = expand_alpha(d); - *dest = store8888(over (d, da, load8888(*src))); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineInU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - - while (dest < end) { - __m64 x, a; - x = load8888(*src); - a = load8888(*dest); - a = expand_alpha(a); - x = pix_multiply(x, a); - *dest = store8888(x); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineInReverseU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - - while (dest < end) { - __m64 x, a; - x = load8888(*dest); - a = load8888(*src); - a = expand_alpha(a); - x = pix_multiply(x, a); - *dest = store8888(x); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineOutU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - - while (dest < end) { - __m64 x, a; - x = load8888(*src); - a = load8888(*dest); - a = expand_alpha(a); - a = negate(a); - x = pix_multiply(x, a); - *dest = store8888(x); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineOutReverseU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - - while (dest < end) { - __m64 x, a; - x = load8888(*dest); - a = load8888(*src); - a = expand_alpha(a); - a = negate(a); - x = pix_multiply(x, a); - *dest = store8888(x); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineAtopU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - - while (dest < end) { - __m64 s, da, d, sia; - s = load8888(*src); - d = load8888(*dest); - sia = expand_alpha(s); - sia = negate(sia); - da = expand_alpha(d); - s = pix_add_mul (s, da, d, sia); - *dest = store8888(s); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineAtopReverseU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end; - - end = dest + width; - - while (dest < end) { - __m64 s, dia, d, sa; - s = load8888(*src); - d = load8888(*dest); - sa = expand_alpha(s); - dia = expand_alpha(d); - dia = negate(dia); - s = pix_add_mul (s, dia, d, sa); - *dest = store8888(s); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineXorU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - - while (dest < end) { - __m64 s, dia, d, sia; - s = load8888(*src); - d = load8888(*dest); - sia = expand_alpha(s); - dia = expand_alpha(d); - sia = negate(sia); - dia = negate(dia); - s = pix_add_mul (s, dia, d, sia); - *dest = store8888(s); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineAddU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - while (dest < end) { - __m64 s, d; - s = load8888(*src); - d = load8888(*dest); - s = pix_add(s, d); - *dest = store8888(s); - ++dest; - ++src; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineSaturateU (CARD32 *dest, const CARD32 *src, int width) -{ - const CARD32 *end = dest + width; - while (dest < end) { - CARD32 s = *src; - CARD32 d = *dest; - __m64 ms = load8888(s); - __m64 md = load8888(d); - CARD32 sa = s >> 24; - CARD32 da = ~d >> 24; - - if (sa > da) { - __m64 msa = load8888(FbIntDiv(da, sa)); - msa = expand_alpha(msa); - ms = pix_multiply(ms, msa); - } - md = pix_add(md, ms); - *dest = store8888(md); - ++src; - ++dest; - } - _mm_empty(); -} - - -static FASTCALL void -mmxCombineSrcC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - s = pix_multiply(s, a); - *dest = store8888(s); - ++src; - ++mask; - ++dest; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 sa = expand_alpha(s); - - *dest = store8888(in_over (s, sa, a, d)); - - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineOverReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 da = expand_alpha(d); - - *dest = store8888(over (d, da, in (s, a))); - - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - - -static FASTCALL void -mmxCombineInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 da = expand_alpha(d); - s = pix_multiply(s, a); - s = pix_multiply(s, da); - *dest = store8888(s); - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 sa = expand_alpha(s); - a = pix_multiply(a, sa); - d = pix_multiply(d, a); - *dest = store8888(d); - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 da = expand_alpha(d); - da = negate(da); - s = pix_multiply(s, a); - s = pix_multiply(s, da); - *dest = store8888(s); - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 sa = expand_alpha(s); - a = pix_multiply(a, sa); - a = negate(a); - d = pix_multiply(d, a); - *dest = store8888(d); - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 da = expand_alpha(d); - __m64 sa = expand_alpha(s); - s = pix_multiply(s, a); - a = pix_multiply(a, sa); - a = negate(a); - d = pix_add_mul (d, a, s, da); - *dest = store8888(d); - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineAtopReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 da = expand_alpha(d); - __m64 sa = expand_alpha(s); - s = pix_multiply(s, a); - a = pix_multiply(a, sa); - da = negate(da); - d = pix_add_mul (d, a, s, da); - *dest = store8888(d); - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - __m64 da = expand_alpha(d); - __m64 sa = expand_alpha(s); - s = pix_multiply(s, a); - a = pix_multiply(a, sa); - da = negate(da); - a = negate(a); - d = pix_add_mul (d, a, s, da); - *dest = store8888(d); - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -static FASTCALL void -mmxCombineAddC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) -{ - const CARD32 *end = src + width; - while (src < end) { - __m64 a = load8888(*mask); - __m64 s = load8888(*src); - __m64 d = load8888(*dest); - s = pix_multiply(s, a); - d = pix_add(s, d); - *dest = store8888(d); - ++src; - ++dest; - ++mask; - } - _mm_empty(); -} - -extern FbComposeFunctions composeFunctions; - -void fbComposeSetupMMX(void) -{ - /* check if we have MMX support and initialize accordingly */ - if (fbHaveMMX()) { - composeFunctions.combineU[PictOpOver] = mmxCombineOverU; - composeFunctions.combineU[PictOpOverReverse] = mmxCombineOverReverseU; - composeFunctions.combineU[PictOpIn] = mmxCombineInU; - composeFunctions.combineU[PictOpInReverse] = mmxCombineInReverseU; - composeFunctions.combineU[PictOpOut] = mmxCombineOutU; - composeFunctions.combineU[PictOpOutReverse] = mmxCombineOutReverseU; - composeFunctions.combineU[PictOpAtop] = mmxCombineAtopU; - composeFunctions.combineU[PictOpAtopReverse] = mmxCombineAtopReverseU; - composeFunctions.combineU[PictOpXor] = mmxCombineXorU; - composeFunctions.combineU[PictOpAdd] = mmxCombineAddU; - composeFunctions.combineU[PictOpSaturate] = mmxCombineSaturateU; - - composeFunctions.combineC[PictOpSrc] = mmxCombineSrcC; - composeFunctions.combineC[PictOpOver] = mmxCombineOverC; - composeFunctions.combineC[PictOpOverReverse] = mmxCombineOverReverseC; - composeFunctions.combineC[PictOpIn] = mmxCombineInC; - composeFunctions.combineC[PictOpInReverse] = mmxCombineInReverseC; - composeFunctions.combineC[PictOpOut] = mmxCombineOutC; - composeFunctions.combineC[PictOpOutReverse] = mmxCombineOutReverseC; - composeFunctions.combineC[PictOpAtop] = mmxCombineAtopC; - composeFunctions.combineC[PictOpAtopReverse] = mmxCombineAtopReverseC; - composeFunctions.combineC[PictOpXor] = mmxCombineXorC; - composeFunctions.combineC[PictOpAdd] = mmxCombineAddC; - - composeFunctions.combineMaskU = mmxCombineMaskU; - } -} - - -/* ------------------ MMX code paths called from fbpict.c ----------------------- */ - -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) -{ - CARD32 src; - CARD32 *dstLine, *dst; - CARD16 w; - FbStride dstStride; - __m64 vsrc, vsrca; - - CHECKPOINT(); - - fbComposeGetSolid(pSrc, src, pDst->format); - - if (src >> 24 == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - - vsrc = load8888 (src); - vsrca = expand_alpha (vsrc); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - w = width; - - CHECKPOINT(); - - while (w && (unsigned long)dst & 7) - { - *dst = store8888(over(vsrc, vsrca, load8888(*dst))); - - w--; - dst++; - } - - while (w >= 2) - { - __m64 vdest; - __m64 dest0, dest1; - - vdest = *(__m64 *)dst; - - dest0 = over(vsrc, vsrca, expand8888(vdest, 0)); - dest1 = over(vsrc, vsrca, expand8888(vdest, 1)); - - *(__m64 *)dst = pack8888(dest0, dest1); - - dst += 2; - w -= 2; - } - - CHECKPOINT(); - - while (w) - { - *dst = store8888(over(vsrc, vsrca, load8888(*dst))); - - w--; - dst++; - } - } - - _mm_empty(); -} - -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) -{ - CARD32 src; - CARD16 *dstLine, *dst; - CARD16 w; - FbStride dstStride; - __m64 vsrc, vsrca; - - CHECKPOINT(); - - fbComposeGetSolid(pSrc, src, pDst->format); - - if (src >> 24 == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - - vsrc = load8888 (src); - vsrca = expand_alpha (vsrc); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - w = width; - - CHECKPOINT(); - - while (w && (unsigned long)dst & 7) - { - ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); - vdest = pack565(over(vsrc, vsrca, vdest), vdest, 0); - *dst = (ullong)vdest; - - w--; - dst++; - } - - while (w >= 4) - { - __m64 vdest; - - vdest = *(__m64 *)dst; - - vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 0)), vdest, 0); - vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 1)), vdest, 1); - vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 2)), vdest, 2); - vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 3)), vdest, 3); - - *(__m64 *)dst = vdest; - - dst += 4; - w -= 4; - } - - CHECKPOINT(); - - while (w) - { - ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); - vdest = pack565(over(vsrc, vsrca, vdest), vdest, 0); - *dst = (ullong)vdest; - - w--; - dst++; - } - } - - _mm_empty(); -} - -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) -{ - CARD32 src, srca; - CARD32 *dstLine; - CARD32 *maskLine; - FbStride dstStride, maskStride; - __m64 vsrc, vsrca; - - CHECKPOINT(); - - fbComposeGetSolid(pSrc, src, pDst->format); - - srca = src >> 24; - if (srca == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); - - vsrc = load8888(src); - vsrca = expand_alpha(vsrc); - - while (height--) - { - int twidth = width; - CARD32 *p = (CARD32 *)maskLine; - CARD32 *q = (CARD32 *)dstLine; - - while (twidth && (unsigned long)q & 7) - { - CARD32 m = *(CARD32 *)p; - - if (m) - { - __m64 vdest = load8888(*q); - vdest = in_over(vsrc, vsrca, load8888(m), vdest); - *q = store8888(vdest); - } - - twidth--; - p++; - q++; - } - - while (twidth >= 2) - { - CARD32 m0, m1; - m0 = *p; - m1 = *(p + 1); - - if (m0 | m1) - { - __m64 dest0, dest1; - __m64 vdest = *(__m64 *)q; - - dest0 = in_over(vsrc, vsrca, load8888(m0), - expand8888 (vdest, 0)); - dest1 = in_over(vsrc, vsrca, load8888(m1), - expand8888 (vdest, 1)); - - *(__m64 *)q = pack8888(dest0, dest1); - } - - p += 2; - q += 2; - twidth -= 2; - } - - while (twidth) - { - CARD32 m = *(CARD32 *)p; - - if (m) - { - __m64 vdest = load8888(*q); - vdest = in_over(vsrc, vsrca, load8888(m), vdest); - *q = store8888(vdest); - } - - twidth--; - p++; - q++; - } - - dstLine += dstStride; - maskLine += maskStride; - } - - _mm_empty(); -} - -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) -{ - CARD32 *dstLine, *dst; - CARD32 *srcLine, *src; - CARD8 *maskLine; - CARD32 mask; - __m64 vmask; - FbStride dstStride, srcStride, maskStride; - CARD16 w; - __m64 srca; - - CHECKPOINT(); - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - - mask = *maskLine << 24 | *maskLine << 16 | *maskLine << 8 | *maskLine; - vmask = load8888 (mask); - srca = MC(4x00ff); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w && (unsigned long)dst & 7) - { - __m64 s = load8888 (*src); - __m64 d = load8888 (*dst); - - *dst = store8888 (in_over (s, srca, vmask, d)); - - w--; - dst++; - src++; - } - - while (w >= 16) - { - __m64 vd0 = *(__m64 *)(dst + 0); - __m64 vd1 = *(__m64 *)(dst + 2); - __m64 vd2 = *(__m64 *)(dst + 4); - __m64 vd3 = *(__m64 *)(dst + 6); - __m64 vd4 = *(__m64 *)(dst + 8); - __m64 vd5 = *(__m64 *)(dst + 10); - __m64 vd6 = *(__m64 *)(dst + 12); - __m64 vd7 = *(__m64 *)(dst + 14); - - __m64 vs0 = *(__m64 *)(src + 0); - __m64 vs1 = *(__m64 *)(src + 2); - __m64 vs2 = *(__m64 *)(src + 4); - __m64 vs3 = *(__m64 *)(src + 6); - __m64 vs4 = *(__m64 *)(src + 8); - __m64 vs5 = *(__m64 *)(src + 10); - __m64 vs6 = *(__m64 *)(src + 12); - __m64 vs7 = *(__m64 *)(src + 14); - - vd0 = (__m64)pack8888 ( - in_over (expand8888 (vs0, 0), srca, vmask, expand8888 (vd0, 0)), - in_over (expand8888 (vs0, 1), srca, vmask, expand8888 (vd0, 1))); - - vd1 = (__m64)pack8888 ( - in_over (expand8888 (vs1, 0), srca, vmask, expand8888 (vd1, 0)), - in_over (expand8888 (vs1, 1), srca, vmask, expand8888 (vd1, 1))); - - vd2 = (__m64)pack8888 ( - in_over (expand8888 (vs2, 0), srca, vmask, expand8888 (vd2, 0)), - in_over (expand8888 (vs2, 1), srca, vmask, expand8888 (vd2, 1))); - - vd3 = (__m64)pack8888 ( - in_over (expand8888 (vs3, 0), srca, vmask, expand8888 (vd3, 0)), - in_over (expand8888 (vs3, 1), srca, vmask, expand8888 (vd3, 1))); - - vd4 = (__m64)pack8888 ( - in_over (expand8888 (vs4, 0), srca, vmask, expand8888 (vd4, 0)), - in_over (expand8888 (vs4, 1), srca, vmask, expand8888 (vd4, 1))); - - vd5 = (__m64)pack8888 ( - in_over (expand8888 (vs5, 0), srca, vmask, expand8888 (vd5, 0)), - in_over (expand8888 (vs5, 1), srca, vmask, expand8888 (vd5, 1))); - - vd6 = (__m64)pack8888 ( - in_over (expand8888 (vs6, 0), srca, vmask, expand8888 (vd6, 0)), - in_over (expand8888 (vs6, 1), srca, vmask, expand8888 (vd6, 1))); - - vd7 = (__m64)pack8888 ( - in_over (expand8888 (vs7, 0), srca, vmask, expand8888 (vd7, 0)), - in_over (expand8888 (vs7, 1), srca, vmask, expand8888 (vd7, 1))); - - *(__m64 *)(dst + 0) = vd0; - *(__m64 *)(dst + 2) = vd1; - *(__m64 *)(dst + 4) = vd2; - *(__m64 *)(dst + 6) = vd3; - *(__m64 *)(dst + 8) = vd4; - *(__m64 *)(dst + 10) = vd5; - *(__m64 *)(dst + 12) = vd6; - *(__m64 *)(dst + 14) = vd7; - - w -= 16; - dst += 16; - src += 16; - } - - while (w) - { - __m64 s = load8888 (*src); - __m64 d = load8888 (*dst); - - *dst = store8888 (in_over (s, srca, vmask, d)); - - w--; - dst++; - src++; - } - } - - _mm_empty(); -} - -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) -{ - CARD32 *dstLine, *dst; - CARD32 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - __m64 srca; - - CHECKPOINT(); - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - - srca = MC (4x00ff); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w && (unsigned long)dst & 7) - { - __m64 s = load8888 (*src); - __m64 d = load8888 (*dst); - - *dst = store8888 (over (s, expand_alpha (s), d)); - - w--; - dst++; - src++; - } - - while (w >= 2) - { - __m64 vd = *(__m64 *)(dst + 0); - __m64 vs = *(__m64 *)(src + 0); - __m64 vs0 = expand8888 (vs, 0); - __m64 vs1 = expand8888 (vs, 1); - - *(__m64 *)dst = (__m64)pack8888 ( - over (vs0, expand_alpha (vs0), expand8888 (vd, 0)), - over (vs1, expand_alpha (vs1), expand8888 (vd, 1))); - - w -= 2; - dst += 2; - src += 2; - } - - while (w) - { - __m64 s = load8888 (*src); - __m64 d = load8888 (*dst); - - *dst = store8888 (over (s, expand_alpha (s), d)); - - w--; - dst++; - src++; - } - } - - _mm_empty(); -} - -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) -{ - CARD32 src, srca; - CARD32 *dstLine, *dst; - CARD8 *maskLine, *mask; - FbStride dstStride, maskStride; - CARD16 w; - __m64 vsrc, vsrca; - ullong srcsrc; - - CHECKPOINT(); - - fbComposeGetSolid(pSrc, src, pDst->format); - - srca = src >> 24; - if (srca == 0) - return; - - srcsrc = (unsigned long long)src << 32 | src; - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - - vsrc = load8888 (src); - vsrca = expand_alpha (vsrc); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - CHECKPOINT(); - - while (w && (unsigned long)dst & 7) - { - ullong m = *mask; - - if (m) - { - __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), load8888(*dst)); - *dst = store8888(vdest); - } - - w--; - mask++; - dst++; - } - - CHECKPOINT(); - - while (w >= 2) - { - ullong m0, m1; - m0 = *mask; - m1 = *(mask + 1); - - if (srca == 0xff && (m0 & m1) == 0xff) - { - *(unsigned long long *)dst = srcsrc; - } - else if (m0 | m1) - { - __m64 vdest; - __m64 dest0, dest1; - - vdest = *(__m64 *)dst; - - dest0 = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m0), expand8888(vdest, 0)); - dest1 = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m1), expand8888(vdest, 1)); - - *(__m64 *)dst = pack8888(dest0, dest1); - } - - mask += 2; - dst += 2; - w -= 2; - } - - CHECKPOINT(); - - while (w) - { - ullong m = *mask; - - if (m) - { - __m64 vdest = load8888(*dst); - vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), vdest); - *dst = store8888(vdest); - } - - w--; - mask++; - dst++; - } - } - - _mm_empty(); -} - - -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) -{ - CARD32 src, srca; - CARD16 *dstLine, *dst; - CARD8 *maskLine, *mask; - FbStride dstStride, maskStride; - CARD16 w; - __m64 vsrc, vsrca; - unsigned long long srcsrcsrcsrc, src16; - - CHECKPOINT(); - - fbComposeGetSolid(pSrc, src, pDst->format); - - srca = src >> 24; - if (srca == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - - vsrc = load8888 (src); - vsrca = expand_alpha (vsrc); - - src16 = (ullong)pack565(vsrc, _mm_setzero_si64(), 0); - - srcsrcsrcsrc = (ullong)src16 << 48 | (ullong)src16 << 32 | - (ullong)src16 << 16 | (ullong)src16; - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - CHECKPOINT(); - - while (w && (unsigned long)dst & 7) - { - ullong m = *mask; - - if (m) - { - ullong d = *dst; - __m64 vd = (__m64)d; - __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), expand565(vd, 0)); - *dst = (ullong)pack565(vdest, _mm_setzero_si64(), 0); - } - - w--; - mask++; - dst++; - } - - CHECKPOINT(); - - while (w >= 4) - { - ullong m0, m1, m2, m3; - m0 = *mask; - m1 = *(mask + 1); - m2 = *(mask + 2); - m3 = *(mask + 3); - - if (srca == 0xff && (m0 & m1 & m2 & m3) == 0xff) - { - *(unsigned long long *)dst = srcsrcsrcsrc; - } - else if (m0 | m1 | m2 | m3) - { - __m64 vdest; - __m64 vm0, vm1, vm2, vm3; - - vdest = *(__m64 *)dst; - - vm0 = (__m64)m0; - vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm0), expand565(vdest, 0)), vdest, 0); - vm1 = (__m64)m1; - vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm1), expand565(vdest, 1)), vdest, 1); - vm2 = (__m64)m2; - vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm2), expand565(vdest, 2)), vdest, 2); - vm3 = (__m64)m3; - vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm3), expand565(vdest, 3)), vdest, 3); - - *(__m64 *)dst = vdest; - } - - w -= 4; - mask += 4; - dst += 4; - } - - CHECKPOINT(); - - while (w) - { - ullong m = *mask; - - if (m) - { - ullong d = *dst; - __m64 vd = (__m64)d; - __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), expand565(vd, 0)); - *dst = (ullong)pack565(vdest, _mm_setzero_si64(), 0); - } - - w--; - mask++; - dst++; - } - } - - _mm_empty(); -} - -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) -{ - CARD16 *dstLine, *dst; - CARD32 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - - CHECKPOINT(); - - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - - assert (pSrc->pDrawable == pMask->pDrawable); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - CHECKPOINT(); - - while (w && (unsigned long)dst & 7) - { - __m64 vsrc = load8888 (*src); - ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); - - vdest = pack565(over_rev_non_pre(vsrc, vdest), vdest, 0); - - *dst = (ullong)vdest; - - w--; - dst++; - src++; - } - - CHECKPOINT(); - - while (w >= 4) - { - CARD32 s0, s1, s2, s3; - unsigned char a0, a1, a2, a3; - - s0 = *src; - s1 = *(src + 1); - s2 = *(src + 2); - s3 = *(src + 3); - - a0 = (s0 >> 24); - a1 = (s1 >> 24); - a2 = (s2 >> 24); - a3 = (s3 >> 24); - - if ((a0 & a1 & a2 & a3) == 0xFF) - { - __m64 vdest; - vdest = pack565(invert_colors(load8888(s0)), _mm_setzero_si64(), 0); - vdest = pack565(invert_colors(load8888(s1)), vdest, 1); - vdest = pack565(invert_colors(load8888(s2)), vdest, 2); - vdest = pack565(invert_colors(load8888(s3)), vdest, 3); - - *(__m64 *)dst = vdest; - } - else if (a0 | a1 | a2 | a3) - { - __m64 vdest = *(__m64 *)dst; - - vdest = pack565(over_rev_non_pre(load8888(s0), expand565(vdest, 0)), vdest, 0); - vdest = pack565(over_rev_non_pre(load8888(s1), expand565(vdest, 1)), vdest, 1); - vdest = pack565(over_rev_non_pre(load8888(s2), expand565(vdest, 2)), vdest, 2); - vdest = pack565(over_rev_non_pre(load8888(s3), expand565(vdest, 3)), vdest, 3); - - *(__m64 *)dst = vdest; - } - - w -= 4; - dst += 4; - src += 4; - } - - CHECKPOINT(); - - while (w) - { - __m64 vsrc = load8888 (*src); - ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); - - vdest = pack565(over_rev_non_pre(vsrc, vdest), vdest, 0); - - *dst = (ullong)vdest; - - w--; - dst++; - src++; - } - } - - _mm_empty(); -} - -/* "8888RevNP" is GdkPixbuf's format: ABGR, non premultiplied */ - -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) -{ - CARD32 *dstLine, *dst; - CARD32 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - - CHECKPOINT(); - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - - assert (pSrc->pDrawable == pMask->pDrawable); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w && (unsigned long)dst & 7) - { - __m64 s = load8888 (*src); - __m64 d = load8888 (*dst); - - *dst = store8888 (over_rev_non_pre (s, d)); - - w--; - dst++; - src++; - } - - while (w >= 2) - { - ullong s0, s1; - unsigned char a0, a1; - __m64 d0, d1; - - s0 = *src; - s1 = *(src + 1); - - a0 = (s0 >> 24); - a1 = (s1 >> 24); - - if ((a0 & a1) == 0xFF) - { - d0 = invert_colors(load8888(s0)); - d1 = invert_colors(load8888(s1)); - - *(__m64 *)dst = pack8888 (d0, d1); - } - else if (a0 | a1) - { - __m64 vdest = *(__m64 *)dst; - - d0 = over_rev_non_pre (load8888(s0), expand8888 (vdest, 0)); - d1 = over_rev_non_pre (load8888(s1), expand8888 (vdest, 1)); - - *(__m64 *)dst = pack8888 (d0, d1); - } - - w -= 2; - dst += 2; - src += 2; - } - - while (w) - { - __m64 s = load8888 (*src); - __m64 d = load8888 (*dst); - - *dst = store8888 (over_rev_non_pre (s, d)); - - w--; - dst++; - src++; - } - } - - _mm_empty(); -} - -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) -{ - CARD32 src, srca; - CARD16 *dstLine; - CARD32 *maskLine; - FbStride dstStride, maskStride; - __m64 vsrc, vsrca; - - CHECKPOINT(); - - fbComposeGetSolid(pSrc, src, pDst->format); - - srca = src >> 24; - if (srca == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); - - vsrc = load8888 (src); - vsrca = expand_alpha (vsrc); - - while (height--) - { - int twidth = width; - CARD32 *p = (CARD32 *)maskLine; - CARD16 *q = (CARD16 *)dstLine; - - while (twidth && ((unsigned long)q & 7)) - { - CARD32 m = *(CARD32 *)p; - - if (m) - { - ullong d = *q; - __m64 vdest = expand565 ((__m64)d, 0); - vdest = pack565 (in_over (vsrc, vsrca, load8888 (m), vdest), vdest, 0); - *q = (ullong)vdest; - } - - twidth--; - p++; - q++; - } - - while (twidth >= 4) - { - CARD32 m0, m1, m2, m3; - - m0 = *p; - m1 = *(p + 1); - m2 = *(p + 2); - m3 = *(p + 3); - - if ((m0 | m1 | m2 | m3)) - { - __m64 vdest = *(__m64 *)q; - - vdest = pack565(in_over(vsrc, vsrca, load8888(m0), expand565(vdest, 0)), vdest, 0); - vdest = pack565(in_over(vsrc, vsrca, load8888(m1), expand565(vdest, 1)), vdest, 1); - vdest = pack565(in_over(vsrc, vsrca, load8888(m2), expand565(vdest, 2)), vdest, 2); - vdest = pack565(in_over(vsrc, vsrca, load8888(m3), expand565(vdest, 3)), vdest, 3); - - *(__m64 *)q = vdest; - } - twidth -= 4; - p += 4; - q += 4; - } - - while (twidth) - { - CARD32 m; - - m = *(CARD32 *)p; - if (m) - { - ullong d = *q; - __m64 vdest = expand565((__m64)d, 0); - vdest = pack565 (in_over(vsrc, vsrca, load8888(m), vdest), vdest, 0); - *q = (ullong)vdest; - } - - twidth--; - p++; - q++; - } - - maskLine += maskStride; - dstLine += dstStride; - } - - _mm_empty (); -} - -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) -{ - CARD8 *dstLine, *dst; - CARD8 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - CARD8 s, d; - CARD16 t; - - CHECKPOINT(); - - fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1); - fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w && (unsigned long)dst & 7) - { - s = *src; - d = *dst; - t = d + s; - s = t | (0 - (t >> 8)); - *dst = s; - - dst++; - src++; - w--; - } - - while (w >= 8) - { - *(__m64*)dst = _mm_adds_pu8(*(__m64*)src, *(__m64*)dst); - dst += 8; - src += 8; - w -= 8; - } - - while (w) - { - s = *src; - d = *dst; - t = d + s; - s = t | (0 - (t >> 8)); - *dst = s; - - dst++; - src++; - w--; - } - } - - _mm_empty(); -} - -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) -{ - CARD32 *dstLine, *dst; - CARD32 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - - CHECKPOINT(); - - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w && (unsigned long)dst & 7) - { - *dst = _mm_cvtsi64_si32(_mm_adds_pu8(_mm_cvtsi32_si64(*src), - _mm_cvtsi32_si64(*dst))); - dst++; - src++; - w--; - } - - while (w >= 2) - { - *(ullong*)dst = (ullong) _mm_adds_pu8(*(__m64*)src, *(__m64*)dst); - dst += 2; - src += 2; - w -= 2; - } - - if (w) - { - *dst = _mm_cvtsi64_si32(_mm_adds_pu8(_mm_cvtsi32_si64(*src), - _mm_cvtsi32_si64(*dst))); - - } - } - - _mm_empty(); -} - -Bool -fbSolidFillmmx (DrawablePtr pDraw, - int x, - int y, - int width, - int height, - FbBits xor) -{ - FbStride stride; - int bpp; - ullong fill; - __m64 vfill; - CARD32 byte_width; - CARD8 *byte_line; - FbBits *bits; - int xoff, yoff; - - CHECKPOINT(); - - fbGetDrawable(pDraw, bits, stride, bpp, xoff, yoff); - - if (bpp == 16 && (xor >> 16 != (xor & 0xffff))) - return FALSE; - - if (bpp != 16 && bpp != 32) - return FALSE; - - if (bpp == 16) - { - stride = stride * sizeof (FbBits) / 2; - byte_line = (CARD8 *)(((CARD16 *)bits) + stride * (y + yoff) + (x + xoff)); - byte_width = 2 * width; - stride *= 2; - } - else - { - stride = stride * sizeof (FbBits) / 4; - byte_line = (CARD8 *)(((CARD32 *)bits) + stride * (y + yoff) + (x + xoff)); - byte_width = 4 * width; - stride *= 4; - } - - fill = ((ullong)xor << 32) | xor; - vfill = (__m64)fill; - - while (height--) - { - int w; - CARD8 *d = byte_line; - byte_line += stride; - w = byte_width; - - while (w >= 2 && ((unsigned long)d & 3)) - { - *(CARD16 *)d = xor; - w -= 2; - d += 2; - } - - while (w >= 4 && ((unsigned long)d & 7)) - { - *(CARD32 *)d = xor; - - w -= 4; - d += 4; - } - - while (w >= 64) - { - *(__m64*) (d + 0) = vfill; - *(__m64*) (d + 8) = vfill; - *(__m64*) (d + 16) = vfill; - *(__m64*) (d + 24) = vfill; - *(__m64*) (d + 32) = vfill; - *(__m64*) (d + 40) = vfill; - *(__m64*) (d + 48) = vfill; - *(__m64*) (d + 56) = vfill; - - w -= 64; - d += 64; - } - while (w >= 4) - { - *(CARD32 *)d = xor; - - w -= 4; - d += 4; - } - if (w >= 2) - { - *(CARD16 *)d = xor; - w -= 2; - d += 2; - } - } - - _mm_empty(); - return TRUE; -} - -Bool -fbCopyAreammx (DrawablePtr pSrc, - DrawablePtr pDst, - int src_x, - int src_y, - int dst_x, - int dst_y, - int width, - int height) -{ - FbBits * src_bits; - FbStride src_stride; - int src_bpp; - int src_xoff; - int src_yoff; - - FbBits * dst_bits; - FbStride dst_stride; - int dst_bpp; - int dst_xoff; - int dst_yoff; - - CARD8 * src_bytes; - CARD8 * dst_bytes; - int byte_width; - - fbGetDrawable(pSrc, src_bits, src_stride, src_bpp, src_xoff, src_yoff); - fbGetDrawable(pDst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff); - - if (src_bpp != dst_bpp) - return FALSE; - - if (src_bpp == 16) - { - src_stride = src_stride * sizeof (FbBits) / 2; - dst_stride = dst_stride * sizeof (FbBits) / 2; - src_bytes = (CARD8 *)(((CARD16 *)src_bits) + src_stride * (src_y + src_yoff) + (src_x + src_xoff)); - dst_bytes = (CARD8 *)(((CARD16 *)dst_bits) + dst_stride * (dst_y + dst_yoff) + (dst_x + dst_xoff)); - byte_width = 2 * width; - src_stride *= 2; - dst_stride *= 2; - } else if (src_bpp == 32) { - src_stride = src_stride * sizeof (FbBits) / 4; - dst_stride = dst_stride * sizeof (FbBits) / 4; - src_bytes = (CARD8 *)(((CARD32 *)src_bits) + src_stride * (src_y + src_yoff) + (src_x + src_xoff)); - dst_bytes = (CARD8 *)(((CARD32 *)dst_bits) + dst_stride * (dst_y + dst_yoff) + (dst_x + dst_xoff)); - byte_width = 4 * width; - src_stride *= 4; - dst_stride *= 4; - } else { - return FALSE; - } - - while (height--) - { - int w; - CARD8 *s = src_bytes; - CARD8 *d = dst_bytes; - src_bytes += src_stride; - dst_bytes += dst_stride; - w = byte_width; - - while (w >= 2 && ((unsigned long)d & 3)) - { - *(CARD16 *)d = *(CARD16 *)s; - w -= 2; - s += 2; - d += 2; - } - - while (w >= 4 && ((unsigned long)d & 7)) - { - *(CARD32 *)d = *(CARD32 *)s; - - w -= 4; - s += 4; - d += 4; - } - - while (w >= 64) - { - *(__m64 *)(d + 0) = *(__m64 *)(s + 0); - *(__m64 *)(d + 8) = *(__m64 *)(s + 8); - *(__m64 *)(d + 16) = *(__m64 *)(s + 16); - *(__m64 *)(d + 24) = *(__m64 *)(s + 24); - *(__m64 *)(d + 32) = *(__m64 *)(s + 32); - *(__m64 *)(d + 40) = *(__m64 *)(s + 40); - *(__m64 *)(d + 48) = *(__m64 *)(s + 48); - *(__m64 *)(d + 56) = *(__m64 *)(s + 56); - w -= 64; - s += 64; - d += 64; - } - while (w >= 4) - { - *(CARD32 *)d = *(CARD32 *)s; - - w -= 4; - s += 4; - d += 4; - } - if (w >= 2) - { - *(CARD16 *)d = *(CARD16 *)s; - w -= 2; - s += 2; - d += 2; - } - } - - _mm_empty(); - return TRUE; -} - -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) -{ - fbCopyAreammx (pSrc->pDrawable, - pDst->pDrawable, - xSrc, ySrc, - xDst, yDst, - width, height); -} - - - - -#endif /* RENDER */ -#endif /* USE_MMX */ diff --git a/nx-X11/programs/Xserver/fb/fbmmx.h b/nx-X11/programs/Xserver/fb/fbmmx.h deleted file mode 100644 index 34718e3c0..000000000 --- a/nx-X11/programs/Xserver/fb/fbmmx.h +++ /dev/null @@ -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 */ diff --git a/nx-X11/programs/Xserver/fb/fbmodule.c b/nx-X11/programs/Xserver/fb/fbmodule.c deleted file mode 100644 index 80d99933a..000000000 --- a/nx-X11/programs/Xserver/fb/fbmodule.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ -/* $XFree86: xc/programs/Xserver/fb/fbmodule.c,v 1.3 2000/02/14 19:20:29 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#ifdef XFree86LOADER - -#include "xf86Module.h" -#include "fb.h" - -static XF86ModuleVersionInfo VersRec = -{ - "fb", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_ANSIC, /* Only need the ansic layer */ - ABI_ANSIC_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} /* signature, to be patched into the file by a tool */ -}; - -XF86ModuleData fbModuleData = { &VersRec, NULL, NULL }; - -#endif diff --git a/nx-X11/programs/Xserver/fb/fboverlay.c b/nx-X11/programs/Xserver/fb/fboverlay.c index 87524e27e..6e0bbf252 100644 --- a/nx-X11/programs/Xserver/fb/fboverlay.c +++ b/nx-X11/programs/Xserver/fb/fboverlay.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/fb/fboverlay.c,v 1.7 2003/11/10 18:21:47 tsi Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -23,15 +21,19 @@ * Author: Keith Packard, SuSE, Inc. */ -/* $XdotOrg: xc/programs/Xserver/fb/fboverlay.c,v 1.7 2005/07/03 07:01:23 daniels Exp $ */ - #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <stdlib.h> + #include "fb.h" #include "fboverlay.h" +#ifdef MITSHM +#include "shmint.h" +#endif + int fbOverlayGeneration; int fbOverlayScreenPrivateIndex = -1; @@ -64,7 +66,7 @@ fbOverlayCreateWindow(WindowPtr pWin) pPixmap = pScrPriv->layer[i].u.run.pixmap; if (pWin->drawable.depth == pPixmap->drawable.depth) { - pWin->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap; + pWin->devPrivates[fbWinPrivateIndex].ptr = (void *) pPixmap; /* * Make sure layer keys are written correctly by * having non-root layers set to full while the @@ -74,7 +76,7 @@ fbOverlayCreateWindow(WindowPtr pWin) */ if (!pWin->parent) { - REGION_EMPTY (pWin->drawable.pScreen, + RegionEmpty( &pScrPriv->layer[i].u.run.region); } return TRUE; @@ -84,7 +86,7 @@ fbOverlayCreateWindow(WindowPtr pWin) } Bool -fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen) +fbOverlayCloseScreen (ScreenPtr pScreen) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); int i; @@ -92,7 +94,7 @@ fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen) for (i = 0; i < pScrPriv->nlayers; i++) { (*pScreen->DestroyPixmap)(pScrPriv->layer[i].u.run.pixmap); - REGION_UNINIT (pScreen, &pScrPriv->layer[i].u.run.region); + RegionUninit(&pScrPriv->layer[i].u.run.region); } return TRUE; } @@ -108,7 +110,7 @@ fbOverlayWindowLayer(WindowPtr pWin) for (i = 0; i < pScrPriv->nlayers; i++) if (pWin->devPrivates[fbWinPrivateIndex].ptr == - (pointer) pScrPriv->layer[i].u.run.pixmap) + (void *) pScrPriv->layer[i].u.run.pixmap) return i; return 0; } @@ -119,7 +121,7 @@ fbOverlayCreateScreenResources(ScreenPtr pScreen) int i; FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); PixmapPtr pPixmap; - pointer pbits; + void * pbits; int width; int depth; BoxRec box; @@ -136,7 +138,7 @@ fbOverlayCreateScreenResources(ScreenPtr pScreen) 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); + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0); if (!pPixmap) return FALSE; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, @@ -146,7 +148,7 @@ fbOverlayCreateScreenResources(ScreenPtr pScreen) pbits)) return FALSE; pScrPriv->layer[i].u.run.pixmap = pPixmap; - REGION_INIT(pScreen, &pScrPriv->layer[i].u.run.region, &box, 0); + RegionInit(&pScrPriv->layer[i].u.run.region, &box, 0); } pScreen->devPrivate = pScrPriv->layer[0].u.run.pixmap; return TRUE; @@ -174,24 +176,24 @@ fbOverlayUpdateLayerRegion (ScreenPtr pScreen, int i; RegionRec rgnNew; - if (!prgn || !REGION_NOTEMPTY(pScreen, prgn)) + if (!prgn || !RegionNotEmpty(prgn)) return; for (i = 0; i < pScrPriv->nlayers; i++) { if (i == layer) { /* add new piece to this fb */ - REGION_UNION (pScreen, + RegionUnion( &pScrPriv->layer[i].u.run.region, &pScrPriv->layer[i].u.run.region, prgn); } - else if (REGION_NOTEMPTY (pScreen, + else if (RegionNotEmpty( &pScrPriv->layer[i].u.run.region)) { /* paint new piece with chroma key */ - REGION_NULL (pScreen, &rgnNew); - REGION_INTERSECT (pScreen, + RegionNull(&rgnNew); + RegionIntersect( &rgnNew, prgn, &pScrPriv->layer[i].u.run.region); @@ -199,9 +201,9 @@ fbOverlayUpdateLayerRegion (ScreenPtr pScreen, &rgnNew, pScrPriv->layer[i].key, i); - REGION_UNINIT(pScreen, &rgnNew); + RegionUninit(&rgnNew); /* remove piece from other fbs */ - REGION_SUBTRACT (pScreen, + RegionSubtract( &pScrPriv->layer[i].u.run.region, &pScrPriv->layer[i].u.run.region, prgn); @@ -231,21 +233,21 @@ fbOverlayCopyWindow(WindowPtr pWin, /* * Clip to existing bits */ - REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); - REGION_NULL (pScreen, &rgnDst); - REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - REGION_TRANSLATE(pScreen, &rgnDst, dx, dy); + RegionTranslate(prgnSrc, -dx, -dy); + RegionNull(&rgnDst); + RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); + RegionTranslate(&rgnDst, dx, dy); /* * Compute the portion of each fb affected by this copy */ for (i = 0; i < pScrPriv->nlayers; i++) { - REGION_NULL (pScreen, &layerRgn[i]); - REGION_INTERSECT(pScreen, &layerRgn[i], &rgnDst, + RegionNull(&layerRgn[i]); + RegionIntersect(&layerRgn[i], &rgnDst, &pScrPriv->layer[i].u.run.region); - if (REGION_NOTEMPTY (pScreen, &layerRgn[i])) + if (RegionNotEmpty(&layerRgn[i])) { - REGION_TRANSLATE(pScreen, &layerRgn[i], -dx, -dy); + RegionTranslate(&layerRgn[i], -dx, -dy); pPixmap = pScrPriv->layer[i].u.run.pixmap; fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable, 0, @@ -258,12 +260,12 @@ fbOverlayCopyWindow(WindowPtr pWin, */ for (i = 0; i < pScrPriv->nlayers; i++) { - if (REGION_NOTEMPTY (pScreen, &layerRgn[i])) + if (RegionNotEmpty(&layerRgn[i])) fbOverlayUpdateLayerRegion (pScreen, i, &layerRgn[i]); - REGION_UNINIT(pScreen, &layerRgn[i]); + RegionUninit(&layerRgn[i]); } - REGION_UNINIT(pScreen, &rgnDst); + RegionUninit(&rgnDst); } void @@ -289,8 +291,8 @@ fbOverlayPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) Bool fbOverlaySetupScreen(ScreenPtr pScreen, - pointer pbits1, - pointer pbits2, + void * pbits1, + void * pbits2, int xsize, int ysize, int dpix, @@ -336,8 +338,8 @@ fb24_32OverlayCreateScreenResources(ScreenPtr pScreen) Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, - pointer pbits1, - pointer pbits2, + void * pbits1, + void * pbits2, int xsize, int ysize, int dpix, @@ -363,7 +365,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen, fbOverlayGeneration = serverGeneration; } - pScrPriv = xalloc (sizeof (FbOverlayScrPrivRec)); + pScrPriv = malloc (sizeof (FbOverlayScrPrivRec)); if (!pScrPriv) return FALSE; @@ -436,7 +438,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen, pScrPriv->layer[1].u.init.width = width2; pScrPriv->layer[1].u.init.depth = depth2; - pScreen->devPrivates[fbOverlayScreenPrivateIndex].ptr = (pointer) pScrPriv; + pScreen->devPrivates[fbOverlayScreenPrivateIndex].ptr = (void *) pScrPriv; /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = fbOverlayCloseScreen; diff --git a/nx-X11/programs/Xserver/fb/fboverlay.h b/nx-X11/programs/Xserver/fb/fboverlay.h index e6a4e033f..2bb8b176a 100644 --- a/nx-X11/programs/Xserver/fb/fboverlay.h +++ b/nx-X11/programs/Xserver/fb/fboverlay.h @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/fb/fboverlay.h,v 1.4tsi Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -39,7 +37,7 @@ typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int); typedef struct _fbOverlayLayer { union { struct { - pointer pbits; + void * pbits; int width; int depth; } init; @@ -65,7 +63,7 @@ Bool fbOverlayCreateWindow(WindowPtr pWin); Bool -fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen); +fbOverlayCloseScreen (ScreenPtr pScreen); int fbOverlayWindowLayer(WindowPtr pWin); @@ -100,8 +98,8 @@ fbOverlayPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what); Bool fbOverlaySetupScreen(ScreenPtr pScreen, - pointer pbits1, - pointer pbits2, + void * pbits1, + void * pbits2, int xsize, int ysize, int dpix, @@ -113,8 +111,8 @@ fbOverlaySetupScreen(ScreenPtr pScreen, Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, - pointer pbits1, - pointer pbits2, + void * pbits1, + void * pbits2, int xsize, int ysize, int dpix, diff --git a/nx-X11/programs/Xserver/fb/fbpict.c b/nx-X11/programs/Xserver/fb/fbpict.c index 5ab3756b9..214ed5a4c 100644 --- a/nx-X11/programs/Xserver/fb/fbpict.c +++ b/nx-X11/programs/Xserver/fb/fbpict.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/fb/fbpict.c,v 1.15 2002/09/26 02:56:48 keithp Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -27,6 +25,8 @@ #include <dix-config.h> #endif +#include <string.h> + #include "fb.h" #ifdef RENDER @@ -34,7 +34,6 @@ #include "picturestr.h" #include "mipict.h" #include "fbpict.h" -#include "fbmmx.h" typedef void (*CompositeFunc) (CARD8 op, PicturePtr pSrc, @@ -850,14 +849,6 @@ fbComposite (CARD8 op, int x_msk, y_msk, x_src, y_src, x_dst, y_dst; int w, h, w_this, h_this; -#ifdef USE_MMX - static Bool mmx_setup = FALSE; - if (!mmx_setup) { - fbComposeSetupMMX(); - mmx_setup = TRUE; - } -#endif - xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; if (pSrc->pDrawable) { @@ -879,13 +870,6 @@ fbComposite (CARD8 op, && (!pMask || pMask->filter != PictFilterConvolution)) switch (op) { case PictOpSrc: -#ifdef USE_MMX - if (!pMask && pSrc->format == pDst->format && - pSrc->format != PICT_a8 && pSrc->pDrawable != pDst->pDrawable) - { - func = fbCompositeCopyAreammx; - } -#endif break; case PictOpOver: if (pMask) @@ -901,12 +885,7 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_r5g6b5: case PICT_b5g6r5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8x0565mmx; - else -#endif - func = fbCompositeSolidMask_nx8x0565; + func = fbCompositeSolidMask_nx8x0565; break; case PICT_r8g8b8: case PICT_b8g8r8: @@ -916,12 +895,7 @@ fbComposite (CARD8 op, case PICT_x8r8g8b8: case PICT_a8b8g8r8: case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8x8888mmx; - else -#endif - func = fbCompositeSolidMask_nx8x8888; + func = fbCompositeSolidMask_nx8x8888; break; } break; @@ -930,20 +904,10 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8888x8888Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x8888C; + func = fbCompositeSolidMask_nx8888x8888C; break; case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8888x0565Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x0565C; + func = fbCompositeSolidMask_nx8888x0565C; break; } } @@ -953,20 +917,10 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8888x8888Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x8888C; + func = fbCompositeSolidMask_nx8888x8888C; break; case PICT_b5g6r5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8888x0565Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x0565C; + func = fbCompositeSolidMask_nx8888x0565C; break; } } @@ -1003,16 +957,8 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888RevNPx8888mmx; -#endif break; case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888RevNPx0565mmx; -#endif break; } break; @@ -1025,16 +971,8 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888RevNPx8888mmx; -#endif break; case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888RevNPx0565mmx; -#endif break; } break; @@ -1054,10 +992,6 @@ fbComposite (CARD8 op, pDst->format == PICT_x8r8g8b8 && pMask->format == PICT_a8) { -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888x8x8888mmx; -#endif } } } @@ -1075,22 +1009,8 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - { - srcRepeat = FALSE; - func = fbCompositeSolid_nx8888mmx; - } -#endif break; case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - { - srcRepeat = FALSE; - func = fbCompositeSolid_nx0565mmx; - } -#endif break; } break; @@ -1103,12 +1023,7 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888x8888mmx; - else -#endif - func = fbCompositeSrc_8888x8888; + func = fbCompositeSrc_8888x8888; break; case PICT_r8g8b8: func = fbCompositeSrc_8888x0888; @@ -1122,20 +1037,12 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeCopyAreammx; -#endif break; } case PICT_x8b8g8r8: switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeCopyAreammx; -#endif break; } break; @@ -1143,12 +1050,7 @@ fbComposite (CARD8 op, switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888x8888mmx; - else -#endif - func = fbCompositeSrc_8888x8888; + func = fbCompositeSrc_8888x8888; break; case PICT_b8g8r8: func = fbCompositeSrc_8888x0888; @@ -1183,36 +1085,21 @@ fbComposite (CARD8 op, case PICT_a8r8g8b8: switch (pDst->format) { case PICT_a8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrcAdd_8888x8888mmx; - else -#endif - func = fbCompositeSrcAdd_8888x8888; + func = fbCompositeSrcAdd_8888x8888; break; } break; case PICT_a8b8g8r8: switch (pDst->format) { case PICT_a8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrcAdd_8888x8888mmx; - else -#endif - func = fbCompositeSrcAdd_8888x8888; + func = fbCompositeSrcAdd_8888x8888; break; } break; case PICT_a8: switch (pDst->format) { case PICT_a8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrcAdd_8000x8000mmx; - else -#endif - func = fbCompositeSrcAdd_8000x8000; + func = fbCompositeSrcAdd_8000x8000; break; } break; @@ -1248,8 +1135,8 @@ fbComposite (CARD8 op, height)) return; - n = REGION_NUM_RECTS (®ion); - pbox = REGION_RECTS (®ion); + n = RegionNumRects (®ion); + pbox = RegionRects (®ion); while (n--) { h = pbox->y2 - pbox->y1; @@ -1309,7 +1196,7 @@ fbComposite (CARD8 op, } pbox++; } - REGION_UNINIT (pDst->pDrawable->pScreen, ®ion); + RegionUninit(®ion); } #endif /* RENDER */ @@ -1336,121 +1223,3 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) return TRUE; } - -#ifdef USE_MMX -/* The CPU detection code needs to be in a file not compiled with - * "-mmmx -msse", as gcc would generate CMOV instructions otherwise - * that would lead to SIGILL instructions on old CPUs that don't have - * it. - */ -#if !defined(__amd64__) && !defined(__x86_64__) - -enum CPUFeatures { - NoFeatures = 0, - MMX = 0x1, - MMX_Extensions = 0x2, - SSE = 0x6, - SSE2 = 0x8, - CMOV = 0x10 -}; - -static unsigned int detectCPUFeatures(void) { - unsigned int result; - char vendor[13]; - vendor[0] = 0; - vendor[12] = 0; - /* see p. 118 of amd64 instruction set manual Vol3 */ - /* We need to be careful about the handling of %ebx and - * %esp here. We can't declare either one as clobbered - * since they are special registers (%ebx is the "PIC - * register" holding an offset to global data, %esp the - * stack pointer), so we need to make sure they have their+ * original values when we access the output operands. - */ - __asm__ ("pushf\n" - "pop %%eax\n" - "mov %%eax, %%ecx\n" - "xor $0x00200000, %%eax\n" - "push %%eax\n" - "popf\n" - "pushf\n" - "pop %%eax\n" - "mov $0x0, %%edx\n" - "xor %%ecx, %%eax\n" - "jz 1\n" - - "mov $0x00000000, %%eax\n" - "push %%ebx\n" - "cpuid\n" - "mov %%ebx, %%eax\n" - "pop %%ebx\n" - "mov %%eax, %1\n" - "mov %%edx, %2\n" - "mov %%ecx, %3\n" - "mov $0x00000001, %%eax\n" - "push %%ebx\n" - "cpuid\n" - "pop %%ebx\n" - "1:\n" - "mov %%edx, %0\n" - : "=r" (result), - "=m" (vendor[0]), - "=m" (vendor[4]), - "=m" (vendor[8]) - : - : "%eax", "%ecx", "%edx" - ); - - unsigned int features = 0; - if (result) { - /* result now contains the standard feature bits */ - if (result & (1 << 15)) - features |= CMOV; - if (result & (1 << 23)) - features |= MMX; - if (result & (1 << 25)) - features |= SSE; - if (result & (1 << 26)) - features |= SSE2; - if ((result & MMX) && !(result & SSE) && (strcmp(vendor, "AuthenticAMD") == 0)) { - /* check for AMD MMX extensions */ - - unsigned int result; - __asm__("push %%ebx\n" - "mov $0x80000000, %%eax\n" - "cpuid\n" - "xor %%edx, %%edx\n" - "cmp $0x1, %%eax\n" - "jge 2\n" - "mov $0x80000001, %%eax\n" - "cpuid\n" - "2:\n" - "pop %%ebx\n" - "mov %%edx, %0\n" - : "=r" (result) - : - : "%eax", "%ecx", "%edx" - ); - if (result & (1<<22)) - features |= MMX_Extensions; - } - } - return features; -} - -Bool -fbHaveMMX (void) -{ - static Bool initialized = FALSE; - static Bool mmx_present; - - if (!initialized) - { - unsigned int features = detectCPUFeatures(); - mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions); - initialized = TRUE; - } - - return mmx_present; -} -#endif /* __amd64__ */ -#endif diff --git a/nx-X11/programs/Xserver/fb/fbpict.h b/nx-X11/programs/Xserver/fb/fbpict.h index 665b92dd1..78d280707 100644 --- a/nx-X11/programs/Xserver/fb/fbpict.h +++ b/nx-X11/programs/Xserver/fb/fbpict.h @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/fb/fbpict.h,v 1.7 2001/07/18 10:15:02 keithp Exp $ - * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -72,7 +70,7 @@ FbBits *__bits__; \ FbStride __stride__; \ int __bpp__; \ - int __xoff__,__yoff__; \ + _X_UNUSED int __xoff__,__yoff__; \ \ fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ switch (__bpp__) { \ diff --git a/nx-X11/programs/Xserver/fb/fbpixmap.c b/nx-X11/programs/Xserver/fb/fbpixmap.c index decc07ba6..5f24433e3 100644 --- a/nx-X11/programs/Xserver/fb/fbpixmap.c +++ b/nx-X11/programs/Xserver/fb/fbpixmap.c @@ -21,19 +21,18 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbpixmap.c,v 1.9 2001/05/29 04:54:09 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <stdlib.h> + #include "fb.h" -#ifdef IN_MODULE -#include "xf86_ansic.h" -#endif PixmapPtr -fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp) +fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, + unsigned usage_hint) { PixmapPtr pPixmap; size_t datasize; @@ -73,7 +72,7 @@ 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 = (void *) ((char *)pPixmap + base + adjust); #ifdef FB_DEBUG pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth); fbInitializeDrawable (&pPixmap->drawable); @@ -83,12 +82,14 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp) pPixmap->screen_x = 0; pPixmap->screen_y = 0; #endif + pPixmap->usage_hint = usage_hint; return pPixmap; } PixmapPtr -fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth) +fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, + unsigned usage_hint) { int bpp; bpp = BitsPerPixel (depth); @@ -96,7 +97,7 @@ fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth) if (bpp == 32 && depth <= 24) bpp = fbGetScreenPrivate(pScreen)->pix32bpp; #endif - return fbCreatePixmapBpp (pScreen, width, height, depth, bpp); + return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint); } Bool @@ -104,7 +105,7 @@ fbDestroyPixmap (PixmapPtr pPixmap) { if(--pPixmap->refcnt) return TRUE; - xfree(pPixmap); + free(pPixmap); return TRUE; } @@ -118,8 +119,8 @@ if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \ { \ if ((reg)->data->numRects == (reg)->data->size) \ { \ - miRectAlloc(reg, 1); \ - fr = REGION_BOXPTR(reg); \ + RegionRectAlloc(reg, 1); \ + fr = RegionBoxptr(reg); \ r = fr + (reg)->data->numRects; \ } \ r->x1 = (rx1); \ @@ -156,10 +157,10 @@ fbPixmapToRegion(PixmapPtr pPix) FbBits *pwLine; int nWidth; - pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1); + pReg = RegionCreate(NULL, 1); if(!pReg) return NullRegion; - FirstRect = REGION_BOXPTR(pReg); + FirstRect = RegionBoxptr(pReg); rects = FirstRect; pwLine = (FbBits *) pPix->devPrivate.ptr; @@ -305,16 +306,16 @@ fbPixmapToRegion(PixmapPtr pPix) pReg->extents.x1 = pReg->extents.x2 = 0; else { - pReg->extents.y1 = REGION_BOXPTR(pReg)->y1; - pReg->extents.y2 = REGION_END(pReg)->y2; + pReg->extents.y1 = RegionBoxptr(pReg)->y1; + pReg->extents.y2 = RegionEnd(pReg)->y2; if (pReg->data->numRects == 1) { - xfree(pReg->data); + free(pReg->data); pReg->data = (RegDataPtr)NULL; } } #ifdef DEBUG - if (!miValidRegion(pReg)) + if (!RegionIsValid(pReg)) FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); #endif return(pReg); diff --git a/nx-X11/programs/Xserver/fb/fbpoint.c b/nx-X11/programs/Xserver/fb/fbpoint.c index 5229d6970..719dcfbb4 100644 --- a/nx-X11/programs/Xserver/fb/fbpoint.c +++ b/nx-X11/programs/Xserver/fb/fbpoint.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbpoint.c,v 1.7 2000/09/22 05:58:01 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -157,7 +156,7 @@ fbPolyPoint (DrawablePtr pDrawable, case 32: dots = fbDots32; break; } #endif - for (nBox = REGION_NUM_RECTS (pClip), pBox = REGION_RECTS (pClip); + for (nBox = RegionNumRects (pClip), pBox = RegionRects (pClip); nBox--; pBox++) (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit, pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor); diff --git a/nx-X11/programs/Xserver/fb/fbpseudocolor.c b/nx-X11/programs/Xserver/fb/fbpseudocolor.c deleted file mode 100644 index ef40b7073..000000000 --- a/nx-X11/programs/Xserver/fb/fbpseudocolor.c +++ /dev/null @@ -1,2335 +0,0 @@ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "scrnintstr.h" -#include "colormapst.h" -#include "glyphstr.h" -#include "resource.h" -#include <X11/fonts/font.h> -#include "dixfontstr.h" -#include <X11/fonts/fontstruct.h> -#include "micmap.h" -#include "fb.h" -#include "fbpseudocolor.h" - -static Bool xxCreateGC(GCPtr pGC); -static void xxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); -static void xxDestroyGC(GCPtr pGC); -static void xxChangeGC (GCPtr pGC, unsigned long mask); -static void xxCopyGC (GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -static void xxChangeClip (GCPtr pGC, int type, pointer pvalue, int nrects); - -static void xxCopyClip(GCPtr pgcDst, GCPtr pgcSrc); -static void xxDestroyClip(GCPtr pGC); -static void xxFillSpans(DrawablePtr pDraw, GC *pGC, int nInit, - DDXPointPtr pptInit, int *pwidthInit, int fSorted); -static void xxSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc, - DDXPointPtr pptInit, int *pwidthInit, int nspans, - int fSorted); -static void xxPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, - int w, int h,int leftPad, int format, char *pImage); -static RegionPtr xxCopyPlane(DrawablePtr pSrc, - DrawablePtr pDst, GCPtr pGC,int srcx, int srcy, - int width, int height, int dstx, int dsty, - unsigned long bitPlane); -static void xxPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, - xPoint *pptInit); -static void xxPolylines(DrawablePtr pDraw, GCPtr pGC, int mode, - int npt, DDXPointPtr pptInit); -static void xxPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, - xSegment *pSeg); -static void xxPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nRects, - xRectangle *pRects); -static void xxPolyArc( DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs); -static void xxFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr pptInit); -static void xxPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nRectsInit, - xRectangle *pRectsInit); -static RegionPtr xxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GC *pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty); -static void xxPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, - xArc *parcs); -static int xxPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, - char *chars); -static int xxPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars); -static void xxImageText8(DrawablePtr pDraw, GCPtr pGC, int x, - int y, int count, char *chars); -static void xxImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars); -static void xxImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase); -static void xxPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase); -static void xxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw, - int dx, int dy, int xOrg, int yOrg); -static void -xxComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, - INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); -static void -xxGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, - GlyphListPtr list, GlyphPtr *glyphs); - - -typedef struct _xxCmapPrivRec { - CARD32* cmap; - ColormapPtr pmap; - Bool dirty; - struct _xxCmapPrivRec *next; -} xxCmapPrivRec, *xxCmapPrivPtr; - - -typedef struct { - CloseScreenProcPtr CloseScreen; - CreateScreenResourcesProcPtr CreateScreenResources; - CreateWindowProcPtr CreateWindow; - CopyWindowProcPtr CopyWindow; - PaintWindowProcPtr PaintWindowBackground; - PaintWindowProcPtr PaintWindowBorder; - WindowExposuresProcPtr WindowExposures; - CreateGCProcPtr CreateGC; - CreateColormapProcPtr CreateColormap; - DestroyColormapProcPtr DestroyColormap; - InstallColormapProcPtr InstallColormap; - UninstallColormapProcPtr UninstallColormap; - ListInstalledColormapsProcPtr ListInstalledColormaps; - StoreColorsProcPtr StoreColors; -#ifdef RENDER - CompositeProcPtr Composite; - GlyphsProcPtr Glyphs; -#endif - PixmapPtr pPixmap; - char * addr; - pointer pBits; - RegionRec region; - VisualPtr bVisual; - RegionRec bRegion; - int myDepth; - int depth; - ColormapPtr baseCmap; - ColormapPtr* InstalledCmaps; - xxCmapPrivPtr Cmaps; - int numInstalledColormaps; - int colormapDirty; - xxSyncFunc sync; -} xxScrPrivRec, *xxScrPrivPtr; - -#define xxGetScrPriv(s) ((xxScrPrivPtr) \ - (xxScrPrivateIndex != -1) \ - ? (s)->devPrivates[xxScrPrivateIndex].ptr\ - : NULL) -#define xxScrPriv(s) xxScrPrivPtr pScrPriv = xxGetScrPriv(s) - -#define xxGetCmapPriv(s) ((xxCmapPrivPtr) \ - (s)->devPrivates[xxColormapPrivateIndex].ptr) -#define xxCmapPriv(s) xxCmapPrivPtr pCmapPriv = xxGetCmapPriv(s); - -typedef struct _xxGCPriv { - GCOps *ops; - GCFuncs *funcs; -} xxGCPrivRec, *xxGCPrivPtr; - -#define xxGetGCPriv(pGC) ((xxGCPrivPtr) \ - (pGC)->devPrivates[xxGCPrivateIndex].ptr) -#define xxGCPriv(pGC) xxGCPrivPtr pGCPriv = xxGetGCPriv(pGC) - -int xxScrPrivateIndex = -1; -int xxGCPrivateIndex; -int xxColormapPrivateIndex = -1; -int xxGeneration; - - -#define wrap(priv,real,mem,func) {\ - priv->mem = real->mem; \ - real->mem = func; \ -} - -#define unwrap(priv,real,mem) {\ - real->mem = priv->mem; \ -} - -#define MARK_DIRTY (1 << 31) - -#define MAX_NUM_XX_INSTALLED_CMAPS 255 -/* #define DEBUG */ -#ifdef DEBUG -# define DBG ErrorF -# define DBG_ARGS(x) ErrorF x -# define PRINT_RECTS(rec) {\ - int i;\ - BoxPtr box;\ - ErrorF("RECTS: %i\n",REGION_NUM_RECTS(&rec));\ - if (REGION_NUM_RECTS(&rec) > 1) { \ - for (i = 0; i < REGION_NUM_RECTS(&rec); i++ ) {\ - box = REGION_BOX(&rec,i);\ - ErrorF("x1: %hi x2: %hi y1: %hi y2: %hi\n", \ - box->x1,box->x2,box->y1,box->y2);\ - }\ - } else { \ - box = &(rec.extents); \ - ErrorF("x1: %hi x2: %hi y1: %hi y2: %hi\n", \ - box->x1,box->x2,box->y1,box->y2);\ - } \ -} -#else -# define DBG(x) -# define DBG_ARGS(x) -# define PRINT_RECTS(rec) -#endif - -#if 0 -static void xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg, - xxCmapPrivPtr pCmapPriv); -static void xxUpdateFb(ScreenPtr pScreen); - - -static void -xxUpdateWindowImmediately(WindowPtr pWin) -{ - xxScrPriv(pWin->drawable.pScreen); - xxCmapPrivPtr pCmapPriv; - ColormapPtr pmap; - - pmap = (ColormapPtr)LookupIDByType(wColormap(pWin),RT_COLORMAP); - - if (pmap && (pCmapPriv = xxGetCmapPriv(pmap)) != (pointer)-1) { - xxCopyPseudocolorRegion(pWin->drawable.pScreen, - &pScrPriv->region, pCmapPriv); - } -} -#else -# define xxUpdateWindowImmediately(x) -#endif - -static ColormapPtr -xxGetBaseColormap(ScreenPtr pScreen) -{ - xxScrPriv(pScreen); - DepthPtr pDepth = pScreen->allowedDepths; - int i,j,k; - ColormapPtr pDefMap - = (ColormapPtr) LookupIDByType(pScreen->defColormap,RT_COLORMAP); - ColormapPtr cmap = NULL; - VisualPtr pVisual = NULL; - - for (i = 0; i < pScreen->numDepths; i++, pDepth++) - if (pDepth->depth == pScrPriv->depth) { - for (j = 0; j < pDepth->numVids; j++) { - if (pDefMap->pVisual->vid == pDepth->vids[j] - && pDefMap->pVisual->class == TrueColor) { - cmap = pDefMap; - break; - } - if (!pVisual) { - for (k = 0; k < pScreen->numVisuals; k++) { - if (pScreen->visuals[k].class == TrueColor - && pScreen->visuals[k].vid - == pDepth->vids[j]) { - pVisual = &pScreen->visuals[k]; - break; - } - } - } - } - if (cmap) - break; - } - - if (!cmap) { - CreateColormap(FakeClientID(0),pScreen,pVisual,&cmap,AllocNone,0); - } - - return cmap; -} - -static Bool -xxCreateScreenResources(ScreenPtr pScreen) -{ - PixmapPtr pPix; - xxScrPriv(pScreen); - Bool ret; - PixmapPtr pPixmap; - BoxRec box; - int depth = pScrPriv->myDepth; - pointer pBits; - - unwrap (pScrPriv,pScreen, CreateScreenResources); - ret = pScreen->CreateScreenResources(pScreen); - wrap(pScrPriv,pScreen,CreateScreenResources,xxCreateScreenResources); - - if (!ret) return FALSE; - - pScrPriv->pBits = NULL; - if (pScrPriv->addr) - pBits = pScrPriv->addr; - else - pBits = xalloc(pScreen->width * pScreen->height - * (BitsPerPixel(depth) >> 3)); - if (!pBits) return FALSE; - - pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth); - if (!pPixmap) { - xfree(pBits); - return FALSE; - } - if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, - pScreen->height, depth, - BitsPerPixel(depth), - PixmapBytePad(pScreen->width, depth), - pBits)) { - xfree(pBits); - return FALSE; - } - if (pScreen->rootDepth == pScrPriv->myDepth) { - pPix = (PixmapPtr)pScreen->devPrivate; - if (!(*pScreen->ModifyPixmapHeader)(pPix, 0,0, pScrPriv->depth, - BitsPerPixel(pScrPriv->depth), - PixmapBytePad(pScreen->width, - pScrPriv->depth), - 0)) { - xfree(pBits); - return FALSE; - } - } - - pScrPriv->baseCmap = xxGetBaseColormap(pScreen); - - pScrPriv->pBits = pBits; - pScrPriv->pPixmap = pPixmap; - box.x1 = 0; - box.y1 = 0; - box.x2 = pScreen->width; - box.y2 = pScreen->height; - REGION_NULL(pScreen, &pScrPriv->region); - REGION_INIT(pScreen, &pScrPriv->bRegion, &box, 0); - - return TRUE; -} - -static Bool -xxCloseScreen (int iScreen, ScreenPtr pScreen) -{ - xxScrPriv(pScreen); - Bool ret; - - (*pScreen->DestroyPixmap)(pScrPriv->pPixmap); - /* We don't need to free the baseColormap as FreeClientResourcess - will have taken care of it. */ - REGION_UNINIT (pScreen, &pScrPriv->region); - - unwrap (pScrPriv,pScreen, CloseScreen); - ret = pScreen->CloseScreen(iScreen,pScreen); - - xfree(pScrPriv->pBits); - xfree(pScrPriv->InstalledCmaps); - xfree(pScrPriv); - - return TRUE; -} - -static Bool -xxMyVisual(ScreenPtr pScreen, VisualID vid) -{ - xxScrPriv(pScreen); - DepthPtr pDepth = pScreen->allowedDepths; - int i,j; - - for (i = 0; i < pScreen->numDepths; i++, pDepth++) - if (pDepth->depth == pScrPriv->myDepth) { - for (j = 0; j < pDepth->numVids; j++) { - if (vid == pDepth->vids[j]) { - return TRUE; - } - } - } - return FALSE; -} - -static Bool -xxInitColormapDummy(ColormapPtr pmap, int index) -{ - return TRUE; -} - -static Bool -xxInitColormapPrivate(ColormapPtr pmap) -{ - xxScrPriv(pmap->pScreen); - xxCmapPrivPtr pCmapPriv; - pointer cmap; - - pmap->devPrivates[xxColormapPrivateIndex].ptr = (pointer) -1; - - if (xxMyVisual(pmap->pScreen,pmap->pVisual->vid)) { - DBG("CreateColormap\n"); - pCmapPriv = (xxCmapPrivPtr) xalloc (sizeof (xxCmapPrivRec)); - if (!pCmapPriv) - return FALSE; - pmap->devPrivates[xxColormapPrivateIndex].ptr = (pointer) pCmapPriv; - cmap = xalloc(sizeof (CARD32) * (1 << pScrPriv->myDepth)); - if (!cmap) - return FALSE; - - memset(cmap,0,sizeof (CARD32) * (1 << pScrPriv->myDepth)); - - pCmapPriv->cmap = cmap; - pCmapPriv->dirty = FALSE; - pCmapPriv->pmap = pmap; - pCmapPriv->next = pScrPriv->Cmaps; - pScrPriv->Cmaps = pCmapPriv; - } - return TRUE; -} - - -static Bool -xxCreateColormap(ColormapPtr pmap) -{ - xxScrPriv(pmap->pScreen); - Bool ret; - - if (!xxInitColormapPrivate(pmap)) return FALSE; - - unwrap(pScrPriv,pmap->pScreen, CreateColormap); - ret = pmap->pScreen->CreateColormap(pmap); - wrap(pScrPriv,pmap->pScreen,CreateColormap,xxCreateColormap); - - return ret; -} - -static int -xxCmapInstalled(ColormapPtr pmap) -{ - xxScrPriv(pmap->pScreen); - int i; - - for (i = 0; i < pScrPriv->numInstalledColormaps; i++) - if (pScrPriv->InstalledCmaps[i] == pmap) - break; - if (i == pScrPriv->numInstalledColormaps) /* not installed */ - return -1; - return i; -} - -static void -xxInstalledCmapDelete(ScreenPtr pScreen, int num) -{ - xxScrPriv(pScreen); - int i; - - pScrPriv->numInstalledColormaps--; - - for (i = num; i < pScrPriv->numInstalledColormaps; i++) - pScrPriv->InstalledCmaps[i] = pScrPriv->InstalledCmaps[i+1]; -} - -static void -xxDestroyColormap(ColormapPtr pmap) -{ - xxScrPriv(pmap->pScreen); - xxCmapPriv(pmap); - - if (pCmapPriv != (pointer) -1) { - xxCmapPrivPtr tmpCmapPriv = pScrPriv->Cmaps; - xxCmapPrivPtr *prevCmapPriv = &pScrPriv->Cmaps; - int n; - - DBG("DestroyColormap\n"); - - if ((n = xxCmapInstalled(pmap)) != -1) - xxInstalledCmapDelete(pmap->pScreen,n); - - while (tmpCmapPriv) { - if (tmpCmapPriv->pmap == pmap) { - *prevCmapPriv = tmpCmapPriv->next; - break; - } - prevCmapPriv = &tmpCmapPriv->next; - tmpCmapPriv = tmpCmapPriv->next; - } - - xfree(pCmapPriv->cmap); - xfree(pCmapPriv); - } - - unwrap(pScrPriv,pmap->pScreen, DestroyColormap); - pmap->pScreen->DestroyColormap(pmap); - wrap(pScrPriv,pmap->pScreen,DestroyColormap,xxDestroyColormap); -} - -#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d))) - -static int -xxComputeCmapShift (unsigned long mask) -{ - int shift; - unsigned long bit; - - shift = 16; - bit = 0x80000000; - while (!(mask & bit)) - { - shift--; - bit >>= 1; - } - return shift; -} - -static void -xxStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors) -{ - xxScrPriv(pmap->pScreen); - xxCmapPriv(pmap); - - if (pCmapPriv != (pointer) -1) { - - xColorItem *expanddefs; - int i; - VisualPtr bVisual; - int rs, gs, bs; - - if (nColors == 0) return; - - DBG("StoreColors\n"); - - expanddefs = ALLOCATE_LOCAL(sizeof(xColorItem) - * (1 << pScrPriv->myDepth)); - if (!expanddefs) return; - - bVisual = pScrPriv->bVisual; - - DBG("StoreColors\n"); - - rs = xxComputeCmapShift(bVisual->redMask); - gs = xxComputeCmapShift(bVisual->greenMask); - bs = xxComputeCmapShift(bVisual->blueMask); - - if ((pmap->pVisual->class | DynamicClass) == DirectColor) { - nColors = miExpandDirectColors(pmap, nColors, pColors, expanddefs); - pColors = expanddefs; - } - - for (i = 0; i < nColors; i++) { - DBG_ARGS(("index: %i r 0x%x g 0x%x b 0x%x\n", pColors->pixel, - pColors->red, pColors->green, pColors->blue)); - pCmapPriv->cmap[pColors->pixel] = MARK_DIRTY - | (Shift(pColors->red, rs) & bVisual->redMask) - | (Shift(pColors->green, gs) & bVisual->greenMask) - | (Shift(pColors->blue, bs) & bVisual->blueMask); - pColors++; - } - - DEALLOCATE_LOCAL(expanddefs); - - pCmapPriv->dirty = TRUE; - pScrPriv->colormapDirty = TRUE; - - return; - } - - unwrap(pScrPriv,pmap->pScreen, StoreColors); - pmap->pScreen->StoreColors(pmap,nColors,pColors); - wrap(pScrPriv,pmap->pScreen,StoreColors,xxStoreColors); -} - -static void -xxInstallColormap(ColormapPtr pmap) -{ - int i; - xxScrPriv(pmap->pScreen); - xxCmapPriv(pmap); - - if (pCmapPriv != (pointer) -1) { - Pixel *pixels; - xrgb *colors; - int i; - VisualPtr pVisual; - xColorItem *defs; - - DBG("InstallColormap\n"); - - if (xxCmapInstalled(pmap) != -1) - return; - - if (!pScrPriv->numInstalledColormaps) { - unwrap(pScrPriv,pmap->pScreen, InstallColormap); - pmap->pScreen->InstallColormap(pScrPriv->baseCmap); - wrap(pScrPriv,pmap->pScreen,InstallColormap,xxInstallColormap); - } - - pixels = ALLOCATE_LOCAL(sizeof(Pixel) * (1 << pScrPriv->myDepth)); - colors = ALLOCATE_LOCAL(sizeof(xrgb) * (1 << pScrPriv->myDepth)); - defs = ALLOCATE_LOCAL(sizeof(xColorItem) * (1 << pScrPriv->myDepth)); - - if (!pixels || !colors) - return; - - /* if we have more than max installed delete the oldest */ - if (pScrPriv->numInstalledColormaps == MAX_NUM_XX_INSTALLED_CMAPS) - xxInstalledCmapDelete(pmap->pScreen,0); - - pScrPriv->InstalledCmaps[pScrPriv->numInstalledColormaps] = pmap; - pScrPriv->numInstalledColormaps++; - - pVisual = pScrPriv->bVisual; - - for (i = 0; i < (1 << pScrPriv->myDepth); i++) - pixels[i] = i; - - QueryColors (pmap, (1 << pScrPriv->myDepth), pixels, colors); - - for (i = 0; i < (1 << pScrPriv->myDepth); i++) { - defs[i].pixel = pixels[i]; - defs[i].red = colors[i].red; - defs[i].green = colors[i].green; - defs[i].blue = colors[i].blue; - defs[i].flags = DoRed|DoGreen|DoBlue; - } - xxStoreColors(pmap,(1 << pScrPriv->myDepth),defs); - - DEALLOCATE_LOCAL(pixels); - DEALLOCATE_LOCAL(colors); - DEALLOCATE_LOCAL(defs); - - return; - } - - for (i = pScrPriv->numInstalledColormaps; i ; i--) - WalkTree(pmap->pScreen, TellLostMap, - (char *)&pScrPriv->InstalledCmaps[i-1]->mid); - - pScrPriv->numInstalledColormaps = 0; - - unwrap(pScrPriv,pmap->pScreen, InstallColormap); - pmap->pScreen->InstallColormap(pmap); - wrap(pScrPriv,pmap->pScreen,InstallColormap,xxInstallColormap); -} - -static void -xxUninstallColormap(ColormapPtr pmap) -{ - xxScrPriv(pmap->pScreen); - xxCmapPriv(pmap); - - if (pCmapPriv != (pointer) -1) { - int num; - - if ((num = xxCmapInstalled(pmap)) == -1) - return; - - DBG("UninstallColormap\n"); - xxInstalledCmapDelete(pmap->pScreen,num); - - return; - } - - unwrap(pScrPriv,pmap->pScreen, UninstallColormap); - pmap->pScreen->UninstallColormap(pmap); - wrap(pScrPriv,pmap->pScreen,UninstallColormap,xxUninstallColormap); - -} - -static int -xxListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds) -{ - int n,i; - xxScrPriv(pScreen); - - unwrap(pScrPriv,pScreen, ListInstalledColormaps); - n = pScreen->ListInstalledColormaps(pScreen, pCmapIds); - wrap (pScrPriv,pScreen,ListInstalledColormaps,xxListInstalledColormaps); - - pCmapIds += n; - - for (i = 0; i < pScrPriv->numInstalledColormaps; i++) { - *pCmapIds++ = pScrPriv->InstalledCmaps[i]->mid; - n++; - } - - return n; -} - -static Bool -xxCreateWindow(WindowPtr pWin) -{ - xxScrPriv(pWin->drawable.pScreen); - - if (pWin->drawable.class != InputOutput - || pScrPriv->myDepth != pWin->drawable.depth) { - Bool ret; - DBG("CreateWindow NoPseudo\n"); - unwrap (pScrPriv, pWin->drawable.pScreen, CreateWindow); - ret = pWin->drawable.pScreen->CreateWindow(pWin); - wrap(pScrPriv, pWin->drawable.pScreen, CreateWindow, xxCreateWindow); - - return ret; - } - - DBG("CreateWindow\n"); - - pWin->devPrivates[fbWinPrivateIndex].ptr = (pointer) pScrPriv->pPixmap; - PRINT_RECTS(pScrPriv->region); - if (!pWin->parent) { - REGION_EMPTY (pWin->drawable.pScreen, &pScrPriv->region); - } - PRINT_RECTS(pScrPriv->region); - - return TRUE; -} - -static void -xxWalkChildren(WindowPtr pWin, RegionPtr pReg, PixmapPtr pPixmap) -{ - - WindowPtr pCurWin = pWin; - - do { - if (fbGetWindowPixmap(pCurWin) == pPixmap) { - DBG("WalkWindow Add\n"); - REGION_UNION(pWin->drawable.pScreen,pReg,pReg, - &pCurWin->borderClip); - } else { - DBG("WalkWindow Sub\n"); - REGION_SUBTRACT(pWin->drawable.pScreen,pReg,pReg, - &pCurWin->borderClip); - } - if (pCurWin->lastChild) - xxWalkChildren(pCurWin->lastChild,pReg, pPixmap); - } while ((pCurWin = pCurWin->prevSib)); -} - -static void -xxPickMyWindows(WindowPtr pWin, RegionPtr pRgn) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - xxScrPriv(pScreen); - - if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) { - REGION_UNION(pWin->drawable.pScreen,pRgn,pRgn,&pWin->borderClip); - } - if (pWin->lastChild) - xxWalkChildren(pWin->lastChild,pRgn,pScrPriv->pPixmap); -} - -static void -xxCopyWindow(WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - xxScrPriv(pScreen); - RegionRec rgn; - RegionRec rgn_new; - int dx, dy; - PixmapPtr pPixmap = fbGetWindowPixmap(pWin); - - DBG("xxCopyWindow\n"); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - - REGION_NULL(pScreen, &rgn_new); - REGION_UNION(pScreen, &rgn_new,&rgn_new,prgnSrc); - REGION_TRANSLATE(pScreen,&rgn_new,-dx,-dy); - - REGION_NULL(pScreen, &rgn); - xxPickMyWindows(pWin,&rgn); - - unwrap (pScrPriv, pScreen, CopyWindow); - pWin->devPrivates[fbWinPrivateIndex].ptr = fbGetScreenPixmap(pScreen); - pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc); - pWin->devPrivates[fbWinPrivateIndex].ptr = pPixmap; - wrap(pScrPriv, pScreen, CopyWindow, xxCopyWindow); - - REGION_INTERSECT(pScreen,&rgn,&rgn,&rgn_new); - if (REGION_NOTEMPTY (pScreen,&rgn)) { - fbCopyRegion(&pScrPriv->pPixmap->drawable,&pScrPriv->pPixmap->drawable, - 0,&rgn,dx,dy,fbCopyWindowProc,0,(void*)0); - REGION_TRANSLATE(pScreen,&rgn,dx,dy); - REGION_INTERSECT(pScreen,&rgn_new,&pScrPriv->region,&rgn); - REGION_SUBTRACT(pScreen,&pScrPriv->region,&pScrPriv->region,&rgn); - REGION_TRANSLATE(pScreen,&rgn_new,-dx,-dy); - REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,&rgn_new); - } -#if 1 - REGION_UNINIT(pScreen,&rgn_new); - REGION_UNINIT(pScreen,&rgn); -#endif -} - -static void -xxWindowExposures (WindowPtr pWin, - RegionPtr prgn, - RegionPtr other_exposed) -{ - xxScrPriv(pWin->drawable.pScreen); - - if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) { - DBG("WindowExposures\n"); - PRINT_RECTS(pScrPriv->region); - REGION_UNION(pWin->drawable.pScreen,&pScrPriv->region, - &pScrPriv->region, - prgn); - PRINT_RECTS(pScrPriv->region); - } else { - DBG("WindowExposures NonPseudo\n"); - PRINT_RECTS(pScrPriv->region); - REGION_SUBTRACT(pWin->drawable.pScreen,&pScrPriv->region, - &pScrPriv->region, - prgn); - PRINT_RECTS(pScrPriv->region); - } - unwrap (pScrPriv, pWin->drawable.pScreen, WindowExposures); - pWin->drawable.pScreen->WindowExposures(pWin, prgn, other_exposed); - wrap(pScrPriv, pWin->drawable.pScreen, WindowExposures, xxWindowExposures); -} - -static void -xxPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) -{ - xxScrPriv(pWin->drawable.pScreen); - RegionRec rgni; - - DBG("xxPaintWindow\n"); - - REGION_NULL (pWin->drawable.pScreen, &rgni); -#if 0 - REGION_UNION (pWin->drawable.pScreen, &rgni, &rgni, &pWin->borderClip); - REGION_INTERSECT(pWin->drawable.pScreen, &rgni, &rgni, pRegion); -#else - REGION_UNION (pWin->drawable.pScreen, &rgni, &rgni, pRegion); -#endif - switch (what) { - case PW_BORDER: - REGION_SUBTRACT (pWin->drawable.pScreen, &rgni, &rgni, &pWin->winSize); - if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) { - DBG("PaintWindowBorder\n"); - REGION_UNION (pWin->drawable.pScreen, &pScrPriv->region, - &pScrPriv->region, &rgni); - } else { - DBG("PaintWindowBorder NoOverlay\n"); - REGION_SUBTRACT (pWin->drawable.pScreen, &pScrPriv->region, - &pScrPriv->region, &rgni); - } - unwrap (pScrPriv, pWin->drawable.pScreen, PaintWindowBorder); - pWin->drawable.pScreen->PaintWindowBorder (pWin, pRegion, what); - wrap(pScrPriv, pWin->drawable.pScreen, PaintWindowBorder, - xxPaintWindow); - break; - case PW_BACKGROUND: - switch (pWin->backgroundState) { - case None: - break; - default: - REGION_INTERSECT (pWin->drawable.pScreen, &rgni, - &rgni,&pWin->winSize); - if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) { - DBG("PaintWindowBackground\n"); - REGION_UNION (pWin->drawable.pScreen, &pScrPriv->region, - &pScrPriv->region, &rgni); - } else { - DBG("PaintWindowBackground NoOverlay\n"); - REGION_SUBTRACT (pWin->drawable.pScreen, &pScrPriv->region, - &pScrPriv->region, &rgni); - } - break; - } - - unwrap (pScrPriv, pWin->drawable.pScreen, PaintWindowBackground); - pWin->drawable.pScreen->PaintWindowBackground (pWin, pRegion, what); - wrap(pScrPriv, pWin->drawable.pScreen, PaintWindowBackground, - xxPaintWindow); - break; - } - PRINT_RECTS(rgni); - PRINT_RECTS(pScrPriv->region); -#if 1 - REGION_UNINIT(pWin->drawable.pScreen,&rgni); -#endif -} - -static void -xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg, - xxCmapPrivPtr pCmapPriv) -{ - xxScrPriv(pScreen); - CARD32 mask = (1 << pScrPriv->myDepth) - 1; - int num = REGION_NUM_RECTS(pReg); - BoxPtr pbox = REGION_RECTS(pReg); - int width, height; - CARD8 *src; - CARD16 *dst, *dst_base; - int dst_stride; - register CARD32 *cmap = pCmapPriv->cmap; - register CARD8 *s; - register CARD16 *d; - int w; - - dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr; - dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind - / sizeof (CARD16); - - while (num--) { - height = pbox->y2 - pbox->y1; - width = pbox->x2 - pbox->x1; - - src = (unsigned char *) pScrPriv->pBits - + (pbox->y1 * pScreen->width) + pbox->x1; - dst = dst_base + (pbox->y1 * dst_stride) + pbox->x1; - while (height--) { - w = width; - s = src; - d = dst; - - while(w--) { - *(d++) = (CARD16)*(cmap + ((*(s++)) & mask)); - } - src += pScreen->width; - dst += dst_stride; - } - pbox++; - } -} - -static void -xxUpdateCmapPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg, - xxCmapPrivPtr pCmapPriv) -{ - xxScrPriv(pScreen); - CARD32 mask = (1 << pScrPriv->myDepth) - 1; - int num = REGION_NUM_RECTS(pReg); - BoxPtr pbox = REGION_RECTS(pReg); - int width, height; - CARD8 *src; - CARD16 *dst, *dst_base; - int dst_stride; - register CARD32 val; - register CARD32 *cmap = pCmapPriv->cmap; - register CARD8 *s; - register CARD16 *d; - int w; - - dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr; - dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind - / sizeof (CARD16); - - while (num--) { - - height = pbox->y2 - pbox->y1; - width = pbox->x2 - pbox->x1; - - src = (unsigned char *) pScrPriv->pBits - + (pbox->y1 * pScreen->width) + pbox->x1; - dst = dst_base + (pbox->y1 * dst_stride) + pbox->x1; - while (height--) { - w = width; - s = src; - d = dst; - while(w--) { - val = *(cmap + ((*(s++)) & mask)); - if (val & MARK_DIRTY) { - *d = (CARD16) val; - } - d++; - } - src += pScreen->width; - dst += dst_stride; - } - pbox++; - } -} - -static void -xxGetWindowRegion(WindowPtr pWin,RegionPtr winreg) -{ - REGION_NULL(pWin->drawable.pScreen,winreg); - /* get visible part of the border ...Argh */ - REGION_SUBTRACT(pWin->drawable.pScreen,winreg,&pWin->borderSize, - &pWin->winSize); - REGION_INTERSECT(pWin->drawable.pScreen,winreg,winreg, - &pWin->borderClip); - /* add window interior excluding children */ - REGION_UNION(pWin->drawable.pScreen,winreg,winreg, - &pWin->clipList); -} - -static int -xxUpdateRegion(WindowPtr pWin, pointer unused) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - xxScrPriv(pScreen); - ColormapPtr pmap = (pointer) -1; - RegionRec winreg, rgni; - - if (pScrPriv->myDepth == pWin->drawable.depth) { - xxCmapPrivPtr pCmapPriv = (pointer)-1; - xxGetWindowRegion(pWin,&winreg); - - if (pScrPriv->colormapDirty) { - - pmap = (ColormapPtr)LookupIDByType(wColormap(pWin),RT_COLORMAP); - if (!pmap) - goto CONTINUE; /* return ? */ - - pCmapPriv = xxGetCmapPriv(pmap); - if (pCmapPriv == (pointer) -1) - return WT_WALKCHILDREN; - if (!pCmapPriv->dirty) - goto CONTINUE; - - REGION_NULL (pScreen, &rgni); - /* This will be taken care of when damaged regions are updated */ - REGION_SUBTRACT(pScreen, &rgni, &winreg, &pScrPriv->region); - if (REGION_NOTEMPTY (pScreen,&rgni)) - xxUpdateCmapPseudocolorRegion(pScreen,&rgni, pCmapPriv); - } - CONTINUE: - - REGION_NULL (pScreen, &rgni); - REGION_INTERSECT (pScreen, &rgni, &winreg, &pScrPriv->region); - - if (REGION_NOTEMPTY (pScreen,&rgni)) { - if (pmap == (pointer) -1) { - pmap = - (ColormapPtr)LookupIDByType(wColormap(pWin),RT_COLORMAP); - if (!pmap) /* return ? */ - pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, - RT_COLORMAP); - pCmapPriv = xxGetCmapPriv(pmap); - } - - if (pCmapPriv != (pointer)-1) - xxCopyPseudocolorRegion(pScreen,&rgni, pCmapPriv); - REGION_SUBTRACT(pScreen, &pScrPriv->region, &pScrPriv->region, - &rgni); - } -#if 1 - REGION_UNINIT(pScreen,&rgni); - REGION_UNINIT(pScreen,&winreg); -#endif - } - return WT_WALKCHILDREN; -} - - -static void -xxUpdateFb(ScreenPtr pScreen) -{ - xxScrPriv(pScreen); - - DBG("Update FB\n"); - PRINT_RECTS(pScrPriv->region); - - if (pScrPriv->sync) - pScrPriv->sync(pScreen); /*@!@*/ - - WalkTree(pScreen,xxUpdateRegion,NULL); -#if 0 - if (REGION_NOTEMPTY (pScreen,&pScrPriv->region)) { - ColormapPtr pmap = (pointer) -1; - xxCmapPrivPtr pCmapPriv; - - pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, - RT_COLORMAP); - pCmapPriv = xxGetCmapPriv(pmap); - if (pCmapPriv != (pointer)-1) - xxCopyPseudocolorRegion(pScreen,&pScrPriv->region, pCmapPriv); - REGION_SUBTRACT(pScreen, &pScrPriv->region, &pScrPriv->region, - &pScrPriv->region); - } -#endif - if (pScrPriv->colormapDirty) { - xxCmapPrivPtr pCmap = pScrPriv->Cmaps; - - while (pCmap) { - int j; - - if (pCmap->dirty) { - for (j = 0; j < (1 << pScrPriv->myDepth); j++) - pCmap->cmap[j] &= ~MARK_DIRTY; - pCmap->dirty = FALSE; - } - pCmap = pCmap->next; - } - pScrPriv->colormapDirty = FALSE; - } -} - -static void -xxBlockHandler (pointer data, - OSTimePtr pTimeout, - pointer pRead) -{ - ScreenPtr pScreen = (ScreenPtr) data; - xxScrPriv(pScreen); - - if (REGION_NOTEMPTY (pScreen,&pScrPriv->region) || pScrPriv->colormapDirty) - xxUpdateFb (pScreen); -} - -static void -xxWakeupHandler (pointer data, int i, pointer LastSelectMask) -{ -} - -Bool -xxSetup(ScreenPtr pScreen, int myDepth, int baseDepth, char* addr, xxSyncFunc sync) -{ - xxScrPrivPtr pScrPriv; - DepthPtr pDepths; - ColormapPtr pDefMap; - int i,j,k; - -#ifdef RENDER - PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); -#endif - - if (xxGeneration != serverGeneration) { - xxScrPrivateIndex = AllocateScreenPrivateIndex (); - if (xxScrPrivateIndex == -1) - return FALSE; - xxColormapPrivateIndex - = AllocateColormapPrivateIndex (xxInitColormapDummy); - if (xxColormapPrivateIndex == -1) - return FALSE; - xxGCPrivateIndex = AllocateGCPrivateIndex (); - if (xxGCPrivateIndex == -1) - return FALSE; - xxGeneration = serverGeneration; - } - - if (!AllocateGCPrivate (pScreen, xxGCPrivateIndex, sizeof (xxGCPrivRec))) - return FALSE; - - pScrPriv = (xxScrPrivPtr) xalloc (sizeof (xxScrPrivRec)); - if (!pScrPriv) - return FALSE; - - if (baseDepth) - pScrPriv->depth = baseDepth; - else { - pDepths = pScreen->allowedDepths; - for (i = 0; i < pScreen->numDepths; i++, pDepths++) - if (pDepths->depth != myDepth) - pScrPriv->depth = pDepths->depth; - } - if (!pScrPriv->depth) - return FALSE; - - pDepths = pScreen->allowedDepths; - for (i = 0; i < pScreen->numDepths; i++, pDepths++) - if (pDepths->depth == pScrPriv->depth) { - for (j = 0; i < pDepths->numVids; j++) { - for (k = 0; k < pScreen->numVisuals; k++) { - if (pScreen->visuals[k].vid - == pDepths[i].vids[j] - && pScreen->visuals[k].class == TrueColor) { - pScrPriv->bVisual = &pScreen->visuals[k]; - goto DONE; - } - } - } - } - - DONE: - if (!pScrPriv->bVisual) - return FALSE; - - pScrPriv->myDepth = myDepth; - pScrPriv->numInstalledColormaps = 0; - pScrPriv->colormapDirty = FALSE; - pScrPriv->Cmaps = NULL; - pScrPriv->sync = sync; - - pScreen->maxInstalledCmaps += MAX_NUM_XX_INSTALLED_CMAPS; - pScrPriv->InstalledCmaps = xcalloc(MAX_NUM_XX_INSTALLED_CMAPS, - sizeof(ColormapPtr)); - if (!pScrPriv->InstalledCmaps) - return FALSE; - - - if (!RegisterBlockAndWakeupHandlers (xxBlockHandler, - xxWakeupHandler, - (pointer) pScreen)) - return FALSE; - - wrap (pScrPriv, pScreen, CloseScreen, xxCloseScreen); - wrap (pScrPriv, pScreen, CreateScreenResources, xxCreateScreenResources); - wrap (pScrPriv, pScreen, CreateWindow, xxCreateWindow); - wrap (pScrPriv, pScreen, CopyWindow, xxCopyWindow); - wrap (pScrPriv, pScreen, PaintWindowBorder, xxPaintWindow); - wrap (pScrPriv, pScreen, PaintWindowBackground, xxPaintWindow); -#if 0 /* can we leave this out even with backing store enabled ? */ - wrap (pScrPriv, pScreen, WindowExposures, xxWindowExposures); -#endif - wrap (pScrPriv, pScreen, CreateGC, xxCreateGC); - wrap (pScrPriv, pScreen, CreateColormap, xxCreateColormap); - wrap (pScrPriv, pScreen, DestroyColormap, xxDestroyColormap); - wrap (pScrPriv, pScreen, InstallColormap, xxInstallColormap); - wrap (pScrPriv, pScreen, UninstallColormap, xxUninstallColormap); - wrap (pScrPriv, pScreen, ListInstalledColormaps, xxListInstalledColormaps); - wrap (pScrPriv, pScreen, StoreColors, xxStoreColors); -#ifdef RENDER - if (ps) { - wrap (pScrPriv, ps, Glyphs, xxGlyphs); - wrap (pScrPriv, ps, Composite, xxComposite); - } -#endif - pScrPriv->addr = addr; - pScreen->devPrivates[xxScrPrivateIndex].ptr = (pointer) pScrPriv; - - pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP); - if (!xxInitColormapPrivate(pDefMap)) - return FALSE; - - return TRUE; -} - -GCFuncs xxGCFuncs = { - xxValidateGC, xxChangeGC, xxCopyGC, xxDestroyGC, - xxChangeClip, xxDestroyClip, xxCopyClip -}; - -GCOps xxGCOps = { - xxFillSpans, xxSetSpans, - xxPutImage, xxCopyArea, - xxCopyPlane, xxPolyPoint, - xxPolylines, xxPolySegment, - xxPolyRectangle, xxPolyArc, - xxFillPolygon, xxPolyFillRect, - xxPolyFillArc, xxPolyText8, - xxPolyText16, xxImageText8, - xxImageText16, xxImageGlyphBlt, - xxPolyGlyphBlt, xxPushPixels, -#ifdef NEED_LINEHELPER - NULL, -#endif - {NULL} /* devPrivate */ -}; - -#define IS_VISIBLE(pDraw) (pDraw->type == DRAWABLE_WINDOW \ - && (fbGetWindowPixmap((WindowPtr) pDraw) == pScrPriv->pPixmap)) - -#define TRANSLATE_BOX(box, pDraw) { \ - box.x1 += pDraw->x; \ - box.x2 += pDraw->x; \ - box.y1 += pDraw->y; \ - box.y2 += pDraw->y; \ - } - -#define TRIM_BOX(box, pGC) { \ - BoxPtr extents = &pGC->pCompositeClip->extents;\ - if(box.x1 < extents->x1) box.x1 = extents->x1; \ - if(box.x2 > extents->x2) box.x2 = extents->x2; \ - if(box.y1 < extents->y1) box.y1 = extents->y1; \ - if(box.y2 > extents->y2) box.y2 = extents->y2; \ - } - -#define BOX_NOT_EMPTY(box) \ - (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0)) - - -#define _ADD_BOX(box,pGC) {\ - if (BOX_NOT_EMPTY(box)) { \ - RegionRec region; \ - ScreenPtr pScreen = pGC->pScreen;\ - REGION_INIT (pScreen, ®ion, &box, 1); \ - REGION_INTERSECT(pScreen,®ion,®ion,\ - (pGC)->pCompositeClip);\ - if (REGION_NOTEMPTY(pScreen,®ion)) { \ - xxScrPriv(pScreen);\ - PRINT_RECTS(pScrPriv->region);\ - REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,®ion);\ - PRINT_RECTS(pScrPriv->region);\ - REGION_UNINIT(pScreen,®ion);\ - }\ - }\ -} - -#define TRANSLATE_AND_ADD_BOX(box,pGC) {\ - TRANSLATE_BOX(box,pDraw); \ - TRIM_BOX(box,pGC); \ - _ADD_BOX(box,pGC); \ -} - -#define ADD_BOX(box,pGC) { \ - TRIM_BOX(box,pGC); \ - _ADD_BOX(box,pGC); \ -} - -#define XX_GC_FUNC_PROLOGUE(pGC) \ - xxGCPriv(pGC); \ - unwrap(pGCPriv, pGC, funcs); \ - if (pGCPriv->ops) unwrap(pGCPriv, pGC, ops) - -#define XX_GC_FUNC_EPILOGUE(pGC) \ - wrap(pGCPriv, pGC, funcs, &xxGCFuncs); \ - if (pGCPriv->ops) wrap(pGCPriv, pGC, ops, &xxGCOps) - -static Bool -xxCreateGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - xxScrPriv(pScreen); - xxGCPriv(pGC); - Bool ret; - - unwrap (pScrPriv, pScreen, CreateGC); - if((ret = (*pScreen->CreateGC) (pGC))) { - pGCPriv->ops = NULL; - pGCPriv->funcs = pGC->funcs; - pGC->funcs = &xxGCFuncs; - } - wrap (pScrPriv, pScreen, CreateGC, xxCreateGC); - - return ret; -} - -static void -xxValidateGC( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDraw -){ - XX_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->ValidateGC)(pGC, changes, pDraw); - if(pDraw->type == DRAWABLE_WINDOW) - pGCPriv->ops = pGC->ops; /* just so it's not NULL */ - else - pGCPriv->ops = NULL; - XX_GC_FUNC_EPILOGUE (pGC); -} - -static void -xxDestroyGC(GCPtr pGC) -{ - XX_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->DestroyGC)(pGC); - XX_GC_FUNC_EPILOGUE (pGC); -} - -static void -xxChangeGC ( - GCPtr pGC, - unsigned long mask -){ - XX_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->ChangeGC) (pGC, mask); - XX_GC_FUNC_EPILOGUE (pGC); -} - -static void -xxCopyGC ( - GCPtr pGCSrc, - unsigned long mask, - GCPtr pGCDst -){ - XX_GC_FUNC_PROLOGUE (pGCDst); - (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); - XX_GC_FUNC_EPILOGUE (pGCDst); -} - -static void -xxChangeClip ( - GCPtr pGC, - int type, - pointer pvalue, - int nrects -){ - XX_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); - XX_GC_FUNC_EPILOGUE (pGC); -} - -static void -xxCopyClip(GCPtr pgcDst, GCPtr pgcSrc) -{ - XX_GC_FUNC_PROLOGUE (pgcDst); - (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); - XX_GC_FUNC_EPILOGUE (pgcDst); -} - -static void -xxDestroyClip(GCPtr pGC) -{ - XX_GC_FUNC_PROLOGUE (pGC); - (* pGC->funcs->DestroyClip)(pGC); - XX_GC_FUNC_EPILOGUE (pGC); -} - -#define XX_GC_OP_PROLOGUE(pGC,pDraw) \ - xxScrPriv(pDraw->pScreen); \ - xxGCPriv(pGC); \ - GCFuncs *oldFuncs = pGC->funcs; \ - unwrap(pGCPriv, pGC, funcs); \ - unwrap(pGCPriv, pGC, ops); \ - -#define XX_GC_OP_EPILOGUE(pGC,pDraw) \ - wrap(pGCPriv, pGC, funcs, oldFuncs); \ - wrap(pGCPriv, pGC, ops, &xxGCOps) - -static void -xxFillSpans( - DrawablePtr pDraw, - GC *pGC, - int nInit, - DDXPointPtr pptInit, - int *pwidthInit, - int fSorted -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && nInit) { - DDXPointPtr ppt = pptInit; - int *pwidth = pwidthInit; - int i = nInit; - BoxRec box; - - DBG("FillSpans\n"); - box.x1 = ppt->x; - box.x2 = box.x1 + *pwidth; - box.y2 = box.y1 = ppt->y; - - while(--i) { - ppt++; - pwidthInit++; - if(box.x1 > ppt->x) box.x1 = ppt->x; - if(box.x2 < (ppt->x + *pwidth)) - box.x2 = ppt->x + *pwidth; - if(box.y1 > ppt->y) box.y1 = ppt->y; - else if(box.y2 < ppt->y) box.y2 = ppt->y; - } - - box.y2++; - - (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - - - TRANSLATE_AND_ADD_BOX(box, pGC); - } else - (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - - XX_GC_OP_EPILOGUE(pGC, pDraw); -} - -static void -xxSetSpans( - DrawablePtr pDraw, - GCPtr pGC, - char *pcharsrc, - DDXPointPtr pptInit, - int *pwidthInit, - int nspans, - int fSorted -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && nspans) { - DDXPointPtr ppt = pptInit; - int *pwidth = pwidthInit; - int i = nspans; - BoxRec box; - - DBG("SetSpans\n"); - box.x1 = ppt->x; - box.x2 = box.x1 + *pwidth; - box.y2 = box.y1 = ppt->y; - - while(--i) { - ppt++; - pwidth++; - if(box.x1 > ppt->x) box.x1 = ppt->x; - if(box.x2 < (ppt->x + *pwidth)) - box.x2 = ppt->x + *pwidth; - if(box.y1 > ppt->y) box.y1 = ppt->y; - else if(box.y2 < ppt->y) box.y2 = ppt->y; - } - - box.y2++; - - (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, - pwidthInit, nspans, fSorted); - - TRANSLATE_AND_ADD_BOX(box, pGC); - } else - (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, - pwidthInit, nspans, fSorted); - - XX_GC_OP_EPILOGUE(pGC, pDraw); -} - -static void -xxPutImage( - DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, - int format, - char *pImage -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); - XX_GC_OP_EPILOGUE(pGC, pDraw); - if(IS_VISIBLE(pDraw)) { - BoxRec box; - - DBG("PutImage\n"); - box.x1 = x + pDraw->x; - box.x2 = box.x1 + w; - box.y1 = y + pDraw->y; - box.y2 = box.y1 + h; - - ADD_BOX(box, pGC); - } -} - -static RegionPtr -xxCopyArea( - DrawablePtr pSrc, - DrawablePtr pDst, - GC *pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty -){ - RegionPtr ret; - XX_GC_OP_PROLOGUE(pGC, pDst); - DBG("xxCopyArea\n"); - ret = (*pGC->ops->CopyArea)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty); - XX_GC_OP_EPILOGUE(pGC, pDst); - - if(IS_VISIBLE(pDst)) { - BoxRec box; - - DBG("CopyArea\n"); - box.x1 = dstx + pDst->x; - box.x2 = box.x1 + width; - box.y1 = dsty + pDst->y; - box.y2 = box.y1 + height; - - ADD_BOX(box, pGC); - } - - return ret; -} - -static RegionPtr -xxCopyPlane( - DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - unsigned long bitPlane -){ - RegionPtr ret; - XX_GC_OP_PROLOGUE(pGC, pDst); - ret = (*pGC->ops->CopyPlane)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - XX_GC_OP_EPILOGUE(pGC, pDst); - - if(IS_VISIBLE(pDst)) { - BoxRec box; - - DBG("CopyPlane\n"); - box.x1 = dstx + pDst->x; - box.x2 = box.x1 + width; - box.y1 = dsty + pDst->y; - box.y2 = box.y1 + height; - - ADD_BOX(box, pGC); - } - - return ret; -} - -static void -xxPolyPoint( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - xPoint *pptInit -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && npt) { - BoxRec box; - - DBG("PolyPoint\n"); - box.x2 = box.x1 = pptInit->x; - box.y2 = box.y1 = pptInit->y; - - /* this could be slow if the points were spread out */ - - while(--npt) { - pptInit++; - if(box.x1 > pptInit->x) box.x1 = pptInit->x; - else if(box.x2 < pptInit->x) box.x2 = pptInit->x; - if(box.y1 > pptInit->y) box.y1 = pptInit->y; - else if(box.y2 < pptInit->y) box.y2 = pptInit->y; - } - - box.x2++; - box.y2++; - - TRANSLATE_AND_ADD_BOX(box, pGC); - } -} - -static void -xxPolylines( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - DDXPointPtr pptInit -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - - if(IS_VISIBLE(pDraw) && npt) { - BoxRec box; - int extra = pGC->lineWidth >> 1; - - DBG("PolyLine\n"); - box.x2 = box.x1 = pptInit->x; - box.y2 = box.y1 = pptInit->y; - - if(npt > 1) { - if(pGC->joinStyle == JoinMiter) - extra = 6 * pGC->lineWidth; - else if(pGC->capStyle == CapProjecting) - extra = pGC->lineWidth; - } - - if(mode == CoordModePrevious) { - int x = box.x1; - int y = box.y1; - while(--npt) { - pptInit++; - x += pptInit->x; - y += pptInit->y; - if(box.x1 > x) box.x1 = x; - else if(box.x2 < x) box.x2 = x; - if(box.y1 > y) box.y1 = y; - else if(box.y2 < y) box.y2 = y; - } - } else { - while(--npt) { - pptInit++; - if(box.x1 > pptInit->x) box.x1 = pptInit->x; - else if(box.x2 < pptInit->x) box.x2 = pptInit->x; - if(box.y1 > pptInit->y) box.y1 = pptInit->y; - else if(box.y2 < pptInit->y) box.y2 = pptInit->y; - } - } - - box.x2++; - box.y2++; - - if(extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - TRANSLATE_AND_ADD_BOX(box, pGC); - } -} - -static void -xxPolySegment( - DrawablePtr pDraw, - GCPtr pGC, - int nseg, - xSegment *pSeg - ){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && nseg) { - BoxRec box; - int extra = pGC->lineWidth; - - DBG("PolySegment\n"); - if(pGC->capStyle != CapProjecting) - extra >>= 1; - - if(pSeg->x2 > pSeg->x1) { - box.x1 = pSeg->x1; - box.x2 = pSeg->x2; - } else { - box.x2 = pSeg->x1; - box.x1 = pSeg->x2; - } - - if(pSeg->y2 > pSeg->y1) { - box.y1 = pSeg->y1; - box.y2 = pSeg->y2; - } else { - box.y2 = pSeg->y1; - box.y1 = pSeg->y2; - } - - while(--nseg) { - pSeg++; - if(pSeg->x2 > pSeg->x1) { - if(pSeg->x1 < box.x1) box.x1 = pSeg->x1; - if(pSeg->x2 > box.x2) box.x2 = pSeg->x2; - } else { - if(pSeg->x2 < box.x1) box.x1 = pSeg->x2; - if(pSeg->x1 > box.x2) box.x2 = pSeg->x1; - } - if(pSeg->y2 > pSeg->y1) { - if(pSeg->y1 < box.y1) box.y1 = pSeg->y1; - if(pSeg->y2 > box.y2) box.y2 = pSeg->y2; - } else { - if(pSeg->y2 < box.y1) box.y1 = pSeg->y2; - if(pSeg->y1 > box.y2) box.y2 = pSeg->y1; - } - } - - box.x2++; - box.y2++; - - if(extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - TRANSLATE_AND_ADD_BOX(box, pGC); - } -} - -static void -xxPolyRectangle( - DrawablePtr pDraw, - GCPtr pGC, - int nRects, - xRectangle *pRects -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyRectangle)(pDraw, pGC, nRects, pRects); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && nRects) - { - BoxRec box; - int offset1, offset2, offset3; - - DBG("PolyRectangle\n"); - offset2 = pGC->lineWidth; - if(!offset2) offset2 = 1; - offset1 = offset2 >> 1; - offset3 = offset2 - offset1; - - while(nRects--) - { - box.x1 = pRects->x - offset1; - box.y1 = pRects->y - offset1; - box.x2 = box.x1 + pRects->width + offset2; - box.y2 = box.y1 + offset2; - TRANSLATE_AND_ADD_BOX(box, pGC); - box.x1 = pRects->x - offset1; - box.y1 = pRects->y + offset3; - box.x2 = box.x1 + offset2; - box.y2 = box.y1 + pRects->height - offset2; - TRANSLATE_AND_ADD_BOX(box, pGC); - box.x1 = pRects->x + pRects->width - offset1; - box.y1 = pRects->y + offset3; - box.x2 = box.x1 + offset2; - box.y2 = box.y1 + pRects->height - offset2; - TRANSLATE_AND_ADD_BOX(box, pGC); - box.x1 = pRects->x - offset1; - box.y1 = pRects->y + pRects->height - offset1; - box.x2 = box.x1 + pRects->width + offset2; - box.y2 = box.y1 + offset2; - TRANSLATE_AND_ADD_BOX(box, pGC); - - pRects++; - } - } -} - -static void -xxPolyArc( - DrawablePtr pDraw, - GCPtr pGC, - int narcs, - xArc *parcs -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && narcs) { - int extra = pGC->lineWidth >> 1; - BoxRec box; - - DBG("PolyArc\n"); - box.x1 = parcs->x; - box.x2 = box.x1 + parcs->width; - box.y1 = parcs->y; - box.y2 = box.y1 + parcs->height; - - /* should I break these up instead ? */ - - while(--narcs) { - parcs++; - if(box.x1 > parcs->x) box.x1 = parcs->x; - if(box.x2 < (parcs->x + parcs->width)) - box.x2 = parcs->x + parcs->width; - if(box.y1 > parcs->y) box.y1 = parcs->y; - if(box.y2 < (parcs->y + parcs->height)) - box.y2 = parcs->y + parcs->height; - } - - if(extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - box.x2++; - box.y2++; - - TRANSLATE_AND_ADD_BOX(box, pGC); - } -} - -static void -xxFillPolygon( - DrawablePtr pDraw, - GCPtr pGC, - int shape, - int mode, - int count, - DDXPointPtr pptInit -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && (count > 2)) { - DDXPointPtr ppt = pptInit; - int i = count; - BoxRec box; - - DBG("FillPolygon\n"); - box.x2 = box.x1 = ppt->x; - box.y2 = box.y1 = ppt->y; - - if(mode != CoordModeOrigin) { - int x = box.x1; - int y = box.y1; - while(--i) { - ppt++; - x += ppt->x; - y += ppt->y; - if(box.x1 > x) box.x1 = x; - else if(box.x2 < x) box.x2 = x; - if(box.y1 > y) box.y1 = y; - else if(box.y2 < y) box.y2 = y; - } - } else { - while(--i) { - ppt++; - if(box.x1 > ppt->x) box.x1 = ppt->x; - else if(box.x2 < ppt->x) box.x2 = ppt->x; - if(box.y1 > ppt->y) box.y1 = ppt->y; - else if(box.y2 < ppt->y) box.y2 = ppt->y; - } - } - - box.x2++; - box.y2++; - - (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit); - - TRANSLATE_AND_ADD_BOX(box, pGC); - } else - (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit); - - XX_GC_OP_EPILOGUE(pGC, pDraw); -} - -static void -xxPolyFillRect( - DrawablePtr pDraw, - GCPtr pGC, - int nRectsInit, - xRectangle *pRectsInit -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && nRectsInit) { - BoxRec box; - xRectangle *pRects = pRectsInit; - int nRects = nRectsInit; - - DBG("PolyFillRect\n"); - box.x1 = pRects->x; - box.x2 = box.x1 + pRects->width; - box.y1 = pRects->y; - box.y2 = box.y1 + pRects->height; - - while(--nRects) { - pRects++; - if(box.x1 > pRects->x) box.x1 = pRects->x; - if(box.x2 < (pRects->x + pRects->width)) - box.x2 = pRects->x + pRects->width; - if(box.y1 > pRects->y) box.y1 = pRects->y; - if(box.y2 < (pRects->y + pRects->height)) - box.y2 = pRects->y + pRects->height; - } - - /* cfb messes with the pRectsInit so we have to do our - calculations first */ - - (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit); - - TRANSLATE_AND_ADD_BOX(box, pGC); - } else - (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit); - - XX_GC_OP_EPILOGUE(pGC, pDraw); -} - -static void -xxPolyFillArc( - DrawablePtr pDraw, - GCPtr pGC, - int narcs, - xArc *parcs -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && narcs) { - BoxRec box; - - DBG("PolyFillArc\n"); - box.x1 = parcs->x; - box.x2 = box.x1 + parcs->width; - box.y1 = parcs->y; - box.y2 = box.y1 + parcs->height; - - /* should I break these up instead ? */ - - while(--narcs) { - parcs++; - if(box.x1 > parcs->x) box.x1 = parcs->x; - if(box.x2 < (parcs->x + parcs->width)) - box.x2 = parcs->x + parcs->width; - if(box.y1 > parcs->y) box.y1 = parcs->y; - if(box.y2 < (parcs->y + parcs->height)) - box.y2 = parcs->y + parcs->height; - } - - TRANSLATE_AND_ADD_BOX(box, pGC); - } -} - -static int -xxPolyText8( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - char *chars -){ - int width; - - XX_GC_OP_PROLOGUE(pGC, pDraw); - width = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - width -= x; - - if(IS_VISIBLE(pDraw) && (width > 0)) { - BoxRec box; - - DBG("PolyText8\n"); - /* ugh */ - box.x1 = pDraw->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - if(count > 1) { - if(width > 0) box.x2 += width; - else box.x1 += width; - } - - box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent); - - ADD_BOX(box, pGC); - } - - return (width + x); -} - -static int -xxPolyText16( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *chars -){ - int width; - - XX_GC_OP_PROLOGUE(pGC, pDraw); - width = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - width -= x; - - if(IS_VISIBLE(pDraw) && (width > 0)) { - BoxRec box; - - DBG("PolyText16\n"); - /* ugh */ - box.x1 = pDraw->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - if(count > 1) { - if(width > 0) box.x2 += width; - else box.x1 += width; - } - - box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent); - - ADD_BOX(box, pGC); - } - - return (width + x); -} - -static void -xxImageText8( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - char *chars -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && count) { - int top, bot, Min, Max; - BoxRec box; - - DBG("ImageText8\n"); - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - Min = count * FONTMINBOUNDS(pGC->font, characterWidth); - if(Min > 0) Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); - if(Max < 0) Max = 0; - - /* ugh */ - box.x1 = pDraw->x + x + Min + - FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + Max + - FONTMAXBOUNDS(pGC->font, rightSideBearing); - - box.y1 = pDraw->y + y - top; - box.y2 = pDraw->y + y + bot; - - ADD_BOX(box, pGC); - } -} - -static void -xxImageText16( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *chars -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && count) { - int top, bot, Min, Max; - BoxRec box; - - DBG("ImageText16\n"); - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - Min = count * FONTMINBOUNDS(pGC->font, characterWidth); - if(Min > 0) Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); - if(Max < 0) Max = 0; - - /* ugh */ - box.x1 = pDraw->x + x + Min + - FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + Max + - FONTMAXBOUNDS(pGC->font, rightSideBearing); - - box.y1 = pDraw->y + y - top; - box.y2 = pDraw->y + y + bot; - - ADD_BOX(box, pGC); - } -} - -static void -xxImageGlyphBlt( - DrawablePtr pDraw, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyph, - ppci, pglyphBase); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && nglyph) { - int top, bot, width = 0; - BoxRec box; - - DBG("ImageGlyphBlt\n"); - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - box.x1 = ppci[0]->metrics.leftSideBearing; - if(box.x1 > 0) box.x1 = 0; - box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing - - ppci[nglyph - 1]->metrics.characterWidth; - if(box.x2 < 0) box.x2 = 0; - - box.x2 += pDraw->x + x; - box.x1 += pDraw->x + x; - - while(nglyph--) { - width += (*ppci)->metrics.characterWidth; - ppci++; - } - - if(width > 0) - box.x2 += width; - else - box.x1 += width; - - box.y1 = pDraw->y + y - top; - box.y2 = pDraw->y + y + bot; - - ADD_BOX(box, pGC); - } -} - -static void -xxPolyGlyphBlt( - DrawablePtr pDraw, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyph, - ppci, pglyphBase); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw) && nglyph) { - BoxRec box; - - DBG("PolyGlyphBlt\n"); - /* ugh */ - box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing; - box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing; - - if(nglyph > 1) { - int width = 0; - - while(--nglyph) { - width += (*ppci)->metrics.characterWidth; - ppci++; - } - - if(width > 0) box.x2 += width; - else box.x1 += width; - } - - box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent); - - ADD_BOX(box, pGC); - } -} - -static void -xxPushPixels( - GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, - int dx, int dy, int xOrg, int yOrg -){ - XX_GC_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - XX_GC_OP_EPILOGUE(pGC, pDraw); - - if(IS_VISIBLE(pDraw)) { - BoxRec box; - - DBG("PushPixels\n"); - box.x1 = xOrg + pDraw->x; - box.x2 = box.x1 + dx; - box.y1 = yOrg + pDraw->y; - box.y2 = box.y1 + dy; - - ADD_BOX(box, pGC); - } -} - - -#ifdef RENDER -#define RENDER_MAKE_BOX(pDrawable,X,Y,W,H) { \ - box.x1 = X + pDrawable->x; \ - box.x2 = X + pDrawable->x + W; \ - box.y1 = Y + pDrawable->y; \ - box.y2 = Y + pDrawable->y + H; \ -} - -#define RENDER_ADD_BOX(pScreen,box) {\ - if (BOX_NOT_EMPTY(box)) { \ - RegionRec region; \ - xxScrPriv(pScreen);\ - ScreenPtr pScreen = pScreen;\ - REGION_INIT (pScreen, ®ion, &box, 1); \ - PRINT_RECTS(pScrPriv->region);\ - REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,®ion);\ - PRINT_RECTS(pScrPriv->region);\ - REGION_UNINIT(pScreen,®ion);\ - }\ -} - -static void -xxComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, - INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen(pScreen); - xxScrPriv(pScreen); - BoxRec box; - - unwrap (pScrPriv, ps, Composite); - (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, - xDst, yDst, width, height); - wrap (pScrPriv, ps, Composite, xxComposite); - if (pDst->pDrawable->type == DRAWABLE_WINDOW) { - RENDER_MAKE_BOX(pDst->pDrawable, xDst, yDst, width, height); - RENDER_ADD_BOX(pScreen,box); - } -} - - -static void -xxGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, - GlyphListPtr list, GlyphPtr *glyphs) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen(pScreen); - xxScrPriv(pScreen); - int x, y; - int n; - GlyphPtr glyph; - BoxRec box; - - unwrap (pScrPriv, ps, Glyphs); - (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, - nlist, list, glyphs); - wrap (pScrPriv, ps, Glyphs, xxGlyphs); - if (pDst->pDrawable->type == DRAWABLE_WINDOW) - { - x = xSrc; - y = ySrc; - while (nlist--) - { - x += list->xOff; - y += list->yOff; - n = list->len; - while (n--) - { - glyph = *glyphs++; - RENDER_MAKE_BOX(pDst->pDrawable, - x - glyph->info.x, y - glyph->info.y, - glyph->info.width, glyph->info.height); - RENDER_ADD_BOX(pScreen,box); - x += glyph->info.xOff; - y += glyph->info.yOff; - } - list++; - } - } -} -#endif - -void -xxPrintVisuals(void) -{ - int k,i,j; - DepthPtr pDepth; - VisualPtr pVisual; - - for (k = 0; k < screenInfo.numScreens; k++) { - ScreenPtr pScreen = screenInfo.screens[k]; - - pDepth = pScreen->allowedDepths; - for (i = 0; i < pScreen->numDepths; i++, pDepth++) - for (j = 0; j < pDepth->numVids; j++) { - ErrorF("depth: %i vid: 0x%lx\n", - pDepth->depth, pDepth->vids[j]); - } - - pVisual = pScreen->visuals; - for (i = 0; i < pScreen->numVisuals; i++, pVisual++) - ErrorF("vid: 0x%x rm: 0x%lx gm: 0x%lx bm: 0x%lx\n", - (unsigned int)pVisual->vid, - pVisual->redMask, - pVisual->greenMask, - pVisual->blueMask); - } -} - - diff --git a/nx-X11/programs/Xserver/fb/fbpseudocolor.h b/nx-X11/programs/Xserver/fb/fbpseudocolor.h deleted file mode 100644 index 64de71db8..000000000 --- a/nx-X11/programs/Xserver/fb/fbpseudocolor.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _FB_XX_H_ -# define _FB_XX_H_ - -typedef void (*xxSyncFunc)(ScreenPtr); -extern Bool xxSetup(ScreenPtr pScreen, int myDepth, - int baseDepth, char *addr, xxSyncFunc sync); -extern void xxPrintVisuals(void); - - -#endif /* _FB_XX_H_ */ - - - - - - - - - - diff --git a/nx-X11/programs/Xserver/fb/fbpush.c b/nx-X11/programs/Xserver/fb/fbpush.c index 8f1336963..6979b6f1b 100644 --- a/nx-X11/programs/Xserver/fb/fbpush.c +++ b/nx-X11/programs/Xserver/fb/fbpush.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbpush.c,v 1.3 2000/02/14 19:20:30 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -192,8 +191,8 @@ fbPushImage (DrawablePtr pDrawable, BoxPtr pbox; int x1, y1, x2, y2; - for (nbox = REGION_NUM_RECTS (pClip), - pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects (pClip), + pbox = RegionRects(pClip); nbox--; pbox++) { @@ -237,7 +236,7 @@ fbPushPixels (GCPtr pGC, FbStip *stip; FbStride stipStride; int stipBpp; - int stipXoff, stipYoff; /* Assumed to be zero */ + _X_UNUSED int stipXoff, stipYoff; /* Assumed to be zero */ fbGetStipDrawable (&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); diff --git a/nx-X11/programs/Xserver/fb/fbrop.h b/nx-X11/programs/Xserver/fb/fbrop.h index 65f62c393..f3768a265 100644 --- a/nx-X11/programs/Xserver/fb/fbrop.h +++ b/nx-X11/programs/Xserver/fb/fbrop.h @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbrop.h,v 1.3 2000/02/14 19:20:30 dawes Exp $ */ #ifndef _FBROP_H_ #define _FBROP_H_ diff --git a/nx-X11/programs/Xserver/fb/fbscreen.c b/nx-X11/programs/Xserver/fb/fbscreen.c index 70d3d7a13..b0e6d9a6b 100644 --- a/nx-X11/programs/Xserver/fb/fbscreen.c +++ b/nx-X11/programs/Xserver/fb/fbscreen.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbscreen.c,v 1.13 2001/05/29 04:54:09 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -30,18 +29,18 @@ #include "fb.h" Bool -fbCloseScreen (int index, ScreenPtr pScreen) +fbCloseScreen (ScreenPtr pScreen) { int d; DepthPtr depths = pScreen->allowedDepths; for (d = 0; d < pScreen->numDepths; d++) - xfree (depths[d].vids); - xfree (depths); - xfree (pScreen->visuals); - xfree (pScreen->devPrivate); + free (depths[d].vids); + free (depths); + free (pScreen->visuals); + free (pScreen->devPrivate); #ifdef FB_SCREEN_PRIVATE - xfree (pScreen->devPrivates[fbScreenPrivateIndex].ptr); + free (pScreen->devPrivates[fbScreenPrivateIndex].ptr); #endif return TRUE; } @@ -97,14 +96,14 @@ _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap) #ifdef FB_NO_WINDOW_PIXMAPS FatalError ("Attempted to set window pixmap without fb support\n"); #else - pWindow->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap; + pWindow->devPrivates[fbWinPrivateIndex].ptr = (void *) pPixmap; #endif } #endif Bool fbSetupScreen(ScreenPtr pScreen, - pointer pbits, /* pointer to screen bitmap */ + void * pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ int ysize, int dpix, /* dots per inch */ @@ -160,7 +159,7 @@ fbSetupScreen(ScreenPtr pScreen, Bool fbFinishScreenInit(ScreenPtr pScreen, - pointer pbits, + void * pbits, int xsize, int ysize, int dpix, @@ -261,7 +260,7 @@ fbFinishScreenInit(ScreenPtr pScreen, /* dts * (inch/dot) * (25.4 mm / inch) = mm */ Bool fbScreenInit(ScreenPtr pScreen, - pointer pbits, + void * pbits, int xsize, int ysize, int dpix, diff --git a/nx-X11/programs/Xserver/fb/fbseg.c b/nx-X11/programs/Xserver/fb/fbseg.c index 18a996e0c..db3240e1b 100644 --- a/nx-X11/programs/Xserver/fb/fbseg.c +++ b/nx-X11/programs/Xserver/fb/fbseg.c @@ -21,12 +21,13 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbseg.c,v 1.7 2001/01/17 07:40:02 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <stdlib.h> + #include "fb.h" #include "miline.h" @@ -615,8 +616,8 @@ fbSegment (DrawablePtr pDrawable, unsigned int oc1; /* outcode of point 1 */ unsigned int oc2; /* outcode of point 2 */ - nBox = REGION_NUM_RECTS (pClip); - pBox = REGION_RECTS (pClip); + nBox = RegionNumRects (pClip); + pBox = RegionRects (pClip); bres = fbSelectBres (pDrawable, pGC); diff --git a/nx-X11/programs/Xserver/fb/fbsetsp.c b/nx-X11/programs/Xserver/fb/fbsetsp.c index eefc2da82..4b3db1eda 100644 --- a/nx-X11/programs/Xserver/fb/fbsetsp.c +++ b/nx-X11/programs/Xserver/fb/fbsetsp.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbsetsp.c,v 1.4 2000/05/06 21:09:34 keithp Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -63,8 +62,8 @@ fbSetSpans (DrawablePtr pDrawable, xoff = (int) (((long) src) & (FB_MASK >> 3)); s = (FbBits *) (src - xoff); xoff <<= 3; - n = REGION_NUM_RECTS(pClip); - pbox = REGION_RECTS (pClip); + n = RegionNumRects(pClip); + pbox = RegionRects (pClip); while (n--) { if (pbox->y1 > ppt->y) diff --git a/nx-X11/programs/Xserver/fb/fbsolid.c b/nx-X11/programs/Xserver/fb/fbsolid.c index 89effe63b..99e479f49 100644 --- a/nx-X11/programs/Xserver/fb/fbsolid.c +++ b/nx-X11/programs/Xserver/fb/fbsolid.c @@ -1,6 +1,4 @@ /* - * $XFree86$ - * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its diff --git a/nx-X11/programs/Xserver/fb/fbstipple.c b/nx-X11/programs/Xserver/fb/fbstipple.c index 44aa5f331..486fa2030 100644 --- a/nx-X11/programs/Xserver/fb/fbstipple.c +++ b/nx-X11/programs/Xserver/fb/fbstipple.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbstipple.c,v 1.6 2000/02/23 20:29:47 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/fb/fbtile.c b/nx-X11/programs/Xserver/fb/fbtile.c index ef3242241..0d0cfe174 100644 --- a/nx-X11/programs/Xserver/fb/fbtile.c +++ b/nx-X11/programs/Xserver/fb/fbtile.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbtile.c,v 1.3 2000/02/12 03:39:43 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/fb/fbtrap.c b/nx-X11/programs/Xserver/fb/fbtrap.c index 1940bc209..c9951b00d 100644 --- a/nx-X11/programs/Xserver/fb/fbtrap.c +++ b/nx-X11/programs/Xserver/fb/fbtrap.c @@ -110,7 +110,6 @@ fbRasterizeTrapezoid (PicturePtr pPicture, int height; int pxoff, pyoff; - xFixed x_off_fixed; xFixed y_off_fixed; RenderEdge l, r; xFixed t, b; @@ -125,7 +124,6 @@ fbRasterizeTrapezoid (PicturePtr pPicture, 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) diff --git a/nx-X11/programs/Xserver/fb/fbtrap.c.NX.original b/nx-X11/programs/Xserver/fb/fbtrap.c.NX.original deleted file mode 100644 index 1940bc209..000000000 --- a/nx-X11/programs/Xserver/fb/fbtrap.c.NX.original +++ /dev/null @@ -1,242 +0,0 @@ -/* - * $Id: fbtrap.c,v 1.5 2005/07/03 07:01:23 daniels Exp $ - * - * 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 - -#include "fb.h" - -#ifdef RENDER - -#include "picturestr.h" -#include "mipict.h" -#include "renderedge.h" -#include "fbpict.h" - -void -fbAddTraps (PicturePtr pPicture, - INT16 x_off, - INT16 y_off, - int ntrap, - xTrap *traps) -{ - FbBits *buf; - int bpp; - int width; - int stride; - int height; - int pxoff, pyoff; - - xFixed x_off_fixed; - xFixed y_off_fixed; - RenderEdge l, r; - xFixed t, b; - - fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); - - 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++; - } -} - -void -fbRasterizeTrapezoid (PicturePtr pPicture, - xTrapezoid *trap, - int x_off, - int y_off) -{ - FbBits *buf; - int bpp; - int width; - int stride; - int height; - int pxoff, pyoff; - - xFixed x_off_fixed; - xFixed y_off_fixed; - RenderEdge l, r; - xFixed t, b; - - if (!xTrapezoidValid (trap)) - return; - - fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); - - 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); - - 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); - } -} - -static int -_GreaterY (xPointFixed *a, xPointFixed *b) -{ - if (a->y == b->y) - return a->x > b->x; - return a->y > b->y; -} - -/* - * Note that the definition of this function is a bit odd because - * of the X coordinate space (y increasing downwards). - */ -static int -_Clockwise (xPointFixed *ref, xPointFixed *a, xPointFixed *b) -{ - xPointFixed ad, bd; - - ad.x = a->x - ref->x; - ad.y = a->y - ref->y; - bd.x = b->x - ref->x; - bd.y = b->y - ref->y; - - return ((xFixed_32_32) bd.y * ad.x - (xFixed_32_32) ad.y * bd.x) < 0; -} - -/* FIXME -- this could be made more efficient */ -void -fbAddTriangles (PicturePtr pPicture, - INT16 x_off, - INT16 y_off, - int ntri, - xTriangle *tris) -{ - xPointFixed *top, *left, *right, *tmp; - xTrapezoid trap; - - for (; ntri; ntri--, tris++) - { - top = &tris->p1; - left = &tris->p2; - right = &tris->p3; - if (_GreaterY (top, left)) { - tmp = left; left = top; top = tmp; - } - if (_GreaterY (top, right)) { - tmp = right; right = top; top = tmp; - } - if (_Clockwise (top, right, left)) { - tmp = right; right = left; left = tmp; - } - - /* - * Two cases: - * - * + + - * / \ / \ - * / \ / \ - * / + + \ - * / -- -- \ - * / -- -- \ - * / --- --- \ - * +-- --+ - */ - - trap.top = top->y; - trap.left.p1 = *top; - trap.left.p2 = *left; - trap.right.p1 = *top; - trap.right.p2 = *right; - if (right->y < left->y) - trap.bottom = right->y; - else - trap.bottom = left->y; - fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); - if (right->y < left->y) - { - trap.top = right->y; - trap.bottom = left->y; - trap.right.p1 = *right; - trap.right.p2 = *left; - } - else - { - trap.top = left->y; - trap.bottom = right->y; - trap.left.p1 = *left; - trap.left.p2 = *right; - } - fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); - } -} - -#endif /* RENDER */ diff --git a/nx-X11/programs/Xserver/fb/fbtrap.c.X.original b/nx-X11/programs/Xserver/fb/fbtrap.c.X.original deleted file mode 100644 index 39483d8cd..000000000 --- a/nx-X11/programs/Xserver/fb/fbtrap.c.X.original +++ /dev/null @@ -1,239 +0,0 @@ -/* - * $Id: fbtrap.c,v 1.5 2005/07/03 07:01:23 daniels Exp $ - * - * 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 - -#include "fb.h" - -#ifdef RENDER - -#include "picturestr.h" -#include "mipict.h" -#include "renderedge.h" -#include "fbpict.h" - -void -fbAddTraps (PicturePtr pPicture, - INT16 x_off, - INT16 y_off, - int ntrap, - xTrap *traps) -{ - FbBits *buf; - int bpp; - int width; - int stride; - int height; - int pxoff, pyoff; - - xFixed x_off_fixed; - xFixed y_off_fixed; - RenderEdge l, r; - xFixed t, b; - - fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); - - 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++; - } -} - -void -fbRasterizeTrapezoid (PicturePtr pPicture, - xTrapezoid *trap, - int x_off, - int y_off) -{ - FbBits *buf; - int bpp; - int width; - int stride; - int height; - int pxoff, pyoff; - - xFixed x_off_fixed; - xFixed y_off_fixed; - RenderEdge l, r; - xFixed t, b; - - fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); - - 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); - - 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); - } -} - -static int -_GreaterY (xPointFixed *a, xPointFixed *b) -{ - if (a->y == b->y) - return a->x > b->x; - return a->y > b->y; -} - -/* - * Note that the definition of this function is a bit odd because - * of the X coordinate space (y increasing downwards). - */ -static int -_Clockwise (xPointFixed *ref, xPointFixed *a, xPointFixed *b) -{ - xPointFixed ad, bd; - - ad.x = a->x - ref->x; - ad.y = a->y - ref->y; - bd.x = b->x - ref->x; - bd.y = b->y - ref->y; - - return ((xFixed_32_32) bd.y * ad.x - (xFixed_32_32) ad.y * bd.x) < 0; -} - -/* FIXME -- this could be made more efficient */ -void -fbAddTriangles (PicturePtr pPicture, - INT16 x_off, - INT16 y_off, - int ntri, - xTriangle *tris) -{ - xPointFixed *top, *left, *right, *tmp; - xTrapezoid trap; - - for (; ntri; ntri--, tris++) - { - top = &tris->p1; - left = &tris->p2; - right = &tris->p3; - if (_GreaterY (top, left)) { - tmp = left; left = top; top = tmp; - } - if (_GreaterY (top, right)) { - tmp = right; right = top; top = tmp; - } - if (_Clockwise (top, right, left)) { - tmp = right; right = left; left = tmp; - } - - /* - * Two cases: - * - * + + - * / \ / \ - * / \ / \ - * / + + \ - * / -- -- \ - * / -- -- \ - * / --- --- \ - * +-- --+ - */ - - trap.top = top->y; - trap.left.p1 = *top; - trap.left.p2 = *left; - trap.right.p1 = *top; - trap.right.p2 = *right; - if (right->y < left->y) - trap.bottom = right->y; - else - trap.bottom = left->y; - fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); - if (right->y < left->y) - { - trap.top = right->y; - trap.bottom = left->y; - trap.right.p1 = *right; - trap.right.p2 = *left; - } - else - { - trap.top = left->y; - trap.bottom = right->y; - trap.left.p1 = *left; - trap.left.p2 = *right; - } - fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); - } -} - -#endif /* RENDER */ diff --git a/nx-X11/programs/Xserver/fb/fbutil.c b/nx-X11/programs/Xserver/fb/fbutil.c index 8153ab364..4be0f233c 100644 --- a/nx-X11/programs/Xserver/fb/fbutil.c +++ b/nx-X11/programs/Xserver/fb/fbutil.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbutil.c,v 1.4 2000/02/23 20:29:48 dawes Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> diff --git a/nx-X11/programs/Xserver/fb/fbwindow.c b/nx-X11/programs/Xserver/fb/fbwindow.c index 0cfefa929..c4e28de5b 100644 --- a/nx-X11/programs/Xserver/fb/fbwindow.c +++ b/nx-X11/programs/Xserver/fb/fbwindow.c @@ -1,4 +1,3 @@ -/* $XdotOrg: xc/programs/Xserver/fb/fbwindow.c,v 1.9 2005/10/02 08:28:26 anholt Exp $ */ /* * Id: fbwindow.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * @@ -22,23 +21,21 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbwindow.c,v 1.10tsi Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include <stdlib.h> + #include "fb.h" -#ifdef IN_MODULE -#include "xf86_ansic.h" -#endif Bool fbCreateWindow(WindowPtr pWin) { #ifndef FB_NO_WINDOW_PIXMAPS pWin->devPrivates[fbWinPrivateIndex].ptr = - (pointer) fbGetScreenPixmap(pWin->drawable.pScreen); + (void *) fbGetScreenPixmap(pWin->drawable.pScreen); #endif #ifdef FB_SCREEN_PRIVATE if (pWin->drawable.bitsPerPixel == 32) @@ -132,15 +129,15 @@ fbCopyWindow(WindowPtr pWin, dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + RegionTranslate(prgnSrc, -dx, -dy); - REGION_NULL (pWin->drawable.pScreen, &rgnDst); + RegionNull(&rgnDst); - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); + RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); #ifdef COMPOSITE if (pPixmap->screen_x || pPixmap->screen_y) - REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, + RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); #endif @@ -148,7 +145,7 @@ fbCopyWindow(WindowPtr pWin, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); + RegionUninit(&rgnDst); fbValidateDrawable (&pWin->drawable); } @@ -215,8 +212,8 @@ fbFillRegionSolid (DrawablePtr pDrawable, FbStride dstStride; int dstBpp; int dstXoff, dstYoff; - int n = REGION_NUM_RECTS(pRegion); - BoxPtr pbox = REGION_RECTS(pRegion); + int n = RegionNumRects(pRegion); + BoxPtr pbox = RegionRects(pRegion); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); @@ -251,10 +248,10 @@ fbFillRegionTiled (DrawablePtr pDrawable, FbBits *tile; FbStride tileStride; int tileBpp; - int tileXoff, tileYoff; /* XXX assumed to be zero */ + _X_UNUSED int tileXoff, tileYoff; /* XXX assumed to be zero */ int tileWidth, tileHeight; - int n = REGION_NUM_RECTS(pRegion); - BoxPtr pbox = REGION_RECTS(pRegion); + int n = RegionNumRects(pRegion); + BoxPtr pbox = RegionRects(pRegion); int xRot = pDrawable->x; int yRot = pDrawable->y; @@ -262,7 +259,7 @@ fbFillRegionTiled (DrawablePtr pDrawable, if(!noPanoramiXExtension) { int index = pDrawable->pScreen->myNum; - if(&WindowTable[index]->drawable == pDrawable) + if(&screenInfo.screens[index]->root->drawable == pDrawable) { xRot -= panoramiXdataPtr[index].x; yRot -= panoramiXdataPtr[index].y; diff --git a/nx-X11/programs/Xserver/fb/module/Imakefile b/nx-X11/programs/Xserver/fb/module/Imakefile deleted file mode 100644 index bea44f4e8..000000000 --- a/nx-X11/programs/Xserver/fb/module/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/cfb/module/Imakefile,v 1.1 2002/05/31 15:12:56 dawes Exp $ - -#define IHaveModules -#define LinkDirectory .. - -#include "../Imakefile" |
