diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:03:47 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:03:47 +0000 |
commit | c57959ad6a4c0f5329762f401fd7871ffb2ee90c (patch) | |
tree | f223828f827382311611edf114ddd0c42cb3b23f /cfb | |
parent | 9508a382f8a9f241dab097d921b6d290c1c3a776 (diff) |
merge XFree86 4.3.0.1 to -CURRENT
Diffstat (limited to 'cfb')
43 files changed, 6180 insertions, 1573 deletions
@@ -27,8 +27,12 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/cfb/cfb.h,v 3.27 2001/01/30 22:06:15 tsi Exp $ */ + +#if !defined(__CFB_H__) || defined(CFB_PROTOTYPES_ONLY) #include "X.h" +#include "globals.h" #include "pixmap.h" #include "region.h" #include "gc.h" @@ -41,6 +45,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "cfbmap.h" +#ifndef CfbBits +#define CfbBits CARD32 +#endif + +#ifndef CFB_PROTOTYPES_ONLY +#define __CFB_H__ /* private filed of pixmap pixmap.devPrivate = (unsigned int *)pointer_to_bits @@ -57,11 +67,7 @@ typedef struct { unsigned char ropOpStip; /* rop for opaque stipple */ /* this value is ropFillArea in mfb, usurped for cfb */ unsigned char oneRect; /* drawable has one clip rect */ - unsigned fExpose:1; /* callexposure handling ? */ - unsigned freeCompClip:1; - PixmapPtr pRotatedPixmap; - RegionPtr pCompositeClip; /* FREE_CC or REPLACE_CC */ - unsigned long xor, and; /* reduced rop values */ + CfbBits xor, and; /* reduced rop values */ } cfbPrivGC; typedef cfbPrivGC *cfbPrivGCPtr; @@ -69,13 +75,12 @@ typedef cfbPrivGC *cfbPrivGCPtr; #define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\ (pGC)->devPrivates[cfbGCPrivateIndex].ptr) -#define cfbGetCompositeClip(pGC) (((cfbPrivGCPtr)\ - (pGC)->devPrivates[cfbGCPrivateIndex].ptr)->pCompositeClip) +#define cfbGetCompositeClip(pGC) ((pGC)->pCompositeClip) /* way to carry RROP info around */ typedef struct { unsigned char rop; - unsigned long xor, and; + CfbBits xor, and; } cfbRRopRec, *cfbRRopPtr; /* private field of window */ @@ -95,24 +100,19 @@ typedef struct { /* cfb8bit.c */ extern int cfbSetStipple( -#if NeedFunctionPrototypes int /*alu*/, - unsigned long /*fg*/, - unsigned long /*planemask*/ -#endif + CfbBits /*fg*/, + CfbBits /*planemask*/ ); extern int cfbSetOpaqueStipple( -#if NeedFunctionPrototypes int /*alu*/, - unsigned long /*fg*/, - unsigned long /*bg*/, - unsigned long /*planemask*/ -#endif + CfbBits /*fg*/, + CfbBits /*bg*/, + CfbBits /*planemask*/ ); extern int cfbComputeClipMasks32( -#if NeedFunctionPrototypes BoxPtr /*pBox*/, int /*numRects*/, int /*x*/, @@ -120,23 +120,21 @@ extern int cfbComputeClipMasks32( int /*w*/, int /*h*/, CARD32 * /*clips*/ -#endif ); +#endif /* !CFB_PROTOTYPES_ONLY */ /* cfb8cppl.c */ extern void cfbCopyImagePlane( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, int /*rop*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ -#endif ); +#ifndef CFB_PROTOTYPES_ONLY extern void cfbCopyPlane8to1( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, int /*rop*/, @@ -144,12 +142,42 @@ extern void cfbCopyPlane8to1( DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/, unsigned long /*bitPlane*/ -#endif ); + +extern void cfbCopyPlane16to1( + DrawablePtr /*pSrcDrawable*/, + DrawablePtr /*pDstDrawable*/, + int /*rop*/, + RegionPtr /*prgnDst*/, + DDXPointPtr /*pptSrc*/, + unsigned long /*planemask*/, + unsigned long /*bitPlane*/ +); + +extern void cfbCopyPlane24to1( + DrawablePtr /*pSrcDrawable*/, + DrawablePtr /*pDstDrawable*/, + int /*rop*/, + RegionPtr /*prgnDst*/, + DDXPointPtr /*pptSrc*/, + unsigned long /*planemask*/, + unsigned long /*bitPlane*/ +); + +extern void cfbCopyPlane32to1( + DrawablePtr /*pSrcDrawable*/, + DrawablePtr /*pDstDrawable*/, + int /*rop*/, + RegionPtr /*prgnDst*/, + DDXPointPtr /*pptSrc*/, + unsigned long /*planemask*/, + unsigned long /*bitPlane*/ +); +#endif + /* cfb8lineCO.c */ extern int cfb8LineSS1RectCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, @@ -160,21 +188,17 @@ extern int cfb8LineSS1RectCopy( int * /*y1p*/, int * /*x2p*/, int * /*y2p*/ -#endif ); extern void cfb8LineSS1Rect( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ -#endif ); extern void cfb8ClippedLineCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x1*/, @@ -183,12 +207,10 @@ extern void cfb8ClippedLineCopy( int /*y2*/, BoxPtr /*boxp*/, Bool /*shorten*/ -#endif ); /* cfb8lineCP.c */ extern int cfb8LineSS1RectPreviousCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, @@ -199,13 +221,10 @@ extern int cfb8LineSS1RectPreviousCopy( int * /*y1p*/, int * /*x2p*/, int * /*y2p*/ - -#endif ); /* cfb8lineG.c */ extern int cfb8LineSS1RectGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, @@ -216,11 +235,9 @@ extern int cfb8LineSS1RectGeneral( int * /*y1p*/, int * /*x2p*/, int * /*y2p*/ -#endif ); extern void cfb8ClippedLineGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x1*/, @@ -229,12 +246,10 @@ extern void cfb8ClippedLineGeneral( int /*y2*/, BoxPtr /*boxp*/, Bool /*shorten*/ -#endif ); /* cfb8lineX.c */ extern int cfb8LineSS1RectXor( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, @@ -245,11 +260,9 @@ extern int cfb8LineSS1RectXor( int * /*y1p*/, int * /*x2p*/, int * /*y2p*/ -#endif ); extern void cfb8ClippedLineXor( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x1*/, @@ -258,70 +271,56 @@ extern void cfb8ClippedLineXor( int /*y2*/, BoxPtr /*boxp*/, Bool /*shorten*/ -#endif ); /* cfb8segC.c */ extern int cfb8SegmentSS1RectCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ -#endif ); /* cfb8segCS.c */ extern int cfb8SegmentSS1RectShiftCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ -#endif ); extern void cfb8SegmentSS1Rect( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ -#endif ); /* cfb8segG.c */ extern int cfb8SegmentSS1RectGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ -#endif ); /* cfbsegX.c */ extern int cfb8SegmentSS1RectXor( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ -#endif ); /* cfballpriv.c */ extern Bool cfbAllocatePrivates( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int * /*window_index*/, int * /*gc_index*/ -#endif ); /* cfbbitblt.c */ extern RegionPtr cfbBitBlt( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr/*pGC*/, @@ -331,24 +330,28 @@ extern RegionPtr cfbBitBlt( int /*height*/, int /*dstx*/, int /*dsty*/, - void (* /*doBitBlt*/)(), + void (* /*doBitBlt*/)( + DrawablePtr /*pSrc*/, + DrawablePtr /*pDst*/, + int /*alu*/, + RegionPtr /*prgnDst*/, + DDXPointPtr /*pptSrc*/, + unsigned long /*planemask*/, + unsigned long /*bitPlane*/ + ), unsigned long /*bitPlane*/ -#endif ); extern void cfbDoBitblt( -#if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ -#endif ); extern RegionPtr cfbCopyArea( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr/*pGC*/, @@ -358,11 +361,10 @@ extern RegionPtr cfbCopyArea( int /*height*/, int /*dstx*/, int /*dsty*/ -#endif ); +#ifndef CFB_PROTOTYPES_ONLY extern void cfbCopyPlane1to8( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, int /*rop*/, @@ -370,11 +372,10 @@ extern void cfbCopyPlane1to8( DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/, unsigned long /*bitPlane*/ -#endif ); +#endif extern RegionPtr cfbCopyPlane( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, @@ -385,64 +386,54 @@ extern RegionPtr cfbCopyPlane( int /*dstx*/, int /*dsty*/, unsigned long /*bitPlane*/ -#endif ); /* cfbbltC.c */ extern void cfbDoBitbltCopy( -#if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ -#endif ); /* cfbbltG.c */ extern void cfbDoBitbltGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ -#endif ); /* cfbbltO.c */ extern void cfbDoBitbltOr( -#if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ -#endif ); /* cfbbltX.c */ extern void cfbDoBitbltXor( -#if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ -#endif ); /* cfbbres.c */ extern void cfbBresS( -#if NeedFunctionPrototypes int /*rop*/, - unsigned long /*and*/, - unsigned long /*xor*/, - unsigned long * /*addrl*/, + CfbBits /*and*/, + CfbBits /*xor*/, + CfbBits * /*addrl*/, int /*nlwidth*/, int /*signdx*/, int /*signdy*/, @@ -453,19 +444,17 @@ extern void cfbBresS( int /*e1*/, int /*e2*/, int /*len*/ -#endif ); /* cfbbresd.c */ extern void cfbBresD( -#if NeedFunctionPrototypes cfbRRopPtr /*rrops*/, int * /*pdashIndex*/, unsigned char * /*pDash*/, int /*numInDashList*/, int * /*pdashOffset*/, int /*isDoubleDash*/, - unsigned long * /*addrl*/, + CfbBits * /*addrl*/, int /*nlwidth*/, int /*signdx*/, int /*signdy*/, @@ -476,90 +465,71 @@ extern void cfbBresD( int /*e1*/, int /*e2*/, int /*len*/ -#endif ); /* cfbbstore.c */ extern void cfbSaveAreas( -#if NeedFunctionPrototypes PixmapPtr /*pPixmap*/, RegionPtr /*prgnSave*/, int /*xorg*/, int /*yorg*/, WindowPtr /*pWin*/ -#endif ); extern void cfbRestoreAreas( -#if NeedFunctionPrototypes PixmapPtr /*pPixmap*/, RegionPtr /*prgnRestore*/, int /*xorg*/, int /*yorg*/, WindowPtr /*pWin*/ -#endif ); /* cfbcmap.c */ +#ifndef CFB_PROTOTYPES_ONLY extern int cfbListInstalledColormaps( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, Colormap * /*pmaps*/ -#endif ); extern void cfbInstallColormap( -#if NeedFunctionPrototypes ColormapPtr /*pmap*/ -#endif ); extern void cfbUninstallColormap( -#if NeedFunctionPrototypes ColormapPtr /*pmap*/ -#endif ); extern void cfbResolveColor( -#if NeedFunctionPrototypes unsigned short * /*pred*/, unsigned short * /*pgreen*/, unsigned short * /*pblue*/, VisualPtr /*pVisual*/ -#endif ); extern Bool cfbInitializeColormap( -#if NeedFunctionPrototypes ColormapPtr /*pmap*/ -#endif ); extern int cfbExpandDirectColors( -#if NeedFunctionPrototypes ColormapPtr /*pmap*/, int /*ndef*/, xColorItem * /*indefs*/, xColorItem * /*outdefs*/ -#endif ); extern Bool cfbCreateDefColormap( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/ -#endif ); extern Bool cfbSetVisualTypes( -#if NeedFunctionPrototypes int /*depth*/, int /*visuals*/, int /*bitsPerRGB*/ -#endif ); +extern void cfbClearVisualTypes(void); + extern Bool cfbInitVisuals( -#if NeedFunctionPrototypes VisualPtr * /*visualp*/, DepthPtr * /*depthp*/, int * /*nvisualp*/, @@ -568,142 +538,117 @@ extern Bool cfbInitVisuals( VisualID * /*defaultVisp*/, unsigned long /*sizes*/, int /*bitsPerRGB*/ -#endif ); +#endif /* cfbfillarcC.c */ extern void cfbPolyFillArcSolidCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ -#endif ); /* cfbfillarcG.c */ extern void cfbPolyFillArcSolidGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ -#endif ); /* cfbfillrct.c */ extern void cfbFillBoxTileOdd( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, BoxPtr /*rects*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/ -#endif ); extern void cfbFillRectTileOdd( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); extern void cfbPolyFillRect( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrectFill*/, xRectangle * /*prectInit*/ -#endif ); /* cfbfillsp.c */ extern void cfbUnnaturalTileFS( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); extern void cfbUnnaturalStippleFS( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); +#ifndef CFB_PROTOTYPES_ONLY extern void cfb8Stipple32FS( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); extern void cfb8OpaqueStipple32FS( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); +#endif /* cfbgc.c */ extern GCOpsPtr cfbMatchCommon( -#if NeedFunctionPrototypes GCPtr /*pGC*/, cfbPrivGCPtr /*devPriv*/ -#endif ); extern Bool cfbCreateGC( -#if NeedFunctionPrototypes GCPtr /*pGC*/ -#endif ); extern void cfbValidateGC( -#if NeedFunctionPrototypes GCPtr /*pGC*/, unsigned long /*changes*/, DrawablePtr /*pDrawable*/ -#endif ); /* cfbgetsp.c */ extern void cfbGetSpans( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*wMax*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, char * /*pdstStart*/ -#endif ); /* cfbglblt8.c */ extern void cfbPolyGlyphBlt8( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, @@ -711,12 +656,10 @@ extern void cfbPolyGlyphBlt8( unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ -#endif ); /* cfbglrop8.c */ extern void cfbPolyGlyphRop8( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, @@ -724,39 +667,33 @@ extern void cfbPolyGlyphRop8( unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ -#endif ); /* cfbhrzvert.c */ -extern int cfbHorzS( -#if NeedFunctionPrototypes +extern void cfbHorzS( int /*rop*/, - unsigned long /*and*/, - unsigned long /*xor*/, - unsigned long * /*addrl*/, + CfbBits /*and*/, + CfbBits /*xor*/, + CfbBits * /*addrl*/, int /*nlwidth*/, int /*x1*/, int /*y1*/, int /*len*/ -#endif ); -extern int cfbVertS( -#if NeedFunctionPrototypes +extern void cfbVertS( int /*rop*/, - unsigned long /*and*/, - unsigned long /*xor*/, - unsigned long * /*addrl*/, + CfbBits /*and*/, + CfbBits /*xor*/, + CfbBits * /*addrl*/, int /*nlwidth*/, int /*x1*/, int /*y1*/, int /*len*/ -#endif ); /* cfbigblt8.c */ extern void cfbImageGlyphBlt8( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, @@ -764,12 +701,10 @@ extern void cfbImageGlyphBlt8( unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ -#endif ); /* cfbimage.c */ extern void cfbPutImage( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*depth*/, @@ -780,11 +715,9 @@ extern void cfbPutImage( int /*leftPad*/, int /*format*/, char * /*pImage*/ -#endif ); extern void cfbGetImage( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*sx*/, int /*sy*/, @@ -793,147 +726,116 @@ extern void cfbGetImage( unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/ -#endif ); /* cfbline.c */ extern void cfbLineSS( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ -#endif ); extern void cfbLineSD( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ -#endif ); /* cfbmskbits.c */ /* cfbpixmap.c */ extern PixmapPtr cfbCreatePixmap( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/ -#endif ); extern Bool cfbDestroyPixmap( -#if NeedFunctionPrototypes PixmapPtr /*pPixmap*/ -#endif ); extern PixmapPtr cfbCopyPixmap( -#if NeedFunctionPrototypes PixmapPtr /*pSrc*/ -#endif ); extern void cfbPadPixmap( -#if NeedFunctionPrototypes PixmapPtr /*pPixmap*/ -#endif ); extern void cfbXRotatePixmap( -#if NeedFunctionPrototypes PixmapPtr /*pPix*/, int /*rw*/ -#endif ); extern void cfbYRotatePixmap( -#if NeedFunctionPrototypes PixmapPtr /*pPix*/, int /*rh*/ -#endif ); extern void cfbCopyRotatePixmap( -#if NeedFunctionPrototypes PixmapPtr /*psrcPix*/, PixmapPtr * /*ppdstPix*/, int /*xrot*/, int /*yrot*/ -#endif ); /* cfbply1rctC.c */ extern void cfbFillPoly1RectCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*ptsIn*/ -#endif ); /* cfbply1rctG.c */ extern void cfbFillPoly1RectGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*ptsIn*/ -#endif ); /* cfbpntwin.c */ extern void cfbPaintWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*pRegion*/, int /*what*/ -#endif ); extern void cfbFillBoxSolid( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, unsigned long /*pixel*/ -#endif ); extern void cfbFillBoxTile32( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, PixmapPtr /*tile*/ -#endif ); /* cfbpolypnt.c */ extern void cfbPolyPoint( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, xPoint * /*pptInit*/ -#endif ); /* cfbpush8.c */ +#ifndef CFB_PROTOTYPES_ONLY extern void cfbPushPixels8( -#if NeedFunctionPrototypes GCPtr /*pGC*/, PixmapPtr /*pBitmap*/, DrawablePtr /*pDrawable*/, @@ -941,58 +843,47 @@ extern void cfbPushPixels8( int /*dy*/, int /*xOrg*/, int /*yOrg*/ -#endif ); /* cfbrctstp8.c */ extern void cfb8FillRectOpaqueStippled32( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); extern void cfb8FillRectTransparentStippled32( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); extern void cfb8FillRectStippledUnnatural( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); +#endif /* cfbrrop.c */ extern int cfbReduceRasterOp( -#if NeedFunctionPrototypes int /*rop*/, - unsigned long /*fg*/, - unsigned long /*pm*/, - unsigned long * /*andp*/, - unsigned long * /*xorp*/ -#endif + CfbBits /*fg*/, + CfbBits /*pm*/, + CfbBits * /*andp*/, + CfbBits * /*xorp*/ ); /* cfbscrinit.c */ extern Bool cfbCloseScreen( -#if NeedFunctionPrototypes int /*index*/, ScreenPtr /*pScreen*/ -#endif ); extern Bool cfbSetupScreen( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, @@ -1000,11 +891,9 @@ extern Bool cfbSetupScreen( int /*dpix*/, int /*dpiy*/, int /*width*/ -#endif ); -extern int cfbFinishScreenInit( -#if NeedFunctionPrototypes +extern Bool cfbFinishScreenInit( ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, @@ -1012,11 +901,9 @@ extern int cfbFinishScreenInit( int /*dpix*/, int /*dpiy*/, int /*width*/ -#endif ); extern Bool cfbScreenInit( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, @@ -1024,31 +911,34 @@ extern Bool cfbScreenInit( int /*dpix*/, int /*dpiy*/, int /*width*/ -#endif ); + +extern PixmapPtr cfbGetScreenPixmap( + ScreenPtr /*pScreen*/ +); + +extern void cfbSetScreenPixmap( + PixmapPtr /*pPix*/ +); + /* cfbseg.c */ extern void cfbSegmentSS( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSeg*/ -#endif ); extern void cfbSegmentSD( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSeg*/ -#endif ); /* cfbsetsp.c */ -extern int cfbSetScanline( -#if NeedFunctionPrototypes +extern void cfbSetScanline( int /*y*/, int /*xOrigin*/, int /*xStart*/, @@ -1058,11 +948,9 @@ extern int cfbSetScanline( int * /*pdstBase*/, int /*widthDst*/, unsigned long /*planemask*/ -#endif ); extern void cfbSetSpans( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, char * /*psrc*/, @@ -1070,75 +958,62 @@ extern void cfbSetSpans( int * /*pwidth*/, int /*nspans*/, int /*fSorted*/ -#endif ); /* cfbsolidC.c */ extern void cfbFillRectSolidCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); extern void cfbSolidSpansCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); /* cfbsolidG.c */ extern void cfbFillRectSolidGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); extern void cfbSolidSpansGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); /* cfbsolidX.c */ extern void cfbFillRectSolidXor( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); extern void cfbSolidSpansXor( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); /* cfbteblt8.c */ +#ifndef CFB_PROTOTYPES_ONLY extern void cfbTEGlyphBlt8( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*xInit*/, @@ -1146,12 +1021,11 @@ extern void cfbTEGlyphBlt8( unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ -#endif ); +#endif /* cfbtegblt.c */ extern void cfbTEGlyphBlt( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*x*/, @@ -1159,54 +1033,44 @@ extern void cfbTEGlyphBlt( unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ -#endif ); /* cfbtile32C.c */ extern void cfbFillRectTile32Copy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); extern void cfbTile32FSCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); /* cfbtile32G.c */ extern void cfbFillRectTile32General( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ -#endif ); extern void cfbTile32FSGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ -#endif ); /* cfbtileoddC.c */ extern void cfbFillBoxTileOddCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, @@ -1215,11 +1079,9 @@ extern void cfbFillBoxTileOddCopy( int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ -#endif ); extern void cfbFillSpanTileOddCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, DDXPointPtr /*ppt*/, @@ -1229,11 +1091,9 @@ extern void cfbFillSpanTileOddCopy( int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ -#endif ); extern void cfbFillBoxTile32sCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, @@ -1242,11 +1102,9 @@ extern void cfbFillBoxTile32sCopy( int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ -#endif ); extern void cfbFillSpanTile32sCopy( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, DDXPointPtr /*ppt*/, @@ -1256,12 +1114,10 @@ extern void cfbFillSpanTile32sCopy( int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ -#endif ); /* cfbtileoddG.c */ extern void cfbFillBoxTileOddGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, @@ -1270,11 +1126,9 @@ extern void cfbFillBoxTileOddGeneral( int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ -#endif ); extern void cfbFillSpanTileOddGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, DDXPointPtr /*ppt*/, @@ -1284,11 +1138,9 @@ extern void cfbFillSpanTileOddGeneral( int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ -#endif ); extern void cfbFillBoxTile32sGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, @@ -1297,11 +1149,9 @@ extern void cfbFillBoxTile32sGeneral( int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ -#endif ); extern void cfbFillSpanTile32sGeneral( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, DDXPointPtr /*ppt*/, @@ -1311,113 +1161,79 @@ extern void cfbFillSpanTile32sGeneral( int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ -#endif ); /* cfbwindow.c */ extern Bool cfbCreateWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/ -#endif ); extern Bool cfbDestroyWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/ -#endif ); extern Bool cfbMapWindow( -#if NeedFunctionPrototypes WindowPtr /*pWindow*/ -#endif ); extern Bool cfbPositionWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/ -#endif ); extern Bool cfbUnmapWindow( -#if NeedFunctionPrototypes WindowPtr /*pWindow*/ -#endif ); extern void cfbCopyWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, DDXPointRec /*ptOldOrg*/, RegionPtr /*prgnSrc*/ -#endif ); extern Bool cfbChangeWindowAttributes( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, unsigned long /*mask*/ -#endif ); /* cfbzerarcC.c */ extern void cfbZeroPolyArcSS8Copy( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ -#endif ); /* cfbzerarcG.c */ extern void cfbZeroPolyArcSS8General( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ -#endif ); /* cfbzerarcX.c */ extern void cfbZeroPolyArcSS8Xor( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ -#endif ); -/* - * This is the only completely portable way to - * compute this info - */ - -#define BitsPerPixel(d) (\ - (1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \ - (PixmapWidthPaddingInfo[d].padRoundUp+1)) - -/* Common macros for extracting drawing information */ - -#if !defined(SINGLEDEPTH) && PSZ != 8 || defined(FORCE_SEPARATE_PRIVATE) +#if (!defined(SINGLEDEPTH) && PSZ != 8) || defined(FORCE_SEPARATE_PRIVATE) #define CFB_NEED_SCREEN_PRIVATE extern int cfbScreenPrivateIndex; -#define cfbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivates[cfbScreenPrivateIndex].ptr) -#else -#define cfbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate) #endif -#ifdef PIXMAP_PER_WINDOW -#define cfbGetWindowPixmap(d) ((PixmapPtr) ((WindowPtr) d)->devPrivates[frameWindowPrivateIndex].ptr) -#else -#define cfbGetWindowPixmap(d) cfbGetScreenPixmap((d)->pScreen) -#endif +#ifndef CFB_PROTOTYPES_ONLY + +/* Common macros for extracting drawing information */ + +#define cfbGetWindowPixmap(d) \ + ((* ((DrawablePtr)(d))->pScreen->GetWindowPixmap)((WindowPtr)(d))) #define cfbGetTypedWidth(pDrawable,wtype) (\ (((pDrawable)->type != DRAWABLE_PIXMAP) ? \ @@ -1428,7 +1244,7 @@ extern int cfbScreenPrivateIndex; #define cfbGetPixelWidth(pDrawable) cfbGetTypedWidth(pDrawable, PixelType) -#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned long) +#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, CfbBits) #define cfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\ PixmapPtr _pPix; \ @@ -1444,7 +1260,7 @@ extern int cfbScreenPrivateIndex; cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char) #define cfbGetLongWidthAndPointer(pDrawable, width, pointer) \ - cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned long, unsigned long) + cfbGetTypedWidthAndPointer(pDrawable, width, pointer, CfbBits, CfbBits) #define cfbGetPixelWidthAndPointer(pDrawable, width, pointer) \ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) @@ -1456,7 +1272,7 @@ extern int cfbScreenPrivateIndex; } #define cfbGetWindowLongWidthAndPointer(pWin, width, pointer) \ - cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned long, unsigned long) + cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, CfbBits, CfbBits) #define cfbGetWindowByteWidthAndPointer(pWin, width, pointer) \ cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned char, unsigned char) @@ -1464,31 +1280,26 @@ extern int cfbScreenPrivateIndex; #define cfbGetWindowPixelWidthAndPointer(pDrawable, width, pointer) \ cfbGetWindowTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) -/* Macros which handle a coordinate in a single register */ - -/* Most compilers will convert divide by 65536 into a shift, if signed - * shifts exist. If your machine does arithmetic shifts and your compiler - * can't get it right, add to this line. +/* + * XFree86 empties the root BorderClip when the VT is inactive, + * here's a macro which uses that to disable GetImage and GetSpans */ +#define cfbWindowEnabled(pWin) \ + REGION_NOTEMPTY((pWin)->drawable.pScreen, \ + &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip) -/* mips compiler - what a joke - it CSEs the 65536 constant into a reg - * forcing as to use div instead of shift. Let's be explicit. - */ +#define cfbDrawableEnabled(pDrawable) \ + ((pDrawable)->type == DRAWABLE_PIXMAP ? \ + TRUE : cfbWindowEnabled((WindowPtr) pDrawable)) + +#include "micoord.h" -#if defined(mips) || defined(sparc) || defined(__alpha) -#define GetHighWord(x) (((int) (x)) >> 16) -#else -#define GetHighWord(x) (((int) (x)) / 65536) +/* + * if CFB is built as a module, it shouldn't call libc functions. + */ +#ifdef XFree86LOADER +#include "xf86_ansic.h" #endif +#endif /* !CFB_PROTOTYPES_ONLY */ -#if IMAGE_BYTE_ORDER == MSBFirst -#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i)))) -#define coordToInt(x,y) (((x) << 16) | (y)) -#define intToX(i) (GetHighWord(i)) -#define intToY(i) ((int) ((short) i)) -#else -#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i))) -#define coordToInt(x,y) (((y) << 16) | (x)) -#define intToX(i) ((int) ((short) (i))) -#define intToY(i) (GetHighWord(i)) #endif diff --git a/cfb/cfb8bit.c b/cfb/cfb8bit.c index 080970e70..1dd742c60 100644 --- a/cfb/cfb8bit.c +++ b/cfb/cfb8bit.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/Xserver/cfb/cfb8bit.c,v 1.5 2001/12/14 19:59:20 dawes Exp $ */ /* * cfb8bit.c @@ -193,11 +194,11 @@ PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS]; int cfb8SetStipple (alu, fg, planemask) int alu; -unsigned long fg, planemask; +CfbBits fg, planemask; { - unsigned long and, xor, rrop; + CfbBits and, xor, rrop; int s; - unsigned long c; + CfbBits c; cfb8StippleMode = FillStippled; cfb8StippleAlu = alu; @@ -222,11 +223,11 @@ unsigned long fg, planemask; int cfb8SetOpaqueStipple (alu, fg, bg, planemask) int alu; -unsigned long fg, bg, planemask; +CfbBits fg, bg, planemask; { - unsigned long andfg, xorfg, andbg, xorbg, rropfg, rropbg; + CfbBits andfg, xorfg, andbg, xorbg, rropfg, rropbg; int s; - unsigned long c; + CfbBits c; cfb8StippleMode = FillOpaqueStippled; cfb8StippleAlu = alu; @@ -371,7 +372,7 @@ cfb8ComputeClipMasks32 (pBox, numRects, x, y, w, h, clips) { int yBand, yBandBot; int ch; - unsigned long clip; + CfbBits clip; int partIN = FALSE, partOUT = FALSE; int result; diff --git a/cfb/cfb8bit.h b/cfb/cfb8bit.h index 23853bf2d..a14402b83 100644 --- a/cfb/cfb8bit.h +++ b/cfb/cfb8bit.h @@ -7,6 +7,7 @@ * are used for depths other than 8. Perhaps the file should be * renamed. dpw */ +/* $XFree86: xc/programs/Xserver/cfb/cfb8bit.h,v 3.7 2001/12/14 19:59:20 dawes Exp $ */ /* @@ -168,13 +169,11 @@ extern int cfb8StippleRRop; #define RRopBitGroup(dst,bits) \ { \ - register PixelGroup _bitsTmp = (bits); \ *(dst) = RRopPixels(*(dst),bits); \ } #define MaskRRopBitGroup(dst,bits,mask) \ { \ - register PixelGroup _bitsTmp = (bits); \ *(dst) = MaskRRopPixels(*(dst),bits,mask); \ } #endif /* PSZ == 8 */ @@ -203,17 +202,39 @@ extern int cfb8StippleRRop; #define SinglePixel1 2 #define SinglePixel2 1 #define SinglePixel3 0 +#define SinglePixel4 7 +#define SinglePixel5 6 +#define SinglePixel6 5 +#define SinglePixel7 4 +#define SinglePixel8 0xB +#define SinglePixel9 0xA #define DoublePixel0 1 #define DoublePixel1 0 +#define DoublePixel2 3 +#define DoublePixel3 2 +#define DoublePixel4 5 +#define DoublePixel5 4 #else #define SinglePixel0 0 #define SinglePixel1 1 #define SinglePixel2 2 #define SinglePixel3 3 +#define SinglePixel4 4 +#define SinglePixel5 5 +#define SinglePixel6 6 +#define SinglePixel7 7 +#define SinglePixel8 8 +#define SinglePixel9 9 #define DoublePixel0 0 #define DoublePixel1 1 +#define DoublePixel2 2 +#define DoublePixel3 3 +#define DoublePixel4 4 +#define DoublePixel5 5 #endif #define QuadPixel0 0 +#define QuadPixel1 1 +#define QuadPixel2 2 #else /* PGSZ == 64 */ #if (BITMAP_BIT_ORDER == MSBFirst) #define SinglePixel0 7 @@ -393,7 +414,7 @@ extern int cfb8StippleRRop; break; \ case 6: \ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 7: \ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ @@ -872,6 +893,363 @@ extern int cfb8StippleRRop; #endif /* PSZ == 16 */ +#if PSZ == 24 +/* 32 000011112222*/ +/* 24 000111222333*/ +/* 16 001122334455*/ +/* 8 0123456789AB*/ +#if PGSZ == 32 +#define WriteBitGroup(dst,pixel,bits) \ + { \ + register CARD32 reg_pixel = (pixel); \ + switch (bits) { \ + case 0: \ + break; \ + case 1: \ + ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ + ((CARD8 *) (dst))[SinglePixel2] = ((reg_pixel>>16)&0xFF); \ + break; \ + case 2: \ + ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \ + ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \ + break; \ + case 3: \ + ((CARD8 *) (dst))[SinglePixel3] = reg_pixel & 0xFF; \ + ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ + ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \ + ((CARD8 *) (dst))[SinglePixel2] = (reg_pixel>>16&0xFF); \ + break; \ + case 4: \ + ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ + ((CARD8 *) (dst))[SinglePixel8] = (reg_pixel>>16)&0xFF; \ + break; \ + case 5: \ + ((CARD16 *) (dst))[DoublePixel0] = \ + ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ + reg_pixel >>= 16; \ + ((CARD8 *) (dst))[SinglePixel2] = \ + ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ + break; \ + case 6: \ + ((CARD8 *) (dst))[SinglePixel3] = reg_pixel; \ + ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ + break; \ + case 7: \ + ((CARD16 *) (dst))[DoublePixel0] = \ + ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ + ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD8 *) (dst))[SinglePixel2] = \ + ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ + break; \ + case 8: \ + ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ + ((CARD16 *) (dst))[DoublePixel5] = (reg_pixel>>8); \ + break; \ + case 9: \ + ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ + ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD8 *) (dst))[SinglePixel2] = reg_pixel&0xFF; \ + break; \ + case 10: \ + ((CARD8 *) (dst))[SinglePixel3] = \ + ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel2] = \ + ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ + break; \ + case 11: \ + ((CARD8 *) (dst))[SinglePixel3] = \ + ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ + ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel2] = \ + ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \ + break; \ + case 12: \ + ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ + ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ + break; \ + case 13: \ + ((CARD16 *) (dst))[DoublePixel0] = \ + ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ + ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD8 *) (dst))[SinglePixel2] = \ + ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ + break; \ + case 14: \ + ((CARD8 *) (dst))[SinglePixel3] = \ + ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ + ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel2] = \ + ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ + break; \ + case 15: \ + ((CARD16 *) (dst))[DoublePixel0] = \ + ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ + ((CARD8 *) (dst))[SinglePixel3] = \ + ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD16 *) (dst))[DoublePixel2] = \ + ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ + reg_pixel >>= 8; \ + ((CARD8 *) (dst))[SinglePixel8] = \ + ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \ + break; \ + } \ + } +#else /* PGSZ == 64 */ +#define WriteBitGroup(dst,pixel,bits) \ + if ( bits == 0xff ) { \ + ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \ + ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \ + ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \ + ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \ + } \ + else { \ + switch (bits & 0x0f) { \ + case 0: \ + break; \ + case 1: \ + ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ + break; \ + case 2: \ + ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ + break; \ + case 3: \ + ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ + break; \ + case 4: \ + ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ + break; \ + case 5: \ + ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ + break; \ + case 6: \ + ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ + break; \ + case 7: \ + ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ + break; \ + case 8: \ + ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ + break; \ + case 9: \ + ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ + break; \ + case 10: \ + ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ + break; \ + case 11: \ + ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ + break; \ + case 12: \ + ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ + break; \ + case 13: \ + ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ + break; \ + case 14: \ + ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ + break; \ + case 15: \ + ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ + break; \ + } \ + switch ((bits & 0xf0) >> 4) { \ + case 0: \ + break; \ + case 1: \ + ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ + break; \ + case 2: \ + ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ + break; \ + case 3: \ + ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ + break; \ + case 4: \ + ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ + break; \ + case 5: \ + ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ + break; \ + case 6: \ + ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ + break; \ + case 7: \ + ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ + break; \ + case 8: \ + ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ + break; \ + case 9: \ + ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ + break; \ + case 10: \ + ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ + break; \ + case 11: \ + ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ + break; \ + case 12: \ + ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ + break; \ + case 13: \ + ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ + break; \ + case 14: \ + ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ + break; \ + case 15: \ + ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ + ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ + break; \ + } \ + } +#endif /* PGSZ */ + +#if PGSZ == 32 +#define SwitchBitGroup(dst,pixel,bits) { \ + switch (bits) { \ + case 0: \ + break; \ + case 1: \ + SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ + break; \ + case 2: \ + SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \ + break; \ + case 3: \ + SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \ + break; \ + case 4: \ + SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ + break; \ + case 5: \ + SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ + break; \ + case 6: \ + SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ + ((CARD32 *) (dst))[QuadPixel2] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ + break; \ + case 7: \ + SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ + ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ + break; \ + case 8: \ + SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel9] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ + break; \ + case 9: \ + SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ + break; \ + case 10: \ + SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ + break; \ + case 11: \ + SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel3] = (pixel);) \ + ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ + break; \ + case 12: \ + SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \ + ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ + break; \ + case 13: \ + SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ + ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ + ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ + ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ + break; \ + case 14: \ + SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ + ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ + ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ + break; \ + case 15: \ + SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ + ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ + ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ + break; \ + } \ +} +#else /* PGSZ == 64 */ +#define SwitchBitGroup(dst,pixel,bits) { \ + cfb cannot hack 64-bit SwitchBitGroup psz=PSZ +#endif /* PGSZ */ + +#endif /* PSZ == 24 */ #if PSZ == 32 @@ -1169,17 +1547,17 @@ extern PixelGroup cfb8BitLenMasks[PGSZ]; extern int cfb8SetStipple ( #if NeedFunctionPrototypes int /*alu*/, - unsigned long /*fg*/, - unsigned long /*planemask*/ + CfbBits /*fg*/, + CfbBits /*planemask*/ #endif ); extern int cfb8SetOpaqueStipple ( #if NeedFunctionPrototypes int /*alu*/, - unsigned long /*fg*/, - unsigned long /*bg*/, - unsigned long /*planemask*/ + CfbBits /*fg*/, + CfbBits /*bg*/, + CfbBits /*planemask*/ #endif ); diff --git a/cfb/cfb8line.c b/cfb/cfb8line.c index 7a5f1ac5d..f06abe084 100644 --- a/cfb/cfb8line.c +++ b/cfb/cfb8line.c @@ -24,6 +24,9 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium + * + * $XFree86: xc/programs/Xserver/cfb/cfb8line.c,v 3.18 2002/09/18 17:11:47 tsi Exp $ + * Jeff Anton'x fixes: cfb8line.c 97/02/07 */ #include "X.h" @@ -64,7 +67,8 @@ in this Software without prior written authorization from The Open Group. #ifdef POLYSEGMENT -# ifdef sun +# if (defined(sun) || defined(__bsdi__)) && \ + (defined(sparc) || defined(__sparc__)) # define WIDTH_FAST 1152 # endif @@ -140,6 +144,119 @@ in this Software without prior written authorization from The Open Group. # endif #endif +#if PSZ == 24 +#define PXL2ADR(x) ((x)*3 >> 2) + +#if RROP == GXcopy +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp = (*addrp & 0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \ + break; \ + case 1: \ + *addrp = (*addrp & 0xFF)|(piQxelXor[2] & 0xFFFFFF00); \ + break; \ + case 3: \ + *addrp = (*addrp & 0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \ + *(addrp+1)=(*(addrp+1) & 0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \ + break; \ + case 2: \ + *addrp = (*addrp & 0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \ + *(addrp+1)=(*(addrp+1) & 0xFFFFFF00)|(piQxelXor[2] & 0xFF); \ + break; \ + } +#endif +#if RROP == GXxor +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp ^= piQxelXor[0] & 0xFFFFFF; \ + break; \ + case 1: \ + *addrp ^= piQxelXor[2] & 0xFFFFFF00; \ + break; \ + case 3: \ + *addrp ^= piQxelXor[0] & 0xFF000000; \ + *(addrp+1) ^= piQxelXor[1] & 0xFFFF; \ + break; \ + case 2: \ + *addrp ^= piQxelXor[1] & 0xFFFF0000; \ + *(addrp+1) ^= piQxelXor[2] & 0xFF; \ + break; \ + } +#endif +#if RROP == GXand +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp &= piQxelAnd[0] | 0xFF000000; \ + break; \ + case 1: \ + *addrp &= piQxelAnd[2] | 0xFF; \ + break; \ + case 3: \ + *addrp &= 0xFFFFFF | piQxelAnd[0]; \ + *(addrp+1) &= 0xFFFF0000 | piQxelAnd[1]; \ + break; \ + case 2: \ + *addrp &= 0xFFFF | piQxelAnd[1]; \ + *(addrp+1) &= 0xFFFFFF00 | piQxelAnd[2]; \ + break; \ + } +#endif +#if RROP == GXor +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp |= piQxelOr[0] & 0xFFFFFF; \ + break; \ + case 1: \ + *addrp |= piQxelOr[2] & 0xFFFFFF00; \ + break; \ + case 3: \ + *addrp |= piQxelOr[0] & 0xFF000000; \ + *(addrp+1) |= piQxelOr[1] & 0xFFFF; \ + break; \ + case 2: \ + *addrp |= piQxelOr[1] & 0xFFFF0000; \ + *(addrp+1) |= piQxelOr[2] & 0xFF; \ + break; \ + } +#endif +#if RROP == GXset +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) \ + ^ (piQxelXor[0] & 0xFFFFFF); \ + break; \ + case 1: \ + *addrp = (*addrp & (piQxelAnd[2]|0xFF)) \ + ^ (piQxelXor[2] & 0xFFFFFF00); \ + break; \ + case 3: \ + *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) \ + ^ (piQxelXor[0] & 0xFF000000); \ + *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) \ + ^ (piQxelXor[1] & 0xFFFF); \ + break; \ + case 2: \ + *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) \ + ^ (piQxelXor[1] & 0xFFFF0000); \ + *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) \ + ^ (piQxelXor[2] & 0xFF); \ + break; \ + } +#endif +#endif /* PSZ == 24 */ + +#define BUGFIX_clip + #ifdef INCLUDE_DRAW int @@ -158,7 +275,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, int npt; /* number of points */ DDXPointPtr pptInit, pptInitOrig; int *x1p, *y1p, *x2p, *y2p; -#endif /* POLYSEGEMENT */ +#endif /* POLYSEGMENT */ { register long e; register int y1_or_e1; @@ -180,8 +297,8 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #else register int c2; #endif -#ifndef ORIGIN - register int _x1, _y1, _x2, _y2; /* only used for CoordModePrevious */ +#if !defined(ORIGIN) && !defined(POLYSEGMENT) + register int _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0; int extents_x1, extents_y1, extents_x2, extents_y2; #endif /* !ORIGIN */ #ifndef PREVIOUS @@ -213,6 +330,16 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, cfbPrivGCPtr devPriv; BoxPtr extents; int *ppt; +#if PSZ == 24 + int xBase; /* x of addr */ + int xOffset; /* x of addrp */ + PixelType *addrLineEnd; + char *addrb; + int stepmajor3, stepminor3, majordx, minordx; +#endif +#ifdef BUGFIX_clip + int ex_x1, ex_y1, ex_x2, ex_y2; +#endif int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); @@ -221,14 +348,25 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #ifndef REARRANGE RROP_FETCH_GCPRIV(devPriv); #endif - extents = &devPriv->pCompositeClip->extents; + extents = &pGC->pCompositeClip->extents; #ifndef PREVIOUS c2 = *((int *) &pDrawable->x); c2 -= (c2 & 0x8000) << 1; upperleft = *((int *) &extents->x1) - c2; lowerright = *((int *) &extents->x2) - c2 - 0x00010001; #endif /* !PREVIOUS */ +#ifdef BUGFIX_clip + ex_x1 = extents->x1 - pDrawable->x; + ex_y1 = extents->y1 - pDrawable->y; + ex_x2 = extents->x2 - pDrawable->x; + ex_y2 = extents->y2 - pDrawable->y; +#endif +#if PSZ == 24 + xBase = pDrawable->x; + addr += WIDTH_MUL(pDrawable->y,nwidth); +#else addr = addr + WIDTH_MUL(pDrawable->y,nwidth) + pDrawable->x; +#endif #ifdef POLYSEGMENT capStyle = pGC->capStyle - CapNotLast; ppt = (int *) pSegInit; @@ -256,7 +394,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, *y2p = _y1 + _y2; return 1; } +#if PSZ == 24 + addrLineEnd = addr + WIDTH_MUL(_y1, nwidth); + xOffset = xBase + _x1; + addrb = (char *)addrLineEnd + xOffset * 3; + addrp = (PixelType *)((unsigned long)addrb & ~0x03); +#else addrp = addr + WIDTH_MUL(_y1, nwidth) + _x1; +#endif _x2 = _x1; _y2 = _y1; } @@ -275,7 +420,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #ifdef SAVE_X2Y2 intToCoord(c2,x2,y2); #endif +#if PSZ == 24 + addrLineEnd = addr + WIDTH_MUL(Y2, nwidth); + xOffset = xBase + X2; + addrb = (char *)addrLineEnd + xOffset * 3; + addrp = (PixelType *)((unsigned long)addrb & ~0x03); +#else addrp = addr + WIDTH_MUL(Y2, nwidth) + X2; +#endif } #endif /* !PREVIOUS */ while (--npt) @@ -289,7 +441,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, break; intToCoord(y1_or_e1,x1_or_len,y1_or_e1); /* compute now to avoid needing x1, y1 later */ +#if PSZ == 24 + addrLineEnd = addr + WIDTH_MUL(y1_or_e1, nwidth); + xOffset = xBase + x1_or_len; + addrb = (char *)addrLineEnd + xOffset * 3; + addrp = (PixelType *)((unsigned long)addrb & ~0x03); +#else addrp = addr + WIDTH_MUL(y1_or_e1, nwidth) + x1_or_len; +#endif #else /* !POLYSEGMENT */ #ifdef EITHER_MODE if (!mode) @@ -304,8 +463,13 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, _x2 = _x1 + _x2; _y2 = _y1 + _y2; +#ifdef BUGFIX_clip + if (_x2 < ex_x1 || _x2 >= ex_x2 || + _y2 < ex_y1 || _y2 >= ex_y2) +#else if (_x2 < extents_x1 || _x2 >= extents_x2 || _y2 < extents_y1 || _y2 >= extents_y2) +#endif { break; } @@ -384,6 +548,32 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, FIXUP_ERROR(e, octant, bias); +#if PSZ == 24 + if (stepmajor == 1 || stepmajor == -1){ + stepmajor3 = stepmajor * 3; + stepminor3 = stepminor * sizeof (CfbBits); + majordx = stepmajor; minordx = 0; + } else { + stepmajor3 = stepmajor * sizeof (CfbBits); + stepminor3 = stepminor * 3; + majordx = 0; minordx = stepminor; + } +#endif + +#if PSZ == 24 +#define body {\ + body_rop \ + addrb += stepmajor3; \ + xOffset += majordx; \ + e += y1_or_e1; \ + if (e >= 0){ \ + addrb += stepminor3; \ + xOffset += minordx; \ + e += e3; \ + } \ + } +#else /* PSZ == 24 */ + #define body {\ RROP_SOLID(addrp); \ addrp += stepmajor; \ @@ -394,6 +584,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, e += e3; \ } \ } +#endif /* PSZ == 24 */ #ifdef LARGE_INSTRUCTION_CACHE @@ -447,13 +638,20 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #endif /* LARGE_INSTRUCTION_CACHE */ #ifdef POLYSEGMENT +#if PSZ == 24 + body_rop +#else RROP_SOLID(addrp); #endif +#endif +#if PSZ == 24 + addrp = (PixelType *)((unsigned long)addrb & ~0x03); +#endif } #undef body #ifdef POLYSEGMENT } - else + else /* Polysegment horizontal line optimization */ { # ifdef REARRANGE register int e3; @@ -462,19 +660,40 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, # endif /* REARRANGE */ if (stepmajor < 0) { +#if PSZ == 24 + xOffset -= x1_or_len; + addrp = addrLineEnd + PXL2ADR(xOffset); +#else addrp -= x1_or_len; +#endif if (capStyle) x1_or_len++; else +#if PSZ == 24 + xOffset++; + addrp = addrLineEnd + PXL2ADR(xOffset); +#else addrp++; +#endif } else { +#if PSZ == 24 + addrp = addrLineEnd + PXL2ADR(xOffset); +#endif if (capStyle) x1_or_len++; } - y1_or_e1 = ((int) addrp) & PIM; +# if PSZ == 24 + y1_or_e1 = xOffset & 3; +# else +# if PGSZ == 64 /* PIM value from <cfbmskbits.h> is not it! (for 16/32 PSZ)*/ + y1_or_e1 = ((long) addrp) & 0x7; addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1); +# else + y1_or_e1 = ((long) addrp) & PIM; + addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1); +# endif #if PGSZ == 32 # if PWSH != 2 y1_or_e1 >>= (2 - PWSH); @@ -484,12 +703,219 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, y1_or_e1 >>= (3 - PWSH); # endif #endif /* PGSZ */ +# endif /* PSZ == 24 */ +#if PSZ == 24 + { +#if RROP == GXcopy + register int nlmiddle; + int leftIndex = xOffset & 3; + int rightIndex = (xOffset + x1_or_len) & 3; +#else + register int pidx; +#endif + +#if RROP == GXcopy + nlmiddle = x1_or_len; + if(leftIndex){ + nlmiddle -= (4 - leftIndex); + } + if(rightIndex){ + nlmiddle -= rightIndex; + } + + nlmiddle >>= 2; + switch(leftIndex+x1_or_len){ + case 4: + switch(leftIndex){ + case 0: + *addrp++ = piQxelXor[0]; + *addrp++ = piQxelXor[1]; + *addrp = piQxelXor[2]; + break; + case 1: + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = piQxelXor[1]; + addrp++; + *addrp = piQxelXor[2]; + break; + case 2: + *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrp++; + *addrp = piQxelXor[2]; + break; + case 3: + *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); + break; + } + break; + case 3: + switch(leftIndex){ + case 0: + *addrp++ = piQxelXor[0]; + *addrp++ = piQxelXor[1]; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + case 1: + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = piQxelXor[1]; + addrp++; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + case 2: + *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrp++; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + } + break; + case 2: + switch(leftIndex){ +/* + case 2: + *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrp++; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; +*/ + case 1: + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + break; + case 0: + *addrp++ = piQxelXor[0]; + *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + break; + } + break; + case 1: /*only if leftIndex = 0 and w = 1*/ + if(x1_or_len){ + *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); + } +/* + else{ + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + } +*/ + break; + case 0: /*never*/ + break; + default: + { +/* + maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len) +*/ + switch(leftIndex){ + case 0: + break; + case 1: + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = piQxelXor[1]; + addrp++; + *addrp = piQxelXor[2]; + addrp++; + break; + case 2: + *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrp++; + *addrp = piQxelXor[2]; + addrp++; + break; + case 3: + *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); + addrp++; + break; + } + while(nlmiddle--){ + *addrp++ = piQxelXor[0]; + *addrp++ = piQxelXor[1]; + *addrp++ = piQxelXor[2]; + } + switch(rightIndex++){ + case 0: + break; + case 1: + *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); + break; + case 2: + *addrp++ = piQxelXor[0]; + *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + break; + case 3: + *addrp++ = piQxelXor[0]; + *addrp++ = piQxelXor[1]; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + } +/* + if (e3){ + e3 &= 0xFFFFFF; + switch(rightIndex&3){ + case 0: + *addrp = ((*addrp) & (0xFF000000 | ~e3)) + | (piQxelXor[0] & 0xFFFFFF & e3); + break; + case 1: + *addrp = ((*addrp) & (0xFFFFFF | ~(e3<<24))) + + (piQxelXor[0] & 0xFF000000 & (e3<<24)); + addrp++; + *addrp = ((*addrp) & (0xFFFF0000|~(e3 >> 8))) + | (piQxelXor[1] & 0xFFFF & (e3 >> 8)); + break; + case 2: + *addrp = ((*addrp) & (0xFFFF|~(e3 << 16))) + | (piQxelXor[1] & 0xFFFF0000 & (e3 << 16)); + addrp++; + *addrp = ((*addrp) & (0xFFFFFF00|~(e3>>16))) + | (piQxelXor[2] & 0xFF & (e3 >> 16)); + break; + case 3: + *addrp = ((*addrp) & (0xFF|~(e3<<8))) + | (piQxelXor[2] & 0xFFFFFF00 & (e3<<8)); + addrp++; + break; + } + } +*/ + } + } +#else /* GXcopy */ + addrp = (PixelType *)((char *)addrLineEnd + ((xOffset * 3) & ~0x03)); + if (x1_or_len <= 1){ + if (x1_or_len) + RROP_SOLID24(addrp, xOffset); + } else { + maskbits(xOffset, x1_or_len, e, e3, x1_or_len); + pidx = xOffset & 3; + if (e){ + RROP_SOLID_MASK(addrp, e, pidx-1); + addrp++; + if (pidx == 3) + pidx = 0; + } + while (--x1_or_len >= 0){ + RROP_SOLID(addrp, pidx); + addrp++; + if (++pidx == 3) + pidx = 0; + } + if (e3) + RROP_SOLID_MASK(addrp, e3, pidx); + } +#endif /* GXcopy */ + } +#else /* PSZ == 24 */ if (y1_or_e1 + x1_or_len <= PPW) { if (x1_or_len) { maskpartialbits(y1_or_e1, x1_or_len, e) - RROP_SOLID_MASK((unsigned long *) addrp, e); + RROP_SOLID_MASK((CfbBits *) addrp, e); } } else @@ -497,13 +923,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len) if (e) { - RROP_SOLID_MASK((unsigned long *) addrp, e); + RROP_SOLID_MASK((CfbBits *) addrp, e); addrp += PPW; } RROP_SPAN(addrp, x1_or_len) if (e3) - RROP_SOLID_MASK((unsigned long *) addrp, e3); + RROP_SOLID_MASK((CfbBits *) addrp, e3); } +#endif /* PSZ == 24 */ } #endif /* POLYSEGMENT */ } @@ -526,9 +953,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #endif /* !ORIGIN */ return ((DDXPointPtr) ppt - pptInit) - 1; } -#endif /* POLYSEGMENT */ -#ifndef POLYSEGMENT # ifndef ORIGIN # define C2 c2 # else @@ -558,7 +983,100 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, RROP_FETCH_GCPRIV(devPriv); # endif +#if PSZ == 24 +#if RROP == GXcopy + switch(xOffset & 3){ + case 0: + *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); + break; + case 3: + *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); + break; + case 1: + *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); + *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); + break; + case 2: + *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); + *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); + break; + } +#endif +#if RROP == GXxor + switch(xOffset & 3){ + case 0: + *addrp ^= (piQxelXor[0] & 0xFFFFFF); + break; + case 3: + *addrp ^= (piQxelXor[2] & 0xFFFFFF00); + break; + case 1: + *addrp ^= (piQxelXor[0] & 0xFF000000); + *(addrp+1) ^= (piQxelXor[1] & 0xFFFF); + break; + case 2: + *addrp ^= (piQxelXor[1] & 0xFFFF0000); + *(addrp+1) ^= (piQxelXor[2] & 0xFF); + break; + } +#endif +#if RROP == GXand + switch(xOffset & 3){ + case 0: + *addrp &= (piQxelAnd[0] | 0xFF000000); + break; + case 3: + *addrp &= (piQxelAnd[2] | 0xFF); + break; + case 1: + *addrp &= (0xFFFFFF|piQxelAnd[0]); + *(addrp+1) &= (0xFFFF0000|piQxelAnd[1]); + break; + case 2: + *addrp &= (0xFFFF|piQxelAnd[1]); + *(addrp+1) &= (0xFFFFFF00|piQxelAnd[2]); + break; + } +#endif +#if RROP == GXor + switch(xOffset & 3){ + case 0: + *addrp |= (piQxelOr[0] & 0xFFFFFF); + break; + case 3: + *addrp |= (piQxelOr[2] & 0xFFFFFF00); + break; + case 1: + *addrp |= (piQxelOr[0] & 0xFF000000); + *(addrp+1) |= (piQxelOr[1] & 0xFFFF); + break; + case 2: + *addrp |= (piQxelOr[1] & 0xFFFF0000); + *(addrp+1) |= (piQxelOr[2] & 0xFF); + break; + } +#endif +#if RROP == GXset + switch(xOffset & 3){ + case 0: + *addrp = (((*addrp)&(piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); + break; + case 3: + *addrp = (((*addrp)&(piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); + break; + case 1: + *addrp = (((*addrp)&(piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); + *(addrp+1) = (((*(addrp+1))&(piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); + break; + case 2: + *addrp = (((*addrp)&(piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); + *(addrp+1) = (((*(addrp+1))&(piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); + break; + } +#endif +#else RROP_SOLID (addrp); +# endif } #endif /* !POLYSEGMENT */ return -1; @@ -578,14 +1096,21 @@ cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit) int nseg; xSegment *pSegInit; { - int (*func)(); - void (*clip)(); + int (*func)(DrawablePtr, GCPtr, int, xSegment *); + void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool); int drawn; cfbPrivGCPtr devPriv; +#if defined(__arm32__) && PSZ != 8 + /* XXX -JJK */ + /* There is a painting bug when PSZ != 8; I need to track it down! */ + cfbSegmentSS(pDrawable, pGC, nseg, pSegInit); + return; +#endif + devPriv = cfbGetGCPrivate(pGC); #ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) + if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) { cfbSegmentSS(pDrawable, pGC, nseg, pSegInit); return; @@ -618,7 +1143,7 @@ cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit) (*clip) (pDrawable, pGC, pSegInit[drawn-1].x1, pSegInit[drawn-1].y1, pSegInit[drawn-1].x2, pSegInit[drawn-1].y2, - &devPriv->pCompositeClip->extents, + &pGC->pCompositeClip->extents, pGC->capStyle == CapNotLast); pSegInit += drawn; nseg -= drawn; @@ -635,16 +1160,25 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit) int npt; DDXPointPtr pptInit; { - int (*func)(); - void (*clip)(); + int (*func)(DrawablePtr, GCPtr, int, int, + DDXPointPtr, DDXPointPtr, + int *, int *, int *, int *); + void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool); int drawn; cfbPrivGCPtr devPriv; int x1, y1, x2, y2; DDXPointPtr pptInitOrig = pptInit; +#if defined(__arm32__) && PSZ != 8 + /* XXX -JJK */ + /* There is a painting bug when PSZ != 8; I need to track it down! */ + cfbLineSS(pDrawable, pGC, mode, npt, pptInit); + return; +#endif + devPriv = cfbGetGCPrivate(pGC); #ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) + if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) { cfbLineSS(pDrawable, pGC, mode, npt, pptInit); return; @@ -678,7 +1212,7 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit) if (drawn == -1) break; (*clip) (pDrawable, pGC, x1, y1, x2, y2, - &devPriv->pCompositeClip->extents, + &pGC->pCompositeClip->extents, drawn != npt - 1 || pGC->capStyle == CapNotLast); pptInit += drawn; npt -= drawn; @@ -697,7 +1231,7 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit) (*clip) (pDrawable, pGC, pptInit[drawn-1].x, pptInit[drawn-1].y, pptInit[drawn].x, pptInit[drawn].y, - &devPriv->pCompositeClip->extents, + &pGC->pCompositeClip->extents, drawn != npt - 1 || pGC->capStyle == CapNotLast); pptInit += drawn; npt -= drawn; @@ -729,6 +1263,12 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) int new_x1, new_y1, new_x2, new_y2; Bool pt1_clipped, pt2_clipped; int changex, changey, result; +#if PSZ == 24 + int xOffset; + PixelType *addrLineEnd; + char *addrb; + int stepx3, stepy3; +#endif int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); @@ -841,12 +1381,32 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) RROP_FETCH_GC(pGC); +#if PSZ == 24 + xOffset = x1; + addrLineEnd = addr + (y1 * nwidth); + addrb = (char *)addrLineEnd + x1 * 3; + if (stepx == 1 || stepx == -1){ + stepx3 = stepx * 3; + stepy3 = stepy * sizeof (CfbBits); + } else { + stepx3 = stepx * sizeof (CfbBits); + stepy3 = stepy * 3; + } +#else addrp = addr + (y1 * nwidth) + x1; +#endif #ifndef REARRANGE if (!ady) { +#if PSZ == 24 +#define body {\ + body_rop \ + addrb += stepx3; \ + } +#else #define body { RROP_SOLID(addrp); addrp += stepx; } +#endif while (len >= PGSZB) { body body body body @@ -867,6 +1427,18 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) else #endif /* !REARRANGE */ { +#if PSZ == 24 +#define body {\ + body_rop \ + addrb += stepx3; \ + e += e1; \ + if (e >= 0) \ + { \ + addrb += stepy3; \ + e += e3; \ + } \ + } +#else #define body {\ RROP_SOLID(addrp); \ addrp += stepx; \ @@ -877,6 +1449,7 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) e += e3; \ } \ } +#endif #ifdef LARGE_INSTRUCTION_CACHE while ((len -= PGSZB) >= 0) @@ -906,7 +1479,11 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) IMPORTANT_END; #endif /* LARGE_INSTRUCTION_CACHE */ } +#if PSZ == 24 + body_rop +#else RROP_SOLID(addrp); +#endif #undef body } } diff --git a/cfb/cfballpriv.c b/cfb/cfballpriv.c index abd634e2c..6c2fa30f3 100644 --- a/cfb/cfballpriv.c +++ b/cfb/cfballpriv.c @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/cfballpriv.c,v 1.12 2001/12/14 19:59:21 dawes Exp $ */ #include "X.h" #include "Xmd.h" @@ -41,13 +42,15 @@ in this Software without prior written authorization from The Open Group. #include "cfbmskbits.h" #include "mibstore.h" +#if PSZ==8 int cfbWindowPrivateIndex; int cfbGCPrivateIndex; +#endif #ifdef CFB_NEED_SCREEN_PRIVATE -int cfbScreenPrivateIndex; +int cfbScreenPrivateIndex = -1; +static unsigned long cfbGeneration = 0; #endif -extern RegionPtr (*cfbPuntCopyPlane)(); Bool cfbAllocatePrivates(pScreen, window_index, gc_index) @@ -55,7 +58,7 @@ cfbAllocatePrivates(pScreen, window_index, gc_index) int *window_index, *gc_index; { if (!window_index || !gc_index || - *window_index == -1 && *gc_index == -1) + (*window_index == -1 && *gc_index == -1)) { if (!mfbAllocatePrivates(pScreen, &cfbWindowPrivateIndex, &cfbGCPrivateIndex)) @@ -74,9 +77,12 @@ cfbAllocatePrivates(pScreen, window_index, gc_index) sizeof(cfbPrivWin)) || !AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC))) return FALSE; - cfbPuntCopyPlane = miCopyPlane; #ifdef CFB_NEED_SCREEN_PRIVATE - cfbScreenPrivateIndex = AllocateScreenPrivateIndex (); + if (cfbGeneration != serverGeneration) + { + cfbScreenPrivateIndex = AllocateScreenPrivateIndex (); + cfbGeneration = serverGeneration; + } if (cfbScreenPrivateIndex == -1) return FALSE; #endif diff --git a/cfb/cfbbitblt.c b/cfb/cfbbitblt.c index 3afe4eb81..595d68c66 100644 --- a/cfb/cfbbitblt.c +++ b/cfb/cfbbitblt.c @@ -2,6 +2,8 @@ * cfb copy area */ +/* $XFree86: xc/programs/Xserver/cfb/cfbbitblt.c,v 1.14 2001/12/14 19:59:21 dawes Exp $ */ + /* Copyright 1989, 1998 The Open Group @@ -39,6 +41,7 @@ Author: Keith Packard #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" +#include "mi.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfb8bit.h" @@ -46,6 +49,25 @@ Author: Keith Packard #define MFB_CONSTS_ONLY #include "maskbits.h" +#if PSZ == 8 +#define cfbCopyPlane1toN cfbCopyPlane1to8 +#define cfbCopyPlaneNto1 cfbCopyPlane8to1 +#else +static unsigned int FgPixel, BgPixel; +# if PSZ == 16 +#define cfbCopyPlane1toN cfbCopyPlane1to16 +#define cfbCopyPlaneNto1 cfbCopyPlane16to1 +# endif +# if PSZ == 24 +#define cfbCopyPlane1toN cfbCopyPlane1to24 +#define cfbCopyPlaneNto1 cfbCopyPlane24to1 +# endif +# if PSZ == 32 +#define cfbCopyPlane1toN cfbCopyPlane1to32 +#define cfbCopyPlaneNto1 cfbCopyPlane32to1 +# endif +#endif + RegionPtr cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane) @@ -58,7 +80,7 @@ cfbBitBlt (pSrcDrawable, pDstDrawable, void (*doBitBlt)(); unsigned long bitPlane; { - RegionPtr prgnSrcClip; /* may be a new region, or just a copy */ + RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ Bool freeSrcClip = FALSE; RegionPtr prgnExposed; @@ -110,7 +132,13 @@ cfbBitBlt (pSrcDrawable, pDstDrawable, { if (pGC->subWindowMode == IncludeInferiors) { - if (!((WindowPtr) pSrcDrawable)->parent) + /* + * XFree86 DDX empties the border clip when the + * VT is inactive + */ + if (!((WindowPtr) pSrcDrawable)->parent && + REGION_NOTEMPTY (pSrcDrawable->pScreen, + &((WindowPtr) pSrcDrawable)->borderClip)) { /* * special case bitblt from root window in @@ -279,7 +307,7 @@ cfbBitBlt (pSrcDrawable, pDstDrawable, } prgnExposed = NULL; - if ( cfbGetGCPrivate(pGC)->fExpose) + if (pGC->fExpose) { extern RegionPtr miHandleExposures(); @@ -376,22 +404,22 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b int width, height; /* in pixels, unpadded, of box being copied */ int xoffSrc; /* bit # in leftmost word of row from which copying starts */ int xoffDst; /* byte # in leftmost word of row from which copying starts */ - unsigned long *psrcBase, *pdstBase; /* start of drawable's pixel data */ + CfbBits *psrcBase, *pdstBase; /* start of drawable's pixel data */ int widthSrc; /* # of groups of 32 pixels (1 bit/pixel) in src bitmap*/ int widthDst; /* # of groups of 4 pixels (8 bits/pixel) in dst */ - unsigned long *psrcLine, *pdstLine; /* steps a row at a time thru src/dst; + CfbBits *psrcLine, *pdstLine; /* steps a row at a time thru src/dst; * may point into middle of row */ - register unsigned long *psrc, *pdst; /* steps within the row */ - register unsigned long bits, tmp; /* bits from source */ + register CfbBits *psrc, *pdst; /* steps within the row */ + register CfbBits bits, tmp; /* bits from source */ register int leftShift; register int rightShift; - unsigned long startmask; /* left edge pixel mask */ - unsigned long endmask; /* right edge pixel mask */ + CfbBits startmask; /* left edge pixel mask */ + CfbBits endmask; /* right edge pixel mask */ register int nlMiddle; /* number of words in middle of the row to draw */ register int nl; - int firstoff; - int secondoff; - unsigned long src; + int firstoff = 0; + int secondoff = 0; + CfbBits src; int nbox; /* number of boxes in region to copy */ BoxPtr pbox; /* steps thru boxes in region */ int pixelsRemainingOnRightEdge; /* # pixels to be drawn on a row after @@ -529,11 +557,11 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b # define FirstStep(c) c = BitLeft (c, 8); #else /* 0x3c is 0xf << 2 (4 bits, long word) */ -# define StoreBits(o,c) StorePixels(pdst,o,*((unsigned long *)\ +# define StoreBits(o,c) StorePixels(pdst,o,*((CfbBits *)\ (((char *) cfb8Pixels) + (c & 0x3c)))) # define StoreRopBits(o,c) StoreRopPixels(pdst,o, \ - *((unsigned long *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \ - *((unsigned long *) (((char *) cfb8StippleXor) + (c & 0x3c)))) + *((CfbBits *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \ + *((CfbBits *) (((char *) cfb8StippleXor) + (c & 0x3c)))) # define FirstStep(c) c = BitLeft (c, 2); #endif /* PGSZ */ #endif /* BITMAP_BIT_ORDER */ @@ -662,10 +690,379 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b } /* end iteration over region boxes */ } +#else /* PSZ == 8 */ + +#define mfbmaskbits(x, w, startmask, endmask, nlw) \ + startmask = starttab[(x)&0x1f]; \ + endmask = endtab[((x)+(w)) & 0x1f]; \ + if (startmask) \ + nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \ + else \ + nlw = (w) >> 5; + +#define mfbmaskpartialbits(x, w, mask) \ + mask = partmasks[(x)&0x1f][(w)&0x1f]; + +#define LeftMost 0 +#define StepBit(bit, inc) ((bit) += (inc)) + + +#define GetBits(psrc, nBits, curBit, bitPos, bits) {\ + bits = 0; \ + while (nBits--) \ + { \ + bits |= ((*psrc++ >> bitPos) & 1) << curBit; \ + StepBit (curBit, 1); \ + } \ +} + +/******************************************************************/ + +void +#if PSZ == 16 +cfbCopyPlane1to16 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, + planemask, bitPlane) +#endif +#if PSZ == 24 +cfbCopyPlane1to24 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, + planemask, bitPlane) +#endif +#if PSZ == 32 +cfbCopyPlane1to32 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, + planemask, bitPlane) +#endif + DrawablePtr pSrcDrawable; + DrawablePtr pDstDrawable; + int rop; + unsigned long planemask; + RegionPtr prgnDst; + DDXPointPtr pptSrc; + unsigned long bitPlane; +{ + int srcx, srcy, dstx, dsty; + int width, height; + int xoffSrc; + CfbBits *psrcBase, *pdstBase; + int widthSrc, widthDst; + unsigned int *psrcLine; + register unsigned int *psrc; +#if PSZ == 16 + unsigned short *pdstLine; + register unsigned short *pdst; +#endif +#if PSZ == 32 + unsigned int *pdstLine; + register unsigned int *pdst; +#endif +#if PSZ == 24 + unsigned char *pdstLine; + register unsigned char *pdst; +#endif + register unsigned int bits, tmp; + register unsigned int fgpixel, bgpixel; + register unsigned int src; +#if PSZ == 24 + register unsigned int dst; +#endif + register int leftShift, rightShift; + register int i, nl; + int nbox; + BoxPtr pbox; + int result; + +#if PSZ == 16 + unsigned int doublet[4]; /* Pixel values for 16bpp expansion. */ +#endif +#if PSZ == 32 + unsigned int doublet[8]; /* Pixel values for 32bpp expansion */ +#endif + + fgpixel = FgPixel & planemask; + bgpixel = BgPixel & planemask; + +#if PSZ == 16 + if (rop == GXcopy && (planemask & PMSK) == PMSK) { + doublet[0] = bgpixel | (bgpixel << 16); + doublet[1] = fgpixel | (bgpixel << 16); + doublet[2] = bgpixel | (fgpixel << 16); + doublet[3] = fgpixel | (fgpixel << 16); + } +#endif +#if PSZ == 32 + if (rop == GXcopy && (planemask & PMSK) == PMSK) { + doublet[0] = bgpixel; doublet[1] = bgpixel; + doublet[2] = fgpixel; doublet[3] = bgpixel; + doublet[4] = bgpixel; doublet[5] = fgpixel; + doublet[6] = fgpixel; doublet[7] = fgpixel; + } +#endif + + /* must explicitly ask for "int" widths, as code below expects it */ + /* on some machines (Alpha), "long" and "int" are not the same size */ + cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, CfbBits) + cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, CfbBits) + +#if PSZ == 16 + widthDst <<= 1; +#endif +#if PSZ == 24 + widthDst <<= 2; +#endif + + nbox = REGION_NUM_RECTS(prgnDst); + pbox = REGION_RECTS(prgnDst); + + while (nbox--) + { + dstx = pbox->x1; + dsty = pbox->y1; + srcx = pptSrc->x; + srcy = pptSrc->y; + width = pbox->x2 - pbox->x1; + height = pbox->y2 - pbox->y1; + pbox++; + pptSrc++; + psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + (srcx >> 5); +#if PSZ == 16 + pdstLine = (unsigned short *)pdstBase + dsty * widthDst + dstx; +#endif +#if PSZ == 24 + pdstLine = (unsigned char *)pdstBase + dsty * widthDst + dstx * 3; +#endif +#if PSZ == 32 + pdstLine = (unsigned int *)pdstBase + dsty * widthDst + dstx; +#endif + xoffSrc = srcx & 0x1f; + + /* + * compute constants for the first four bits to be + * copied. This avoids troubles with partial first + * writes, and difficult shift computation + */ + leftShift = xoffSrc; + rightShift = 32 - leftShift; + + if (rop == GXcopy && (planemask & PMSK) == PMSK) + { + while (height--) + { + psrc = psrcLine; + pdst = pdstLine; + psrcLine += widthSrc; + pdstLine += widthDst; + bits = *psrc++; + nl = width; + while (nl >= 32) + { + tmp = BitLeft(bits, leftShift); + bits = *psrc++; + if (rightShift != 32) + tmp |= BitRight(bits, rightShift); + i = 0; +#if PSZ == 16 + /* + * I've thrown in some optimization to at least write + * some aligned 32-bit words instead of 16-bit shorts. + */ + if ((unsigned long)psrc & 2) { + /* Write unaligned 16-bit word at left edge. */ + if (tmp & 0x01) + *pdst = fgpixel; + else + *pdst = bgpixel; + pdst++; + i++; + } + while (i <= 24) + { + unsigned tmpbits = tmp >> i; + *(unsigned int *)pdst = doublet[tmpbits & 0x03]; + *(unsigned int *)(pdst + 2) = + doublet[(tmpbits >> 2) & 0x03]; + *(unsigned int *)(pdst + 4) = + doublet[(tmpbits >> 4) & 0x03]; + *(unsigned int *)(pdst + 6) = + doublet[(tmpbits >> 6) & 0x03]; + pdst += 8; /* Advance four 32-bit words. */ + i += 8; + } + while (i <= 30) + { + *(unsigned int *)pdst = + doublet[(tmp >> i) & 0x03]; + pdst += 2; /* Advance one 32-bit word. */ + i += 2; + } + if (i == 31) { + if ((tmp >> 31) & 0x01) + *pdst = fgpixel; + else + *pdst = bgpixel; + pdst++; + } +#endif +#if PSZ == 24 + while (i < 32) { + if ((tmp >> i) & 0x01) { + *pdst = fgpixel; + *(pdst + 1) = fgpixel >> 8; + *(pdst + 2) = fgpixel >> 16; + } + else { + *pdst = bgpixel; + *(pdst + 1) = bgpixel >> 8; + *(pdst + 2) = bgpixel >> 16; + } + pdst += 3; + i++; + } +#endif +#if PSZ == 32 + while (i <= 28) { + int pair; + pair = (tmp >> i) & 0x03; + *pdst = doublet[pair * 2]; + *(pdst + 1) = doublet[pair * 2 + 1]; + pair = (tmp >> (i + 2)) & 0x03; + *(pdst + 2) = doublet[pair * 2]; + *(pdst + 3) = doublet[pair * 2 + 1]; + pdst += 4; + i += 4; + } + while (i < 32) { + *pdst = ((tmp >> i) & 0x01) ? fgpixel : bgpixel; + pdst++; + i++; + } #endif + nl -= 32; + } + + if (nl) + { + tmp = BitLeft(bits, leftShift); + /* + * better condition needed -- mustn't run + * off the end of the source... + */ + if (rightShift != 32) + { + bits = *psrc++; + tmp |= BitRight (bits, rightShift); + } + i = 32; + while (nl--) + { + --i; +#if PSZ == 24 + if ((tmp >> (31 - i)) & 0x01) { + *pdst = fgpixel; + *(pdst + 1) = fgpixel >> 8; + *(pdst + 2) = fgpixel >> 16; + } + else { + *pdst = bgpixel; + *(pdst + 1) = bgpixel >> 8; + *(pdst + 2) = bgpixel >> 16; + } + pdst += 3; +#else + *pdst = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel; + pdst++; +#endif + } + } + } + } + else + { + while (height--) + { + psrc = psrcLine; + pdst = pdstLine; + psrcLine += widthSrc; + pdstLine += widthDst; + bits = *psrc++; + nl = width; + while (nl >= 32) + { + tmp = BitLeft(bits, leftShift); + bits = *psrc++; + if (rightShift != 32) + tmp |= BitRight(bits, rightShift); + i = 32; + while (i--) + { + src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel; +#if PSZ == 24 + dst = *pdst; + dst |= (*(pdst + 1)) << 8; + dst |= (*(pdst + 2)) << 16; + DoRop (result, rop, src, dst); + *pdst = (dst & ~planemask) | + (result & planemask); + *(pdst+1) = ((dst & ~planemask) >> 8) | + ((result & planemask) >> 8); + *(pdst+2) = ((dst & ~planemask) >> 16) | + ((result & planemask) >> 16); + pdst += 3; +#else + DoRop (result, rop, src, *pdst); + + *pdst = (*pdst & ~planemask) | + (result & planemask); + pdst++; +#endif + } + nl -= 32; + } + + if (nl) + { + tmp = BitLeft(bits, leftShift); + /* + * better condition needed -- mustn't run + * off the end of the source... + */ + if (rightShift != 32) + { + bits = *psrc++; + tmp |= BitRight (bits, rightShift); + } + i = 32; + while (nl--) + { + --i; + src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel; +#if PSZ == 24 + dst = *pdst; + dst |= (*(pdst + 1)) << 8; + dst |= (*(pdst + 2)) << 16; + DoRop (result, rop, src, dst); + *pdst = (dst & ~planemask) | + (result & planemask); + *(pdst+1) = ((dst & ~planemask) >> 8) | + ((result & planemask) >> 8); + *(pdst+2) = ((dst & ~planemask) >> 16) | + ((result & planemask) >> 16); + pdst += 3; +#else + DoRop (result, rop, src, *pdst); + + *pdst = (*pdst & ~planemask) | + (result & planemask); + pdst++; +#endif + } + } + } + } + } +} + +#endif /* PSZ == 8 */ /* shared among all different cfb depths through linker magic */ -RegionPtr (*cfbPuntCopyPlane)(); RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane) @@ -678,19 +1075,24 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, unsigned long bitPlane; { RegionPtr ret; - extern RegionPtr miHandleExposures(); - void (*doBitBlt)(); -#if PSZ == 8 +#if IMAGE_BYTE_ORDER == LSBFirst + + void (*doBitBlt)(); - if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == 8) + if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == PSZ) { if (bitPlane == 1) { - doBitBlt = cfbCopyPlane1to8; + doBitBlt = cfbCopyPlane1toN; +#if PSZ == 8 cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); +#else + FgPixel = pGC->fgPixel; + BgPixel = pGC->bgPixel; +#endif ret = cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane); } @@ -698,7 +1100,7 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); } - else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 1) + else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == 1) { extern int InverseAlu[16]; int oldalu; @@ -710,10 +1112,10 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel); ret = cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, - cfbCopyPlane8to1, bitPlane); + cfbCopyPlaneNto1, bitPlane); pGC->alu = oldalu; } - else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 8) + else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == PSZ) { PixmapPtr pBitmap; ScreenPtr pScreen = pSrcDrawable->pScreen; @@ -729,7 +1131,7 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, return NULL; } /* - * don't need to set pGC->fgPixel,bgPixel as copyPlane8to1 + * don't need to set pGC->fgPixel,bgPixel as copyPlaneNto1 * ignores pixel values, expecting the rop to "do the * right thing", which GXcopy will. */ @@ -737,13 +1139,18 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, /* no exposures here, scratch GC's don't get graphics expose */ (void) cfbBitBlt (pSrcDrawable, (DrawablePtr) pBitmap, pGC1, srcx, srcy, width, height, 0, 0, - cfbCopyPlane8to1, bitPlane); + cfbCopyPlaneNto1, bitPlane); +#if PSZ == 8 cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); +#else + FgPixel = pGC->fgPixel; + BgPixel = pGC->bgPixel; +#endif /* no exposures here, copy bits from inside a pixmap */ (void) cfbBitBlt ((DrawablePtr) pBitmap, pDstDrawable, pGC, - 0, 0, width, height, dstx, dsty, cfbCopyPlane1to8, 1); + 0, 0, width, height, dstx, dsty, cfbCopyPlane1toN, 1); FreeScratchGC (pGC1); (*pScreen->DestroyPixmap) (pBitmap); /* compute resultant exposures */ @@ -753,7 +1160,9 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, } else #endif - ret = (*cfbPuntCopyPlane) (pSrcDrawable, pDstDrawable, + ret = miCopyPlane (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); return ret; } + + diff --git a/cfb/cfbblt.c b/cfb/cfbblt.c index f87acc03d..aafe44669 100644 --- a/cfb/cfbblt.c +++ b/cfb/cfbblt.c @@ -1,6 +1,7 @@ /* * cfb copy area */ +/* $XFree86: xc/programs/Xserver/cfb/cfbblt.c,v 3.12 2001/12/14 19:59:21 dawes Exp $ */ /* @@ -31,6 +32,8 @@ Author: Keith Packard */ /* $Xorg: cfbblt.c,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $ */ +/* 24-bit bug fixes: Peter Wainwright, 1998/11/28 */ + #include "X.h" #include "Xmd.h" #include "Xproto.h" @@ -55,6 +58,65 @@ Author: Keith Packard #define DO_MEMCPY #endif +/* ................................................. */ +/* SPECIAL CODE FOR 24 BITS by Peter Wainwright */ + +#if PSZ == 24 && (MROP) == 0 + +/* The default macros are defined in mergerop.h, and none of them are + really appropriate for what we want to do. + + There are two ways of fixing this: either define SLOW_24BIT_COPY + to copy pixel by pixel, or (by default) use the following macros + modified from mergerop.h + + MROP_SOLID and MROP_MASK are defined for each of the operations, + i.e. each value of MROP. + + There are special cases for Mcopy, McopyInverted, Mxor, and Mor. + There is a completely generic version for MROP=0, and a simplified + generic version which works for (Mcopy|Mxor|MandReverse|Mor). + + However, the generic version does not work for the 24-bit case + because the pixels cannot be packed exactly into a machine word (32 + bits). + + Alternative macros MROP_SOLID24 and MROP_MASK24 are provided for + the 24-bit case. However, these each copy a single *pixel*, not a + single machine word. They take an rvalue source pixel, an lvalue + destination, and the pixel index. The latter is used to find the + position of the pixel data within the two words *dst and *(dst+1). + + Further macros MROP_SOLID24P and MROP_MASK24P are used to copy from + an lvalue source to an lvalue destination. MROP_PIXEL24 is used to + assemble the source pixel from the adjacent words *src and + *(src+1), and this is then split between the destination words + using the non-P macros above. + + But we want to copy entire words for the sake of efficiency. + Unfortunately if a plane mask is specified this must be shifted + from one word to the next. Fortunately the pattern repeats after 3 + words, so we unroll the planemask here and redefine MROP_SOLID + and MROP_MASK. */ + + +#endif /* MROP == 0 && PSZ == 24 */ + +/* ................................................. */ + +#if PSZ == 24 +#define BYPP 3 +#if PGSZ == 32 +#define P3W 4 /* pixels in 3 machine words */ +#define PAM 3 /* pixel align mask; PAM = P3W -1 */ +#define P2WSH 2 +#else +#define P3W 8 /* pixels in 3 machine words */ +#define PAM 7 /* pixel align mask; PAM = P3W -1 */ +#define P2WSH 3 +#endif +#endif + void MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) DrawablePtr pSrc, pDst; @@ -63,7 +125,7 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) DDXPointPtr pptSrc; unsigned long planemask; { - unsigned long *psrcBase, *pdstBase; + CfbBits *psrcBase, *pdstBase; /* start of src and dst bitmaps */ int widthSrc, widthDst; /* add to get to same position in next line */ @@ -79,31 +141,42 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) int xdir; /* 1 = left right, -1 = right left/ */ int ydir; /* 1 = top down, -1 = bottom up */ - unsigned long *psrcLine, *pdstLine; + CfbBits *psrcLine, *pdstLine; /* pointers to line with current src and dst */ - register unsigned long *psrc;/* pointer to current src longword */ - register unsigned long *pdst;/* pointer to current dst longword */ + register CfbBits *psrc;/* pointer to current src longword */ + register CfbBits *pdst;/* pointer to current dst longword */ MROP_DECLARE_REG() /* following used for looping through a line */ - unsigned long startmask, endmask; /* masks for writing ends of dst */ + CfbBits startmask, endmask; /* masks for writing ends of dst */ int nlMiddle; /* whole longwords in dst */ int xoffSrc, xoffDst; - register int leftShift, rightShift; - register unsigned long bits; - register unsigned long bits1; register int nl; /* temp copy of nlMiddle */ - - /* place to store full source word */ - int nstart; /* number of ragged bits at start of dst */ - int nend; /* number of ragged bits at end of dst */ - int srcStartOver; /* pulling nstart bits from src - overflows into the next word? */ int careful; - int tmpSrc; - MROP_INITIALIZE(alu,planemask); +#if (PSZ != 24) || (MROP != 0) + register int leftShift, rightShift; + register CfbBits bits; + register CfbBits bits1; +#endif + +#if PSZ == 24 +#ifdef DO_MEMCPY + int w2; +#endif + +#if MROP == 0 + unsigned char *psrcBaseByte, *pdstBaseByte; + int widthSrcBytes, widthDstBytes; + + cfbGetByteWidthAndPointer (pSrc, widthSrcBytes, psrcBaseByte) + + cfbGetByteWidthAndPointer (pDst, widthDstBytes, pdstBaseByte) +#endif +#endif + + MROP_INITIALIZE(alu,planemask) cfbGetLongWidthAndPointer (pSrc, widthSrc, psrcBase) @@ -222,6 +295,11 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) w = pbox->x2 - pbox->x1; h = pbox->y2 - pbox->y1; +#if PSZ == 24 +#ifdef DO_MEMCPY + w2 = w * BYPP; +#endif +#endif if (ydir == -1) /* start at last scanline of rectangle */ { psrcLine = psrcBase + ((pptSrc->y+h-1) * -widthSrc); @@ -232,7 +310,11 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) psrcLine = psrcBase + (pptSrc->y * widthSrc); pdstLine = pdstBase + (pbox->y1 * widthDst); } +#if PSZ == 24 + if (w == 1 && ((pbox->x1 & PAM) == 0 || (pbox->x1 & PAM) == PAM)) +#else if ((pbox->x1 & PIM) + w <= PPW) +#endif { maskpartialbits (pbox->x1, w, endmask); startmask = 0; @@ -243,58 +325,149 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) maskbits(pbox->x1, w, startmask, endmask, nlMiddle); } +#if PSZ == 24 +#if 0 + nlMiddle = w - (pbox->x2 &PAM);; + if(pbox->x1 & PAM){ + nlMiddle -= (PAM+1 - (pbox->x1 &PAM)); + } + nlMiddle >>= P2WSH; + if(nlMiddle < 0) + nlMiddle = 0; +#endif +#endif + #ifdef DO_MEMCPY /* If the src and dst scanline don't overlap, do forward case. */ if ((xdir == 1) || (pptSrc->y != pbox->y1) || (pptSrc->x + w <= pbox->x1)) { +#if PSZ == 24 + char *psrc = (char *) psrcLine + (pptSrc->x * BYPP); + char *pdst = (char *) pdstLine + (pbox->x1 * BYPP); +#else char *psrc = (char *) psrcLine + pptSrc->x; char *pdst = (char *) pdstLine + pbox->x1; +#endif while (h--) { +#if PSZ == 24 + memcpy(pdst, psrc, w2); +#else memcpy(pdst, psrc, w); - pdst += widthDst << 2; - psrc += widthSrc << 2; +#endif + pdst += widthDst << PWSH; + psrc += widthSrc << PWSH; } } #else /* ! DO_MEMCPY */ if (xdir == 1) { +#if PSZ == 24 && MROP == 0 + /* Note: x is a pixel number; the byte offset is 3*x; + therefore the offset within a word is (3*x) & 3 == + (4*x-x) & 3 == (-x) & 3. The offsets therefore + DECREASE by 1 for each pixel. + */ + xoffSrc = ( - pptSrc->x) & PAM; + xoffDst = ( - pbox->x1) & PAM; +#if 1 + if((int)xoffSrc != (int)xoffDst /* Alignments must be same. */ + || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1)) +#else + if(1) +#endif + /* Width also must be same, if hight > 1 */ + { + /* ...otherwise, pixel by pixel operation */ + while (h--) + { + register int i, si, sii, di; + + for (i = 0, si = pptSrc->x, di = pbox->x1; + i < w; + i++, si++, di++) { + psrc = psrcLine + ((si * BYPP) >> P2WSH); + pdst = pdstLine + ((di * BYPP) >> P2WSH); + sii = (si & 3); + MROP_SOLID24P(psrc, pdst, sii, di); + } + pdstLine += widthDst; + psrcLine += widthSrc; + } + } + else +#endif + { + +#if PSZ == 24 + +#if MROP != 0 + xoffSrc = ( - pptSrc->x) & PAM; + xoffDst = ( - pbox->x1) & PAM; +#endif + pdstLine += (pbox->x1 * BYPP) >> P2WSH; + psrcLine += (pptSrc->x * BYPP) >> P2WSH; +#else xoffSrc = pptSrc->x & PIM; xoffDst = pbox->x1 & PIM; pdstLine += (pbox->x1 >> PWSH); psrcLine += (pptSrc->x >> PWSH); +#endif #ifdef DO_UNALIGNED_BITBLT nl = xoffSrc - xoffDst; - psrcLine = (unsigned long *) + psrcLine = (CfbBits *) (((unsigned char *) psrcLine) + nl); #else +#if PSZ == 24 && MROP == 0 + /* alredy satisfied */ +#else if (xoffSrc == xoffDst) #endif +#endif { while (h--) { +#if PSZ == 24 && MROP == 0 + register int index; + register int im3; +#endif /* PSZ == 24 && MROP == 0 */ psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; +#if PSZ == 24 && MROP == 0 + index = (int)(pdst - pdstBase); + im3 = index % 3; +#endif /* PSZ == 24 && MROP == 0 */ if (startmask) { +#if PSZ == 24 && MROP == 0 + *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, im3); + index++; + im3 = index % 3; +#else /* PSZ != 24 || MROP != 0 */ *pdst = MROP_MASK(*psrc, *pdst, startmask); +#endif /* PSZ == 24 && MROP == 0 */ psrc++; pdst++; } - nl = nlMiddle; + nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); +#if PSZ == 24 && MROP == 0 +#define BodyOdd(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3); +#define BodyEven(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3); +#else /* PSZ != 24 || MROP != 0 */ #define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); +#endif /* PSZ == 24 && MROP == 0 */ #define LoopReset \ pdst += UNROLL; \ @@ -302,8 +475,13 @@ psrc += UNROLL; #else +#if PSZ == 24 && MROP == 0 +#define BodyOdd(n) *pdst = DoMergeRop24u(*psrc, *pdst, im3); pdst++; psrc++; index++; im3 = index % 3; +#define BodyEven(n) BodyOdd(n) +#else /* PSZ != 24 || MROP != 0 */ #define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; #define BodyEven(n) BodyOdd(n) +#endif /* PSZ == 24 && MROP == 0 */ #define LoopReset ; @@ -333,34 +511,55 @@ psrc += UNROLL; while (nl--) *pdst++ = *psrc++; #endif +#if 0 /*PSZ == 24 && MROP == 0*/ + DuffL(nl, label1, + *pdst = DoMergeRop24u(*psrc, *pdst, im3); + pdst++; psrc++; index++;im3 = index % 3;) +#else /* !(PSZ == 24 && MROP == 0) */ DuffL(nl, label1, *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;) +#endif /* PSZ == 24 && MROP == 0 */ #endif if (endmask) +#if PSZ == 24 && MROP == 0 + *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, (int)(pdst - pdstBase) % 3); +#else /* !(PSZ == 24 && MROP == 0) */ *pdst = MROP_MASK(*psrc, *pdst, endmask); +#endif /* PSZ == 24 && MROP == 0 */ } } #ifndef DO_UNALIGNED_BITBLT - else +#if PSZ == 24 && MROP == 0 + /* can not happen */ +#else /* !(PSZ == 24 && MROP == 0) */ + else /* xoffSrc != xoffDst */ { if (xoffSrc > xoffDst) { +#if PSZ == 24 + leftShift = (xoffSrc - xoffDst) << 3; +#else #if PGSZ == 32 leftShift = (xoffSrc - xoffDst) << (5 - PWSH); #else /* PGSZ == 64 */ leftShift = (xoffSrc - xoffDst) << (6 - PWSH); #endif /* PGSZ */ +#endif rightShift = PGSZ - leftShift; } else { +#if PSZ == 24 + rightShift = (xoffDst - xoffSrc) << 3; +#else #if PGSZ == 32 rightShift = (xoffDst - xoffSrc) << (5 - PWSH); #else /* PGSZ == 64 */ rightShift = (xoffDst - xoffSrc) << (6 - PWSH); #endif /* PGSZ */ +#endif leftShift = PGSZ - rightShift; } while (h--) @@ -381,7 +580,6 @@ psrc += UNROLL; pdst++; } nl = nlMiddle; - #ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; @@ -445,43 +643,113 @@ pdst++; } } } +#endif /* (PSZ == 24 && MROP == 0) */ #endif /* DO_UNALIGNED_BITBLT */ + + } } #endif /* ! DO_MEMCPY */ else /* xdir == -1 */ { +#if PSZ == 24 && MROP == 0 + xoffSrc = (-(pptSrc->x + w)) & PAM; + xoffDst = (-pbox->x2) & PAM; +#if 1 + if(xoffSrc != xoffDst /* Alignments must be same. */ + || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1)) +#else + if(1) +#endif + /* Width also must be same, if hight > 1 */ + { + /* ...otherwise, pixel by pixel operation */ + while (h--) + { + register int i, si, sii, di; + + for (i = 0, si = pptSrc->x + w - 1, di = pbox->x2 - 1; + i < w; + i++, si--, di--) { + psrc = psrcLine + ((si * BYPP) >> P2WSH); + pdst = pdstLine + ((di * BYPP) >> P2WSH); + sii = (si & PAM); + MROP_SOLID24P(psrc, pdst, sii, di); + } + psrcLine += widthSrc; + pdstLine += widthDst; + } + }else +#endif /* MROP == 0 && PSZ == 24 */ + { + +#if PSZ == 24 +#if MROP == 0 + /* already calculated */ +#else + xoffSrc = (pptSrc->x + w) & PAM; + xoffDst = pbox->x2 & PAM; +#endif + pdstLine += ((pbox->x2 * BYPP - 1) >> P2WSH) + 1; + psrcLine += (((pptSrc->x+w) * BYPP - 1) >> P2WSH) + 1; +#else xoffSrc = (pptSrc->x + w - 1) & PIM; xoffDst = (pbox->x2 - 1) & PIM; pdstLine += ((pbox->x2-1) >> PWSH) + 1; psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1; +#endif #ifdef DO_UNALIGNED_BITBLT +#if PSZ == 24 + nl = xoffDst - xoffSrc; +#else nl = xoffSrc - xoffDst; - psrcLine = (unsigned long *) +#endif + psrcLine = (CfbBits *) (((unsigned char *) psrcLine) + nl); #else +#if PSZ == 24 && MROP == 0 + /* already satisfied */ +#else if (xoffSrc == xoffDst) #endif +#endif { while (h--) { +#if PSZ == 24 && MROP == 0 + register int index; + register int im3; +#endif /* PSZ == 24 && MROP == 0 */ psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; +#if PSZ == 24 && MROP == 0 + index = (int)(pdst - pdstBase); +#endif /* PSZ == 24 && MROP == 0 */ + if (endmask) { pdst--; psrc--; +#if PSZ == 24 && MROP == 0 + index--; + im3 = index % 3; + *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, im3); +#else /* !(PSZ == 24 && MROP == 0) */ *pdst = MROP_MASK (*psrc, *pdst, endmask); +#endif /* PSZ == 24 && MROP == 0 */ } nl = nlMiddle; - #ifdef LARGE_INSTRUCTION_CACHE #ifdef FAST_CONSTANT_OFFSET_MODE psrc -= nl & (UNROLL - 1); pdst -= nl & (UNROLL - 1); +#if PSZ == 24 && MROP == 0 +#define BodyOdd(n) pdst[n-1] = DoMergeRop24u(psrc[n-1], pdst[n-1], ((int)(pdst - (n - 1) -pdstBase)) % 3); +#else /* !(PSZ == 24 && MROP == 0) */ #define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]); +#endif /* PSZ == 24 && MROP == 0 */ #define BodyEven(n) BodyOdd(n) @@ -491,7 +759,11 @@ psrc -= UNROLL; #else +#if PSZ == 24 && MROP == 0 +#define BodyOdd(n) --pdst; --psrc; --index; im3 = index % 3;*pdst = DoMergeRop24u(*psrc, *pdst, im3); +#else /* !(PSZ == 24 && MROP == 0) */ #define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst); +#endif /* PSZ == 24 && MROP == 0 */ #define BodyEven(n) BodyOdd(n) #define LoopReset ; @@ -503,38 +775,60 @@ psrc -= UNROLL; #undef LoopReset #else +#if PSZ == 24 && MROP == 0 + DuffL(nl,label3, + --pdst; --psrc; --index; im3= index%3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);) +#else /* !(PSZ == 24 && MROP == 0) */ DuffL(nl,label3, --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);) +#endif /* PSZ == 24 && MROP == 0 */ #endif if (startmask) { --pdst; --psrc; +#if PSZ == 24 && MROP == 0 + *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, (int)(pdst - pdstBase) % 3); +#else /* !(PSZ == 24 && MROP == 0) */ *pdst = MROP_MASK(*psrc, *pdst, startmask); +#endif /* PSZ == 24 && MROP == 0 */ } } } #ifndef DO_UNALIGNED_BITBLT +#if PSZ == 24 && MROP == 0 + /* can not happen */ +#else /* !( PSZ == 24 && MROP == 0) */ else { if (xoffDst > xoffSrc) { +#if PSZ == 24 + leftShift = (xoffDst - xoffSrc) << 3; + rightShift = PGSZ - leftShift; +#else #if PGSZ == 32 rightShift = (xoffDst - xoffSrc) << (5 - PWSH); #else /* PGSZ == 64 */ rightShift = (xoffDst - xoffSrc) << (6 - PWSH); #endif /* PGSZ */ leftShift = PGSZ - rightShift; +#endif } else { +#if PSZ == 24 + rightShift = (xoffSrc - xoffDst) << 3; + leftShift = PGSZ - rightShift; +#else #if PGSZ == 32 leftShift = (xoffSrc - xoffDst) << (5 - PWSH); #else /* PGSZ == 64 */ leftShift = (xoffSrc - xoffDst) << (6 - PWSH); #endif /* PGSZ */ rightShift = PGSZ - leftShift; +#endif } while (h--) { @@ -543,7 +837,11 @@ psrc -= UNROLL; pdstLine += widthDst; psrcLine += widthSrc; bits = 0; +#if PSZ == 24 + if (xoffSrc > xoffDst) +#else if (xoffDst > xoffSrc) +#endif bits = *--psrc; if (endmask) { @@ -554,7 +852,6 @@ psrc -= UNROLL; *pdst = MROP_MASK(bits1, *pdst, endmask); } nl = nlMiddle; - #ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; #ifdef FAST_CONSTANT_OFFSET_MODE @@ -615,7 +912,9 @@ bits1 = *--psrc; --pdst; \ } } } +#endif /* PSZ == 24 && MROP == 0 */ #endif + } } pbox++; pptSrc++; diff --git a/cfb/cfbbres.c b/cfb/cfbbres.c index 139a868b7..452259581 100644 --- a/cfb/cfbbres.c +++ b/cfb/cfbbres.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbbres.c,v 3.5 2001/12/14 19:59:21 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -61,8 +62,8 @@ void cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len) int rop; - unsigned long and, xor; - unsigned long *addrl; /* pointer to base of bitmap */ + CfbBits and, xor; + CfbBits *addrl; /* pointer to base of bitmap */ int nlwidth; /* width in longwords of bitmap */ register int signdx; int signdy; /* signs of directions */ @@ -74,6 +75,11 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, int len; /* length of line */ { register int e3 = e2-e1; +#if PSZ == 24 + CfbBits piQxelXor[3],piQxelAnd[3]; + char *addrb; + int nlwidth3, signdx3; +#endif #ifdef PIXEL_ADDR register PixelType *addrp; /* Pixel pointer */ @@ -81,10 +87,26 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, return; /* point to first point */ nlwidth <<= PWSH; +#if PSZ == 24 + addrp = (PixelType *)(addrl) + (y1 * nlwidth); + addrb = (char *)addrp + x1 * 3; + + piQxelXor[0] = (xor << 24) | xor; + piQxelXor[1] = (xor << 16)| (xor >> 8); + piQxelXor[2] = (xor << 8) | (xor >> 16); + piQxelAnd[0] = (and << 24) | and; + piQxelAnd[1] = (and << 16)| (and >> 8); + piQxelAnd[2] = (and << 8) | (and >> 16); +#else addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1; +#endif if (signdy < 0) nlwidth = -nlwidth; e = e-e1; /* to make looping easier */ +#if PSZ == 24 + nlwidth3 = nlwidth * sizeof (CfbBits); + signdx3 = signdx * 3; +#endif if (axis == Y_AXIS) { @@ -93,10 +115,45 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, t = nlwidth; nlwidth = signdx; signdx = t; +#if PSZ == 24 + t = nlwidth3; + nlwidth3 = signdx3; + signdx3 = t; +#endif } if (rop == GXcopy) { --len; +#if PSZ == 24 +#define body_copy \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \ + break; \ + case 1: \ + *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); \ + break; \ + case 3: \ + *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \ + *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \ + break; \ + case 2: \ + *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \ + *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); \ + break; \ + } +#define body {\ + body_copy \ + addrb += signdx3; \ + e += e1; \ + if (e >= 0) \ + { \ + addrb += nlwidth3; \ + e += e3; \ + } \ + } +#else /* PSZ == 24 */ #define body {\ *addrp = xor; \ addrp += signdx; \ @@ -107,6 +164,7 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e += e3; \ } \ } +#endif /* PSZ == 24 */ while (len >= 4) { body body body body @@ -117,12 +175,49 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, case 3: body case 2: body case 1: body } #undef body +#if PSZ == 24 + body_copy +# undef body_copy +#else *addrp = xor; +#endif } else /* not GXcopy */ { while(len--) { +#if PSZ == 24 + addrp = (PixelType *)((unsigned long)addrb & ~0x03); + switch((unsigned long)addrb & 3){ + case 0: + *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) + ^ (piQxelXor[0] & 0xFFFFFF); + break; + case 1: + *addrp = (*addrp & (piQxelAnd[2]|0xFF)) + ^ (piQxelXor[2] & 0xFFFFFF00); + break; + case 3: + *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) + ^ (piQxelXor[0] & 0xFF000000); + *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) + ^ (piQxelXor[1] & 0xFFFF); + break; + case 2: + *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) + ^ (piQxelXor[1] & 0xFFFF0000); + *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) + ^ (piQxelXor[2] & 0xFF); + break; + } + e += e1; + if (e >= 0) + { + addrb += nlwidth3; + e += e3; + } + addrb += signdx3; +#else /* PSZ == 24 */ *addrp = DoRRop (*addrp, and, xor); e += e1; if (e >= 0) @@ -131,21 +226,31 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e += e3; } addrp += signdx; +#endif /* PSZ == 24 */ } } #else /* !PIXEL_ADDR */ - register unsigned long tmp, bit; - unsigned long leftbit, rightbit; + register CfbBits tmp, bit; + CfbBits leftbit, rightbit; /* point to longword containing first point */ +#if PSZ == 24 + addrl = (addrl + (y1 * nlwidth) + ((x1 * 3) >>2); +#else addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH)); +#endif if (signdy < 0) nlwidth = -nlwidth; e = e-e1; /* to make looping easier */ leftbit = cfbmask[0]; +#if PSZ == 24 + rightbit = cfbmask[(PPW-1)<<1]; + bit = cfbmask[(x1 & 3)<<1]; +#else rightbit = cfbmask[PPW-1]; bit = cfbmask[x1 & PIM]; +#endif if (axis == X_AXIS) { diff --git a/cfb/cfbbresd.c b/cfb/cfbbresd.c index 6612803ae..7fe71fa2f 100644 --- a/cfb/cfbbresd.c +++ b/cfb/cfbbresd.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbbresd.c,v 3.6 2001/12/14 19:59:22 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -64,7 +65,7 @@ cfbBresD(rrops, int numInDashList; /* total length of dash list */ int *pdashOffset; /* offset into current dash */ int isDoubleDash; - unsigned long *addrl; /* pointer to base of bitmap */ + CfbBits *addrl; /* pointer to base of bitmap */ int nlwidth; /* width in longwords of bitmap */ int signdx, signdy; /* signs of directions */ int axis; /* major axis (Y_AXIS or X_AXIS) */ @@ -81,17 +82,41 @@ cfbBresD(rrops, int dashIndex; int dashOffset; int dashRemaining; - unsigned long xorFg, andFg, xorBg, andBg; + CfbBits xorFg, andFg, xorBg, andBg; Bool isCopy; int thisDash; +#if PSZ == 24 + CfbBits xorPiQxlFg[3], andPiQxlFg[3], xorPiQxlBg[3], andPiQxlBg[3]; + char *addrb; + int signdx3, signdy3; +#endif dashOffset = *pdashOffset; dashIndex = *pdashIndex; isCopy = (rrops[0].rop == GXcopy && rrops[1].rop == GXcopy); +#if PSZ == 24 + xorFg = rrops[0].xor & 0xffffff; + andFg = rrops[0].and & 0xffffff; + xorBg = rrops[1].xor & 0xffffff; + andBg = rrops[1].and & 0xffffff; + xorPiQxlFg[0] = xorFg | (xorFg << 24); + xorPiQxlFg[1] = (xorFg >> 8) | (xorFg << 16); + xorPiQxlFg[2] = (xorFg >> 16) | (xorFg << 8); + andPiQxlFg[0] = andFg | (andFg << 24); + andPiQxlFg[1] = (andFg >> 8) | (andFg << 16); + andPiQxlFg[2] = (andFg >> 16) | (andFg << 8); + xorPiQxlBg[0] = xorBg | (xorBg << 24); + xorPiQxlBg[1] = (xorBg >> 8) | (xorBg << 16); + xorPiQxlBg[2] = (xorBg >> 16) | (xorBg << 8); + andPiQxlBg[0] = andBg | (andBg << 24); + andPiQxlBg[1] = (andBg >> 8) | (andBg << 16); + andPiQxlBg[2] = (andFg >> 16) | (andBg << 8); +#else xorFg = rrops[0].xor; andFg = rrops[0].and; xorBg = rrops[1].xor; andBg = rrops[1].and; +#endif dashRemaining = pDash[dashIndex] - dashOffset; if ((thisDash = dashRemaining) >= len) { @@ -116,6 +141,17 @@ cfbBresD(rrops, #ifdef PIXEL_ADDR +#if PSZ == 24 +#define Loop(store) while (thisDash--) {\ + store; \ + BresStep(addrb+=signdy3,addrb+=signdx3) \ + } + /* point to first point */ + nlwidth <<= PWSH; + addrp = (PixelType *)(addrl) + (y1 * nlwidth); + addrb = (char *)addrp + x1 * 3; + +#else #define Loop(store) while (thisDash--) {\ store; \ BresStep(addrp+=signdy,addrp+=signdx) \ @@ -123,7 +159,12 @@ cfbBresD(rrops, /* point to first point */ nlwidth <<= PWSH; addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1; +#endif signdy *= nlwidth; +#if PSZ == 24 + signdx3 = signdx * 3; + signdy3 = signdy * sizeof (CfbBits); +#endif if (axis == Y_AXIS) { int t; @@ -131,61 +172,136 @@ cfbBresD(rrops, t = signdx; signdx = signdy; signdy = t; +#if PSZ == 24 + t = signdx3; + signdx3 = signdy3; + signdy3 = t; +#endif } if (isCopy) { +#if PSZ == 24 +#define body_copy(pix) { \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp = (*addrp & 0xFF000000)|((pix)[0] & 0xFFFFFF); \ + break; \ + case 1: \ + *addrp = (*addrp & 0xFF)|((pix)[2] & 0xFFFFFF00); \ + break; \ + case 3: \ + *addrp = (*addrp & 0xFFFFFF)|((pix)[0] & 0xFF000000); \ + *(addrp+1) = (*(addrp+1) & 0xFFFF0000)|((pix)[1] & 0xFFFF); \ + break; \ + case 2: \ + *addrp = (*addrp & 0xFFFF)|((pix)[1] & 0xFFFF0000); \ + *(addrp+1) = (*(addrp+1) & 0xFFFFFF00)|((pix)[2] & 0xFF); \ + break; \ + } \ +} +#endif /* PSZ == 24 */ + for (;;) { len -= thisDash; if (dashIndex & 1) { if (isDoubleDash) { +#if PSZ == 24 + Loop(body_copy(xorPiQxlBg)) +#else Loop(*addrp = xorBg) +#endif } else { Loop(;) } } else { +#if PSZ == 24 + Loop(body_copy(xorPiQxlFg)) +#else Loop(*addrp = xorFg) +#endif } if (!len) break; NextDash } +#undef body_copy } else { +#define body_set(and, xor) { \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp = (*addrp & ((and)[0]|0xFF000000)) ^ ((xor)[0] & 0xFFFFFF); \ + break; \ + case 1: \ + *addrp = (*addrp & ((and)[2]|0xFF)) ^ ((xor)[2] & 0xFFFFFF00); \ + break; \ + case 3: \ + *addrp = (*addrp & ((and)[0]|0xFFFFFF)) ^ ((xor)[0] & 0xFF000000); \ + *(addrp+1)=(*(addrp+1)&((and)[1]|0xFFFF0000)) ^ ((xor)[1]&0xFFFF); \ + break; \ + case 2: \ + *addrp = (*addrp & ((and)[1]|0xFFFF)) ^ ((xor)[1] & 0xFFFF0000); \ + *(addrp+1)=(*(addrp+1)&((and)[2]|0xFFFFFF00)) ^ ((xor)[2] & 0xFF); \ + break; \ + } \ +} + for (;;) { len -= thisDash; if (dashIndex & 1) { if (isDoubleDash) { +#if PSZ == 24 + Loop(body_set(andPiQxlBg, xorPiQxlBg)) +#else Loop(*addrp = DoRRop(*addrp,andBg, xorBg)) +#endif } else { Loop(;) } } else { +#if PSZ == 24 + Loop(body_set(andPiQxlFg, xorPiQxlFg)) +#else Loop(*addrp = DoRRop(*addrp,andFg, xorFg)) +#endif } if (!len) break; NextDash } +#undef body_set } #else /* !PIXEL_ADDR */ { - register unsigned long tmp; - unsigned long startbit, bit; + register CfbBits tmp; + CfbBits startbit, bit; /* point to longword containing first point */ +#if PSZ == 24 + addrl = (addrl + (y1 * nlwidth) + ((x1*3) >> 2); +#else addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH)); +#endif signdy = signdy * nlwidth; if (signdx > 0) startbit = cfbmask[0]; else +#if PSZ == 24 + startbit = cfbmask[(PPW-1)<<1]; + bit = cfbmask[(x1 & 3)<<1]; +#else startbit = cfbmask[PPW-1]; bit = cfbmask[x1 & PIM]; +#endif +#if PSZ == 24 #define X_Loop(store) while(thisDash--) {\ store; \ BresStep(addrl += signdy, \ @@ -212,6 +328,34 @@ cfbBresD(rrops, }, \ addrl += signdy) \ } +#else +#define X_Loop(store) while(thisDash--) {\ + store; \ + BresStep(addrl += signdy, \ + if (signdx > 0) \ + bit = SCRRIGHT(bit,1); \ + else \ + bit = SCRLEFT(bit,1); \ + if (!bit) \ + { \ + bit = startbit; \ + addrl += signdx; \ + }) \ + } +#define Y_Loop(store) while(thisDash--) {\ + store; \ + BresStep(if (signdx > 0) \ + bit = SCRRIGHT(bit,1); \ + else \ + bit = SCRLEFT(bit,1); \ + if (!bit) \ + { \ + bit = startbit; \ + addrl += signdx; \ + }, \ + addrl += signdy) \ + } +#endif if (axis == X_AXIS) { diff --git a/cfb/cfbbstore.c b/cfb/cfbbstore.c index ae0303dce..5e7b91471 100644 --- a/cfb/cfbbstore.c +++ b/cfb/cfbbstore.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbbstore.c,v 1.5 2001/01/17 22:36:34 dawes Exp $ */ /*- * cfbbstore.c -- * Functions required by the backing-store implementation in MI. @@ -73,11 +74,8 @@ cfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin) pBox++; } -#ifdef CFB_NEED_SCREEN_PRIVATE - pScrPix = (PixmapPtr) pScreen->devPrivates[cfbScreenPrivateIndex].ptr; -#else - pScrPix = (PixmapPtr) pScreen->devPrivate; -#endif + pScrPix = (*pScreen->GetWindowPixmap)(pWin); + cfbDoBitbltCopy((DrawablePtr) pScrPix, (DrawablePtr)pPixmap, GXcopy, prgnSave, pPtsInit, ~0L); @@ -134,11 +132,7 @@ cfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin) pBox++; } -#ifdef CFB_NEED_SCREEN_PRIVATE - pScrPix = (PixmapPtr) pScreen->devPrivates[cfbScreenPrivateIndex].ptr; -#else - pScrPix = (PixmapPtr) pScreen->devPrivate; -#endif + pScrPix = (*pScreen->GetWindowPixmap)(pWin); cfbDoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix, GXcopy, prgnRestore, pPtsInit, ~0L); diff --git a/cfb/cfbcmap.c b/cfb/cfbcmap.c index 103860e86..1830ffa5e 100644 --- a/cfb/cfbcmap.c +++ b/cfb/cfbcmap.c @@ -27,6 +27,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/cfb/cfbcmap.c,v 3.13 2001/01/17 22:36:34 dawes Exp $ */ #include "X.h" @@ -34,403 +35,65 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" - -#ifdef STATIC_COLOR - -static ColormapPtr InstalledMaps[MAXSCREENS]; +#include "micmap.h" +#include "cfb.h" int -cfbListInstalledColormaps(pScreen, pmaps) - ScreenPtr pScreen; - Colormap *pmaps; +cfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) { - /* By the time we are processing requests, we can guarantee that there - * is always a colormap installed */ - *pmaps = InstalledMaps[pScreen->myNum]->mid; - return (1); + return miListInstalledColormaps(pScreen, pmaps); } - void -cfbInstallColormap(pmap) - ColormapPtr pmap; +cfbInstallColormap(ColormapPtr pmap) { - int index = pmap->pScreen->myNum; - ColormapPtr oldpmap = InstalledMaps[index]; - - if(pmap != oldpmap) - { - /* Uninstall pInstalledMap. No hardware changes required, just - * notify all interested parties. */ - if(oldpmap != (ColormapPtr)None) - WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); - /* Install pmap */ - InstalledMaps[index] = pmap; - WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); - - } + miInstallColormap(pmap); } void -cfbUninstallColormap(pmap) - ColormapPtr pmap; +cfbUninstallColormap(ColormapPtr pmap) { - int index = pmap->pScreen->myNum; - ColormapPtr curpmap = InstalledMaps[index]; - - if(pmap == curpmap) - { - if (pmap->mid != pmap->pScreen->defColormap) - { - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); - (*pmap->pScreen->InstallColormap)(curpmap); - } - } + miUninstallColormap(pmap); } -#endif - void -cfbResolveColor(pred, pgreen, pblue, pVisual) - unsigned short *pred, *pgreen, *pblue; - register VisualPtr pVisual; +cfbResolveColor(unsigned short *pred, + unsigned short *pgreen, + unsigned short *pblue, + VisualPtr pVisual) { - int shift = 16 - pVisual->bitsPerRGBValue; - unsigned lim = (1 << pVisual->bitsPerRGBValue) - 1; - - if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor)) - { - /* rescale to rgb bits */ - *pred = ((*pred >> shift) * 65535) / lim; - *pgreen = ((*pgreen >> shift) * 65535) / lim; - *pblue = ((*pblue >> shift) * 65535) / lim; - } - else if (pVisual->class == GrayScale) - { - /* rescale to gray then rgb bits */ - *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; - *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; - } - else if (pVisual->class == StaticGray) - { - unsigned limg = pVisual->ColormapEntries - 1; - /* rescale to gray then [0..limg] then [0..65535] then rgb bits */ - *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; - *pred = ((((*pred * (limg + 1))) >> 16) * 65535) / limg; - *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; - } - else - { - unsigned limr, limg, limb; - - limr = pVisual->redMask >> pVisual->offsetRed; - limg = pVisual->greenMask >> pVisual->offsetGreen; - limb = pVisual->blueMask >> pVisual->offsetBlue; - /* rescale to [0..limN] then [0..65535] then rgb bits */ - *pred = ((((((*pred * (limr + 1)) >> 16) * - 65535) / limr) >> shift) * 65535) / lim; - *pgreen = ((((((*pgreen * (limg + 1)) >> 16) * - 65535) / limg) >> shift) * 65535) / lim; - *pblue = ((((((*pblue * (limb + 1)) >> 16) * - 65535) / limb) >> shift) * 65535) / lim; - } + miResolveColor(pred, pgreen, pblue, pVisual); } Bool -cfbInitializeColormap(pmap) - register ColormapPtr pmap; +cfbInitializeColormap(ColormapPtr pmap) { - register unsigned i; - register VisualPtr pVisual; - unsigned lim, maxent, shift; - - pVisual = pmap->pVisual; - lim = (1 << pVisual->bitsPerRGBValue) - 1; - shift = 16 - pVisual->bitsPerRGBValue; - maxent = pVisual->ColormapEntries - 1; - if (pVisual->class == TrueColor) - { - unsigned limr, limg, limb; - - limr = pVisual->redMask >> pVisual->offsetRed; - limg = pVisual->greenMask >> pVisual->offsetGreen; - limb = pVisual->blueMask >> pVisual->offsetBlue; - for(i = 0; i <= maxent; i++) - { - /* rescale to [0..65535] then rgb bits */ - pmap->red[i].co.local.red = - ((((i * 65535) / limr) >> shift) * 65535) / lim; - pmap->green[i].co.local.green = - ((((i * 65535) / limg) >> shift) * 65535) / lim; - pmap->blue[i].co.local.blue = - ((((i * 65535) / limb) >> shift) * 65535) / lim; - } - } - else if (pVisual->class == StaticColor) - { - unsigned limr, limg, limb; - - limr = pVisual->redMask >> pVisual->offsetRed; - limg = pVisual->greenMask >> pVisual->offsetGreen; - limb = pVisual->blueMask >> pVisual->offsetBlue; - for(i = 0; i <= maxent; i++) - { - /* rescale to [0..65535] then rgb bits */ - pmap->red[i].co.local.red = - ((((((i & pVisual->redMask) >> pVisual->offsetRed) - * 65535) / limr) >> shift) * 65535) / lim; - pmap->red[i].co.local.green = - ((((((i & pVisual->greenMask) >> pVisual->offsetGreen) - * 65535) / limg) >> shift) * 65535) / lim; - pmap->red[i].co.local.blue = - ((((((i & pVisual->blueMask) >> pVisual->offsetBlue) - * 65535) / limb) >> shift) * 65535) / lim; - } - } - else if (pVisual->class == StaticGray) - { - for(i = 0; i <= maxent; i++) - { - /* rescale to [0..65535] then rgb bits */ - pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift) - * 65535) / lim; - pmap->red[i].co.local.green = pmap->red[i].co.local.red; - pmap->red[i].co.local.blue = pmap->red[i].co.local.red; - } - } - return TRUE; + return miInitializeColormap(pmap); } -/* When simulating DirectColor on PseudoColor hardware, multiple - entries of the colormap must be updated - */ - -#define AddElement(mask) { \ - pixel = red | green | blue; \ - for (i = 0; i < nresult; i++) \ - if (outdefs[i].pixel == pixel) \ - break; \ - if (i == nresult) \ - { \ - nresult++; \ - outdefs[i].pixel = pixel; \ - outdefs[i].flags = 0; \ - } \ - outdefs[i].flags |= (mask); \ - outdefs[i].red = pmap->red[red >> pVisual->offsetRed].co.local.red; \ - outdefs[i].green = pmap->green[green >> pVisual->offsetGreen].co.local.green; \ - outdefs[i].blue = pmap->blue[blue >> pVisual->offsetBlue].co.local.blue; \ -} - -cfbExpandDirectColors (pmap, ndef, indefs, outdefs) - ColormapPtr pmap; - int ndef; - xColorItem *indefs, *outdefs; +int +cfbExpandDirectColors (ColormapPtr pmap, int ndef, + xColorItem *indefs, xColorItem *outdefs) { - int minred, mingreen, minblue; - register int red, green, blue; - int maxred, maxgreen, maxblue; - int stepred, stepgreen, stepblue; - VisualPtr pVisual; - register int pixel; - register int nresult; - register int i; - - pVisual = pmap->pVisual; - - stepred = 1 << pVisual->offsetRed; - stepgreen = 1 << pVisual->offsetGreen; - stepblue = 1 << pVisual->offsetBlue; - maxred = pVisual->redMask; - maxgreen = pVisual->greenMask; - maxblue = pVisual->blueMask; - nresult = 0; - for (;ndef--; indefs++) - { - if (indefs->flags & DoRed) - { - red = indefs->pixel & pVisual->redMask; - for (green = 0; green <= maxgreen; green += stepgreen) - { - for (blue = 0; blue <= maxblue; blue += stepblue) - { - AddElement (DoRed) - } - } - } - if (indefs->flags & DoGreen) - { - green = indefs->pixel & pVisual->greenMask; - for (red = 0; red <= maxred; red += stepred) - { - for (blue = 0; blue <= maxblue; blue += stepblue) - { - AddElement (DoGreen) - } - } - } - if (indefs->flags & DoBlue) - { - blue = indefs->pixel & pVisual->blueMask; - for (red = 0; red <= maxred; red += stepred) - { - for (green = 0; green <= maxgreen; green += stepgreen) - { - AddElement (DoBlue) - } - } - } - } - return nresult; + return miExpandDirectColors(pmap, ndef, indefs, outdefs); } Bool -cfbCreateDefColormap(pScreen) - ScreenPtr pScreen; +cfbCreateDefColormap(ScreenPtr pScreen) { -/* - * In the following sources PC X server vendors may want to delete - * "_not_tog" from "#ifdef WIN32_not_tog" - */ -#ifdef WIN32_not_tog - /* - * these are the MS-Windows desktop colors, adjusted for X's 16-bit - * color specifications. - */ - static xColorItem citems[] = { - { 0, 0, 0, 0, 0, 0 }, - { 1, 0x8000, 0, 0, 0, 0 }, - { 2, 0, 0x8000, 0, 0, 0 }, - { 3, 0x8000, 0x8000, 0, 0, 0 }, - { 4, 0, 0, 0x8000, 0, 0 }, - { 5, 0x8000, 0, 0x8000, 0, 0 }, - { 6, 0, 0x8000, 0x8000, 0, 0 }, - { 7, 0xc000, 0xc000, 0xc000, 0, 0 }, - { 8, 0xc000, 0xdc00, 0xc000, 0, 0 }, - { 9, 0xa600, 0xca00, 0xf000, 0, 0 }, - { 246, 0xff00, 0xfb00, 0xf000, 0, 0 }, - { 247, 0xa000, 0xa000, 0xa400, 0, 0 }, - { 248, 0x8000, 0x8000, 0x8000, 0, 0 }, - { 249, 0xff00, 0, 0, 0, 0 }, - { 250, 0, 0xff00, 0, 0, 0 }, - { 251, 0xff00, 0xff00, 0, 0, 0 }, - { 252, 0, 0, 0xff00, 0, 0 }, - { 253, 0xff00, 0, 0xff00, 0, 0 }, - { 254, 0, 0xff00, 0xff00, 0, 0 }, - { 255, 0xff00, 0xff00, 0xff00, 0, 0 } - }; -#define NUM_DESKTOP_COLORS sizeof citems / sizeof citems[0] - int i; -#else - unsigned short zero = 0, ones = 0xFFFF; -#endif - Pixel wp, bp; - VisualPtr pVisual; - ColormapPtr cmap; - - for (pVisual = pScreen->visuals; - pVisual->vid != pScreen->rootVisual; - pVisual++) - ; - - if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap, - (pVisual->class & DynamicClass) ? AllocNone : AllocAll, - 0) - != Success) - return FALSE; - wp = pScreen->whitePixel; - bp = pScreen->blackPixel; -#ifdef WIN32_not_tog - for (i = 0; i < NUM_DESKTOP_COLORS; i++) { - if (AllocColor (cmap, - &citems[i].red, &citems[i].green, &citems[i].blue, - &citems[i].pixel, 0) != Success) - return FALSE; - } -#else - if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) != - Success) || - (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) != - Success)) - return FALSE; - pScreen->whitePixel = wp; - pScreen->blackPixel = bp; -#endif - (*pScreen->InstallColormap)(cmap); - return TRUE; + return miCreateDefColormap(pScreen); } -extern int defaultColorVisualClass; - -#define _RZ(d) ((d + 2) / 3) -#define _RS(d) 0 -#define _RM(d) ((1 << _RZ(d)) - 1) -#define _GZ(d) ((d - _RZ(d) + 1) / 2) -#define _GS(d) _RZ(d) -#define _GM(d) (((1 << _GZ(d)) - 1) << _GS(d)) -#define _BZ(d) (d - _RZ(d) - _GZ(d)) -#define _BS(d) (_RZ(d) + _GZ(d)) -#define _BM(d) (((1 << _BZ(d)) - 1) << _BS(d)) -#define _CE(d) (1 << _RZ(d)) - -#define MAX_PSEUDO_DEPTH 10 /* largest DAC size I know */ - -#define StaticGrayMask (1 << StaticGray) -#define GrayScaleMask (1 << GrayScale) -#define StaticColorMask (1 << StaticColor) -#define PseudoColorMask (1 << PseudoColor) -#define TrueColorMask (1 << TrueColor) -#define DirectColorMask (1 << DirectColor) - -#define ALL_VISUALS (StaticGrayMask|\ - GrayScaleMask|\ - StaticColorMask|\ - PseudoColorMask|\ - TrueColorMask|\ - DirectColorMask) - -#define LARGE_VISUALS (TrueColorMask|\ - DirectColorMask) - -typedef struct _cfbVisuals { - struct _cfbVisuals *next; - int depth; - int bitsPerRGB; - int visuals; - int count; -} cfbVisualsRec, *cfbVisualsPtr; - -static int cfbVisualPriority[] = { - PseudoColor, DirectColor, GrayScale, StaticColor, TrueColor, StaticGray -}; - -#define NUM_PRIORITY 6 - -static cfbVisualsPtr cfbVisuals; +void +cfbClearVisualTypes(void) +{ + miClearVisualTypes(); +} Bool -cfbSetVisualTypes (depth, visuals, bitsPerRGB) - int depth; - int visuals; +cfbSetVisualTypes (int depth, int visuals, int bitsPerRGB) { - cfbVisualsPtr new, *prev, v; - int count; - - new = (cfbVisualsPtr) xalloc (sizeof *new); - if (!new) - return FALSE; - new->next = 0; - new->depth = depth; - new->visuals = visuals; - new->bitsPerRGB = bitsPerRGB; - count = (visuals >> 1) & 033333333333; - count = visuals - count - ((count >> 1) & 033333333333); - count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */ - new->count = count; - for (prev = &cfbVisuals; v = *prev; prev = &v->next); - *prev = new; - return TRUE; + return miSetVisualTypes(depth, visuals, bitsPerRGB, -1); } /* @@ -440,148 +103,15 @@ cfbSetVisualTypes (depth, visuals, bitsPerRGB) */ Bool -cfbInitVisuals (visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB) - VisualPtr *visualp; - DepthPtr *depthp; - int *nvisualp, *ndepthp; - int *rootDepthp; - VisualID *defaultVisp; - unsigned long sizes; - int bitsPerRGB; +cfbInitVisuals (VisualPtr *visualp, + DepthPtr *depthp, + int *nvisualp, + int *ndepthp, + int *rootDepthp, + VisualID *defaultVisp, + unsigned long sizes, + int bitsPerRGB) { - int i, j, k; - VisualPtr visual; - DepthPtr depth; - VisualID *vid; - int d, b; - int f; - int ndepth, nvisual; - int nvtype; - int vtype; - VisualID defaultVisual; - cfbVisualsPtr visuals, nextVisuals; - - /* none specified, we'll guess from pixmap formats */ - if (!cfbVisuals) - { - for (f = 0; f < screenInfo.numPixmapFormats; f++) - { - d = screenInfo.formats[f].depth; - b = screenInfo.formats[f].bitsPerPixel; - if (sizes & (1 << (b - 1))) - { - if (d > MAX_PSEUDO_DEPTH) - vtype = LARGE_VISUALS; - else if (d == 1) - vtype = StaticGrayMask; - else - vtype = ALL_VISUALS; - } - else - vtype = 0; - if (!cfbSetVisualTypes (d, vtype, bitsPerRGB)) - return FALSE; - } - } - nvisual = 0; - ndepth = 0; - for (visuals = cfbVisuals; visuals; visuals = nextVisuals) - { - nextVisuals = visuals->next; - ndepth++; - nvisual += visuals->count; - } - depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec)); - visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec)); - if (!depth || !visual) - { - xfree (depth); - xfree (visual); - return FALSE; - } - *depthp = depth; - *visualp = visual; - *ndepthp = ndepth; - *nvisualp = nvisual; - for (visuals = cfbVisuals; visuals; visuals = nextVisuals) - { - nextVisuals = visuals->next; - d = visuals->depth; - vtype = visuals->visuals; - nvtype = visuals->count; - vid = NULL; - if (nvtype) - { - vid = (VisualID *) xalloc (nvtype * sizeof (VisualID)); - if (!vid) - return FALSE; - } - depth->depth = d; - depth->numVids = nvtype; - depth->vids = vid; - depth++; - for (i = 0; i < NUM_PRIORITY; i++) { - if (! (vtype & (1 << cfbVisualPriority[i]))) - continue; - visual->class = cfbVisualPriority[i]; - visual->bitsPerRGBValue = visuals->bitsPerRGB; - visual->ColormapEntries = 1 << d; - visual->nplanes = d; - visual->vid = *vid = FakeClientID (0); - switch (visual->class) { - case PseudoColor: - case GrayScale: - case StaticGray: - visual->redMask = 0; - visual->greenMask = 0; - visual->blueMask = 0; - visual->offsetRed = 0; - visual->offsetGreen = 0; - visual->offsetBlue = 0; - break; - case DirectColor: - case TrueColor: - visual->ColormapEntries = _CE(d); - /* fall through */ - case StaticColor: - visual->redMask = _RM(d); - visual->greenMask = _GM(d); - visual->blueMask = _BM(d); - visual->offsetRed = _RS(d); - visual->offsetGreen = _GS(d); - visual->offsetBlue = _BS(d); - } - vid++; - visual++; - } - xfree (visuals); - } - cfbVisuals = NULL; - visual = *visualp; - depth = *depthp; - for (i = 0; i < ndepth; i++) - { - if (*rootDepthp && *rootDepthp != depth[i].depth) - continue; - for (j = 0; j < depth[i].numVids; j++) - { - for (k = 0; k < nvisual; k++) - if (visual[k].vid == depth[i].vids[j]) - break; - if (k == nvisual) - continue; - if (defaultColorVisualClass < 0 || - visual[k].class == defaultColorVisualClass) - break; - } - if (j != depth[i].numVids) - break; - } - if (i == ndepth) { - i = 0; - j = 0; - } - *rootDepthp = depth[i].depth; - *defaultVisp = depth[i].vids[j]; - return TRUE; + return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp, + defaultVisp, sizes, bitsPerRGB, -1); } diff --git a/cfb/cfbfillarc.c b/cfb/cfbfillarc.c index 89d184983..9dee99476 100644 --- a/cfb/cfbfillarc.c +++ b/cfb/cfbfillarc.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbfillarc.c,v 3.5 2001/12/14 19:59:22 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -39,7 +40,7 @@ in this Software without prior written authorization from The Open Group. #include "mi.h" /* gcc 1.35 is stupid */ -#if defined(__GNUC__) && defined(mc68020) +#if defined(__GNUC__) && __GNUC__ < 2 && defined(mc68020) #define STUPID volatile #else #define STUPID @@ -54,17 +55,29 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc) STUPID int x, y, e; STUPID int yk, xk, ym, xm, dx, dy, xorg, yorg; miFillArcRec info; - unsigned long *addrlt, *addrlb; - register unsigned long *addrl; +#if PSZ == 24 + unsigned char *addrlt, *addrlb; +#else + CfbBits *addrlt, *addrlb; +#endif + register CfbBits *addrl; register int n; int nlwidth; RROP_DECLARE register int xpos; register int slw; - unsigned long startmask, endmask; + CfbBits startmask, endmask; int nlmiddle; +#if PSZ == 24 + register int pidx; + int xpos3; +#endif +#if PSZ == 24 + cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt) +#else cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt) +#endif RROP_FETCH_GC(pGC); miFillArcSetup(arc, &info); @@ -82,6 +95,55 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc) if (!slw) continue; xpos = xorg - x; +#if PSZ == 24 + xpos3 = (xpos * 3) & ~0x03; + addrl = (CfbBits *)((char *)addrlt + xpos3); + if (slw == 1){ + RROP_SOLID24(addrl, xpos); + if (miFillArcLower(slw)){ + addrl = (CfbBits *)((char *)addrlb + xpos3); + RROP_SOLID24(addrl, xpos); + } + continue; + } + maskbits(xpos, slw, startmask, endmask, nlmiddle); + xpos &= 3; + pidx = xpos; + if (startmask){ + RROP_SOLID_MASK(addrl, startmask, pidx-1); + addrl++; + if (pidx == 3) + pidx = 0; + } + n = nlmiddle; + while (--n >= 0){ + RROP_SOLID(addrl, pidx); + addrl++; + if (++pidx == 3) + pidx = 0; + } + if (endmask) + RROP_SOLID_MASK(addrl, endmask, pidx); + if (!miFillArcLower(slw)) + continue; + addrl = (CfbBits *)((char *)addrlb + xpos3); + pidx = xpos; + if (startmask){ + RROP_SOLID_MASK(addrl, startmask, pidx-1); + addrl++; + if (pidx == 3) + pidx = 0; + } + n = nlmiddle; + while (--n >= 0){ + RROP_SOLID(addrl, pidx); + addrl++; + if (++pidx == 3) + pidx = 0; + } + if (endmask) + RROP_SOLID_MASK(addrl, endmask, pidx); +#else /* PSZ == 24 */ addrl = addrlt + (xpos >> PWSH); if (((xpos & PIM) + slw) <= PPW) { @@ -117,9 +179,38 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc) RROP_SPAN(addrl, n); if (endmask) RROP_SOLID_MASK(addrl, endmask); +#endif /* PSZ == 24 */ } } +#if PSZ == 24 +#define FILLSPAN(xl,xr,addr) \ + if (xr >= xl){ \ + n = xr - xl + 1; \ + addrl = (CfbBits *)((char *)addr + ((xl * 3) & ~0x03)); \ + if (n <= 1){ \ + if (n) \ + RROP_SOLID24(addrl, xl); \ + } else { \ + maskbits(xl, n, startmask, endmask, n); \ + pidx = xl & 3; \ + if (startmask){ \ + RROP_SOLID_MASK(addrl, startmask, pidx-1); \ + addrl++; \ + if (pidx == 3) \ + pidx = 0; \ + } \ + while (--n >= 0){ \ + RROP_SOLID(addrl, pidx); \ + addrl++; \ + if (++pidx == 3) \ + pidx = 0; \ + } \ + if (endmask) \ + RROP_SOLID_MASK(addrl, endmask, pidx); \ + } \ + } +#else /* PSZ == 24 */ #define FILLSPAN(xl,xr,addr) \ if (xr >= xl) \ { \ @@ -147,6 +238,7 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc) RROP_SOLID_MASK(addrl, endmask); \ } \ } +#endif /* PSZ == 24 */ #define FILLSLICESPANS(flip,addr) \ if (!flip) \ @@ -172,14 +264,25 @@ RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc) miFillArcRec info; miArcSliceRec slice; int xl, xr, xc; - unsigned long *addrlt, *addrlb; - register unsigned long *addrl; +#if PSZ == 24 + unsigned char *addrlt, *addrlb; +#else + CfbBits *addrlt, *addrlb; +#endif + register CfbBits *addrl; register int n; int nlwidth; RROP_DECLARE - unsigned long startmask, endmask; + CfbBits startmask, endmask; +#if PSZ == 24 + register int pidx; +#endif /* PSZ == 24 */ +#if PSZ == 24 + cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt) +#else cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt) +#endif RROP_FETCH_GC(pGC); miFillArcSetup(arc, &info); diff --git a/cfb/cfbfillrct.c b/cfb/cfbfillrct.c index a0b72e7c4..c6a7270c2 100644 --- a/cfb/cfbfillrct.c +++ b/cfb/cfbfillrct.c @@ -1,6 +1,7 @@ /* * Fill rectangles. */ +/* $XFree86: xc/programs/Xserver/cfb/cfbfillrct.c,v 3.8 2001/12/14 19:59:22 dawes Exp $ */ /* @@ -37,7 +38,7 @@ in this Software without prior written authorization from The Open Group. #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" - +#include "mi.h" #include "cfb.h" #include "cfbmskbits.h" #include "mergerop.h" @@ -51,7 +52,11 @@ cfbFillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot) PixmapPtr tile; int xrot, yrot; { +#if PSZ == 24 + if (tile->drawable.width & 3) +#else if (tile->drawable.width & PIM) +#endif cfbFillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L); else cfbFillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L); @@ -65,11 +70,15 @@ cfbFillRectTileOdd (pDrawable, pGC, nBox, pBox) BoxPtr pBox; { int xrot, yrot; - void (*fill)(); + void (*fill)(DrawablePtr, int, BoxPtr, PixmapPtr, int, int, int, unsigned long); xrot = pDrawable->x + pGC->patOrg.x; yrot = pDrawable->y + pGC->patOrg.y; +#if PSZ == 24 + if (pGC->tile.pixmap->drawable.width & 3) +#else if (pGC->tile.pixmap->drawable.width & PIM) +#endif { fill = cfbFillBoxTileOddGeneral; if ((pGC->planemask & PMSK) == PMSK) @@ -108,12 +117,20 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit) BoxRec stackRects[NUM_STACK_RECTS]; cfbPrivGC *priv; int numRects; - void (*BoxFill)(); + void (*BoxFill)(DrawablePtr, GCPtr, int, BoxPtr); int n; int xorg, yorg; +#if PSZ != 8 + if ((pGC->fillStyle == FillStippled) || + (pGC->fillStyle == FillOpaqueStippled)) { + miPolyFillRect(pDrawable, pGC, nrectFill, prectInit); + return; + } +#endif + priv = cfbGetGCPrivate(pGC); - prgnClip = priv->pCompositeClip; + prgnClip = pGC->pCompositeClip; BoxFill = 0; switch (pGC->fillStyle) @@ -132,7 +149,7 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit) } break; case FillTiled: - if (!cfbGetGCPrivate(pGC)->pRotatedPixmap) + if (!pGC->pRotatedPixmap) BoxFill = cfbFillRectTileOdd; else { @@ -144,13 +161,13 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit) break; #if PSZ == 8 case FillStippled: - if (!cfbGetGCPrivate(pGC)->pRotatedPixmap) + if (!pGC->pRotatedPixmap) BoxFill = cfb8FillRectStippledUnnatural; else BoxFill = cfb8FillRectTransparentStippled32; break; case FillOpaqueStippled: - if (!cfbGetGCPrivate(pGC)->pRotatedPixmap) + if (!pGC->pRotatedPixmap) BoxFill = cfb8FillRectStippledUnnatural; else BoxFill = cfb8FillRectOpaqueStippled32; diff --git a/cfb/cfbfillsp.c b/cfb/cfbfillsp.c index b0de9bd7d..9a75ac6c6 100644 --- a/cfb/cfbfillsp.c +++ b/cfb/cfbfillsp.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbfillsp.c,v 3.7 2001/12/14 19:59:22 dawes Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -152,13 +153,17 @@ int fSorted; int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ - void (*fill)(); + void (*fill)(DrawablePtr, int, DDXPointPtr, int *, PixmapPtr, int, int, int, unsigned long); int xrot, yrot; if (!(pGC->planemask)) return; +#if PSZ == 24 + if (pGC->tile.pixmap->drawable.width & 3) +#else if (pGC->tile.pixmap->drawable.width & PIM) +#endif { fill = cfbFillSpanTileOddGeneral; if ((pGC->planemask & PMSK) == PMSK) @@ -217,21 +222,21 @@ int fSorted; int *pwidth; /* pointer to list of n widths */ int *pwidthFree;/* copies of the pointers to free */ DDXPointPtr pptFree; - unsigned long *pdstBase; /* pointer to start of bitmap */ + CfbBits *pdstBase; /* pointer to start of bitmap */ int nlwDst; /* width in longwords of bitmap */ - register unsigned long *pdst; /* pointer to current word in bitmap */ + register CfbBits *pdst; /* pointer to current word in bitmap */ PixmapPtr pStipple; /* pointer to stipple we want to fill with */ int nlw; int x, y, w, xrem, xSrc, ySrc; int stwidth, stippleWidth; int stippleHeight; - register unsigned long bits, inputBits; + register CfbBits bits, inputBits; register int partBitsLeft; int nextPartBits; int bitsLeft, bitsWhole; - unsigned long *srcTemp, *srcStart; - unsigned long *psrcBase; - unsigned long startmask, endmask; + CfbBits *srcTemp, *srcStart; + CfbBits *psrcBase; + CfbBits startmask, endmask; if (pGC->fillStyle == FillStippled) cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); @@ -274,7 +279,7 @@ int fSorted; stwidth = pStipple->devKind >> PWSH; stippleWidth = pStipple->drawable.width; stippleHeight = pStipple->drawable.height; - psrcBase = (unsigned long *) pStipple->devPrivate.ptr; + psrcBase = (CfbBits *) pStipple->devPrivate.ptr; /* * The Target: @@ -406,20 +411,20 @@ int fSorted; register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ int iline; /* first line of tile to use */ - unsigned long *addrlBase; /* pointer to start of bitmap */ + CfbBits *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ - register unsigned long *pdst; /* pointer to current word in bitmap */ + register CfbBits *pdst; /* pointer to current word in bitmap */ PixmapPtr pStipple; /* pointer to stipple we want to fill with */ register int w; int width, x, xrem, xSrc, ySrc; - unsigned long tmpSrc, tmpDst1, tmpDst2; + CfbBits tmpSrc, tmpDst1, tmpDst2; int stwidth, stippleWidth; - unsigned long *psrcS; - int rop, stiprop; + CfbBits *psrcS; + int rop, stiprop = 0; int stippleHeight; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; - unsigned long fgfill, bgfill; + CfbBits fgfill, bgfill; if (!(pGC->planemask)) return; @@ -497,7 +502,7 @@ int fSorted; iline = (ppt->y - ySrc) % stippleHeight; x = ppt->x; pdst = addrlBase + (ppt->y * nlwidth); - psrcS = (unsigned long *) pStipple->devPrivate.ptr + (iline * stwidth); + psrcS = (CfbBits *) pStipple->devPrivate.ptr + (iline * stwidth); if (*pwidth) { @@ -505,8 +510,8 @@ int fSorted; while(width > 0) { int xtemp, tmpx; - register unsigned long *ptemp; - register unsigned long *pdsttmp; + register CfbBits *ptemp; + register CfbBits *pdsttmp; /* * Do a stripe through the stipple & destination w pixels * wide. w is not more than: @@ -520,35 +525,66 @@ int fSorted; /* width of dest/stipple */ xrem = (x - xSrc) % stippleWidth; +#if PSZ == 24 + w = 1; +#else w = min((stippleWidth - xrem), width); /* dist to word bound in dest */ w = min(w, PPW - (x & PIM)); /* dist to word bound in stip */ w = min(w, MFB_PPW - (x & MFB_PIM)); +#endif xtemp = (xrem & MFB_PIM); - ptemp = (unsigned long *)(psrcS + (xrem >> MFB_PWSH)); + ptemp = (CfbBits *)(psrcS + (xrem >> MFB_PWSH)); +#if PSZ == 24 + tmpx = x & 3; + pdsttmp = pdst + ((x * 3)>>2); +#else tmpx = x & PIM; pdsttmp = pdst + (x>>PWSH); +#endif switch ( pGC->fillStyle ) { case FillOpaqueStippled: +#if PSZ == 24 + getstipplepixels24(ptemp, xtemp, 0, &bgfill, &tmpDst1, xrem); + getstipplepixels24(ptemp, xtemp, 1, &fgfill, &tmpDst2, xrem); +#else getstipplepixels(ptemp, xtemp, w, 0, &bgfill, &tmpDst1); getstipplepixels(ptemp, xtemp, w, 1, &fgfill, &tmpDst2); +#endif break; case FillStippled: /* Fill tmpSrc with the source pixels */ +#if PSZ == 24 + getbits24(pdsttmp, tmpSrc, x); + getstipplepixels24(ptemp, xtemp, 0, &tmpSrc, &tmpDst1, xrem); +#else getbits(pdsttmp, tmpx, w, tmpSrc); getstipplepixels(ptemp, xtemp, w, 0, &tmpSrc, &tmpDst1); +#endif if (rop != stiprop) { +#if PSZ == 24 + putbitsrop24(fgfill, 0, &tmpSrc, pGC->planemask, stiprop); +#else putbitsrop(fgfill, 0, w, &tmpSrc, pGC->planemask, stiprop); +#endif } else { tmpSrc = fgfill; } +#if PSZ == 24 + getstipplepixels24(ptemp, xtemp, 1, &tmpSrc, &tmpDst2, xrem); +#else getstipplepixels(ptemp, xtemp, w, 1, &tmpSrc, &tmpDst2); +#endif break; } tmpDst2 |= tmpDst1; +#if PSZ == 24 + putbitsrop24(tmpDst2, tmpx, pdsttmp, pGC->planemask, rop); +#else putbitsrop(tmpDst2, tmpx, w, pdsttmp, pGC->planemask, rop); +#endif x += w; width -= w; } @@ -577,23 +613,23 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int n; /* number of spans to fill */ DDXPointPtr ppt; /* pointer to list of start points */ int *pwidth; /* pointer to list of n widths */ - unsigned long *src; /* pointer to bits in stipple, if needed */ + CfbBits *src; /* pointer to bits in stipple, if needed */ int stippleHeight; /* height of the stipple */ PixmapPtr stipple; int nlwDst; /* width in longwords of the dest pixmap */ int x,y,w; /* current span */ - unsigned long startmask; - unsigned long endmask; - register unsigned long *dst; /* pointer to bits we're writing */ + CfbBits startmask; + CfbBits endmask; + register CfbBits *dst; /* pointer to bits we're writing */ register int nlw; - unsigned long *dstTmp; + CfbBits *dstTmp; int nlwTmp; - unsigned long *pbits; /* pointer to start of pixmap */ - register unsigned long xor; - register unsigned long mask; - register unsigned long bits; /* bits from stipple */ + CfbBits *pbits; /* pointer to start of pixmap */ + register CfbBits xor; + register CfbBits mask; + register CfbBits bits; /* bits from stipple */ int wEnd; int *pwidthFree; /* copies of the pointers to free */ @@ -602,7 +638,7 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) devPriv = cfbGetGCPrivate(pGC); cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - n = nInit * miFindMaxBand(devPriv->pCompositeClip); + n = nInit * miFindMaxBand(pGC->pCompositeClip); if ( n == 0 ) return; pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); @@ -615,12 +651,11 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) } pwidth = pwidthFree; ppt = pptFree; - n = miClipSpans(devPriv->pCompositeClip, - pptInit, pwidthInit, nInit, + n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); - stipple = devPriv->pRotatedPixmap; - src = (unsigned long *)stipple->devPrivate.ptr; + stipple = pGC->pRotatedPixmap; + src = (CfbBits *)stipple->devPrivate.ptr; stippleHeight = stipple->drawable.height; cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) @@ -644,6 +679,7 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) } bits = src[y % stippleHeight]; RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM))); +#if PPW == 4 if (cfb8StippleRRop == GXcopy) { xor = devPriv->xor; @@ -751,6 +787,7 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) } } else +#endif /* PPW == 4 */ { if (startmask) { @@ -789,23 +826,22 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int n; /* number of spans to fill */ DDXPointPtr ppt; /* pointer to list of start points */ int *pwidth; /* pointer to list of n widths */ - unsigned long *src; /* pointer to bits in stipple, if needed */ + CfbBits *src; /* pointer to bits in stipple, if needed */ int stippleHeight; /* height of the stipple */ PixmapPtr stipple; int nlwDst; /* width in longwords of the dest pixmap */ int x,y,w; /* current span */ - unsigned long startmask; - unsigned long endmask; - register unsigned long *dst; /* pointer to bits we're writing */ + CfbBits startmask; + CfbBits endmask; + register CfbBits *dst; /* pointer to bits we're writing */ register int nlw; - unsigned long *dstTmp; + CfbBits *dstTmp; int nlwTmp; - unsigned long *pbits; /* pointer to start of pixmap */ - register unsigned long xor; - register unsigned long mask; - register unsigned long bits; /* bits from stipple */ + CfbBits *pbits; /* pointer to start of pixmap */ + register CfbBits xor; + register CfbBits bits; /* bits from stipple */ int wEnd; int *pwidthFree; /* copies of the pointers to free */ @@ -816,7 +852,7 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - n = nInit * miFindMaxBand(devPriv->pCompositeClip); + n = nInit * miFindMaxBand(pGC->pCompositeClip); if ( n == 0 ) return; pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); @@ -829,12 +865,11 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) } pwidth = pwidthFree; ppt = pptFree; - n = miClipSpans(devPriv->pCompositeClip, - pptInit, pwidthInit, nInit, + n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); - stipple = devPriv->pRotatedPixmap; - src = (unsigned long *)stipple->devPrivate.ptr; + stipple = pGC->pRotatedPixmap; + src = (CfbBits *)stipple->devPrivate.ptr; stippleHeight = stipple->drawable.height; cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) @@ -858,6 +893,7 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) } bits = src[y % stippleHeight]; RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM))); +#if PPW == 4 if (cfb8StippleRRop == GXcopy) { xor = devPriv->xor; @@ -865,8 +901,8 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) { if (startmask) { - *dst = *dst & ~startmask | - GetPixelGroup (bits) & startmask; + *dst = (*dst & ~startmask) | + (GetPixelGroup (bits) & startmask); dst++; RotBitsLeft (bits, PGSZB); } @@ -877,8 +913,8 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) } if (endmask) { - *dst = *dst & ~endmask | - GetPixelGroup (bits) & endmask; + *dst = (*dst & ~endmask) | + (GetPixelGroup (bits) & endmask); } } else @@ -889,8 +925,8 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) nlwTmp = nlw; if (startmask) { - *dstTmp = *dstTmp & ~startmask | - GetPixelGroup (bits) & startmask; + *dstTmp = (*dstTmp & ~startmask) | + (GetPixelGroup (bits) & startmask); dstTmp++; RotBitsLeft (bits, PGSZB); } @@ -914,7 +950,7 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) { dst = dstTmp + (nlwTmp << 3); *dst = (*dst & ~endmask) | - GetPixelGroup (bits) & endmask; + (GetPixelGroup (bits) & endmask); } while (w--) { @@ -932,6 +968,7 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) } } else +#endif /* PPW == 4 */ { if (startmask) { diff --git a/cfb/cfbgc.c b/cfb/cfbgc.c index 62e0cbd76..c2e7a5965 100644 --- a/cfb/cfbgc.c +++ b/cfb/cfbgc.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbgc.c,v 1.6 2001/12/14 19:59:22 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -299,9 +300,9 @@ cfbCreateGC(pGC) pPriv = cfbGetGCPrivate(pGC); pPriv->rop = pGC->alu; pPriv->oneRect = FALSE; - pPriv->fExpose = TRUE; - pPriv->freeCompClip = FALSE; - pPriv->pRotatedPixmap = (PixmapPtr) NULL; + pGC->fExpose = TRUE; + pGC->freeCompClip = FALSE; + pGC->pRotatedPixmap = (PixmapPtr) NULL; return TRUE; } @@ -358,7 +359,7 @@ cfbValidateGC(pGC, changes, pDrawable) #ifdef NO_ONE_RECT devPriv->oneRect = FALSE; #else - oneRect = REGION_NUM_RECTS(devPriv->pCompositeClip) == 1; + oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1; if (oneRect != devPriv->oneRect) new_line = TRUE; devPriv->oneRect = oneRect; @@ -483,8 +484,7 @@ cfbValidateGC(pGC, changes, pDrawable) if ((width <= PGSZ) && !(width & (width - 1))) { - cfbCopyRotatePixmap(pGC->tile.pixmap, - &devPriv->pRotatedPixmap, + cfbCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap, xrot, yrot); new_pix = TRUE; } @@ -498,18 +498,18 @@ cfbValidateGC(pGC, changes, pDrawable) if ((width <= PGSZ) && !(width & (width - 1))) { - mfbCopyRotatePixmap(pGC->stipple, - &devPriv->pRotatedPixmap, xrot, yrot); + mfbCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap, + xrot, yrot); new_pix = TRUE; } } break; #endif } - if (!new_pix && devPriv->pRotatedPixmap) + if (!new_pix && pGC->pRotatedPixmap) { - (*pGC->pScreen->DestroyPixmap)(devPriv->pRotatedPixmap); - devPriv->pRotatedPixmap = (PixmapPtr) NULL; + (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap); + pGC->pRotatedPixmap = (PixmapPtr) NULL; } } @@ -540,7 +540,7 @@ cfbValidateGC(pGC, changes, pDrawable) { GCOps *newops; - if (newops = cfbMatchCommon (pGC, devPriv)) + if ((newops = cfbMatchCommon (pGC, devPriv))) { if (pGC->ops->devPrivate.val) miDestroyGCOps (pGC->ops); @@ -726,7 +726,7 @@ cfbValidateGC(pGC, changes, pDrawable) } break; case FillTiled: - if (devPriv->pRotatedPixmap) + if (pGC->pRotatedPixmap) { if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) pGC->ops->FillSpans = cfbTile32FSCopy; @@ -738,7 +738,7 @@ cfbValidateGC(pGC, changes, pDrawable) break; case FillStippled: #ifdef FOUR_BIT_CODE - if (devPriv->pRotatedPixmap) + if (pGC->pRotatedPixmap) pGC->ops->FillSpans = cfb8Stipple32FS; else #endif @@ -746,7 +746,7 @@ cfbValidateGC(pGC, changes, pDrawable) break; case FillOpaqueStippled: #ifdef FOUR_BIT_CODE - if (devPriv->pRotatedPixmap) + if (pGC->pRotatedPixmap) pGC->ops->FillSpans = cfb8OpaqueStipple32FS; else #endif diff --git a/cfb/cfbgetsp.c b/cfb/cfbgetsp.c index a2c9966df..e5c55f389 100644 --- a/cfb/cfbgetsp.c +++ b/cfb/cfbgetsp.c @@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/cfb/cfbgetsp.c,v 3.9 2001/12/14 19:59:22 dawes Exp $ */ #include "X.h" #include "Xmd.h" @@ -82,12 +83,18 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) int widthSrc; /* width of pixmap in bytes */ register DDXPointPtr pptLast; /* one past last point to get */ int xEnd; /* last pixel to copy from */ + int nl, srcBit; + int w; + PixelGroup *pdstNext; +#if PSZ == 24 + register char *psrcb, *pdstb; + register int xIndex = 0; +#else register int nstart; int nend; PixelGroup startmask, endmask; - int nlMiddle, nl, srcBit; - int w; - PixelGroup *pdstNext; + int nlMiddle; +#endif switch (pDrawable->bitsPerPixel) { case 1: @@ -99,35 +106,70 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) FatalError("cfbGetSpans: invalid depth\n"); } + /* + * XFree86 DDX empties the root borderClip when the VT is + * switched away; this checks for that case + */ + if (!cfbDrawableEnabled(pDrawable)) + return; cfbGetLongWidthAndPointer (pDrawable, widthSrc, psrcBase) #ifdef PIXEL_ADDR +# if PSZ != 24 if ((nspans == 1) && (*pwidth == 1)) { tmpSrc = *((PixelType *)(psrcBase + (ppt->y * widthSrc)) + ppt->x); #if BITMAP_BIT_ORDER == MSBFirst - tmpSrc <<= (sizeof (unsigned long) - sizeof (PixelType)) * 8; + tmpSrc <<= (sizeof (CfbBits) - sizeof (PixelType)) * 8; #endif *pdstStart = tmpSrc; return; } +# endif /* PSZ != 24 */ #endif pdst = pdstStart; pptLast = ppt + nspans; while(ppt < pptLast) { +#if PSZ == 24 + xEnd = min(ppt->x + *pwidth, widthSrc * sizeof(CfbBits) / 3); + w = xEnd - ppt->x; + psrc = psrcBase + ppt->y * widthSrc; + srcBit = ppt->x; + psrcb = (char *)psrc + (ppt->x * 3); + xIndex = 0; + pdstb = (char *)pdst; + pdstNext = pdst + ((w * 3 + 3) >> 2); +#else xEnd = min(ppt->x + *pwidth, widthSrc << PWSH); - psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH); w = xEnd - ppt->x; + psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH); srcBit = ppt->x & PIM; pdstNext = pdst + ((w + PPW - 1) >> PWSH); +#endif +#if PSZ == 24 + if (w < 0) + FatalError("cfb24GetSpans: Internal error (w < 0)\n"); + nl = w; + while (nl--){ + psrc = (PixelGroup *)((unsigned long)psrcb & ~0x03); + getbits24(psrc, tmpSrc, srcBit); + pdst = (PixelGroup *)((unsigned long)pdstb & ~0x03); + putbits24(tmpSrc, nstart, PPW, pdst, ~((CfbBits)0), xIndex); + srcBit++; + psrcb += 3; + xIndex++; + pdstb += 3; + } + pdst = pdstNext; +#else /* PSZ == 24 */ if (srcBit + w <= PPW) { getbits(psrc, srcBit, w, tmpSrc); - putbits(tmpSrc, 0, w, pdst, ~((unsigned long)0)); + putbits(tmpSrc, 0, w, pdst, ~((CfbBits)0)); pdst++; } else @@ -138,7 +180,7 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) { nstart = PPW - srcBit; getbits(psrc, srcBit, nstart, tmpSrc); - putbits(tmpSrc, 0, nstart, pdst, ~((unsigned long)0)); + putbits(tmpSrc, 0, nstart, pdst, ~((CfbBits)0)); if(srcBit + nstart >= PPW) psrc++; } @@ -146,7 +188,7 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) while (nl--) { tmpSrc = *psrc; - putbits(tmpSrc, nstart, PPW, pdst, ~((unsigned long)0)); + putbits(tmpSrc, nstart, PPW, pdst, ~((CfbBits)0)); psrc++; pdst++; } @@ -154,10 +196,11 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) { nend = xEnd & PIM; getbits(psrc, 0, nend, tmpSrc); - putbits(tmpSrc, nstart, nend, pdst, ~((unsigned long)0)); + putbits(tmpSrc, nstart, nend, pdst, ~((CfbBits)0)); } pdst = pdstNext; } +#endif /* PSZ == 24 */ ppt++; pwidth++; } diff --git a/cfb/cfbglblt8.c b/cfb/cfbglblt8.c index b87bc8513..5db5c1f01 100644 --- a/cfb/cfbglblt8.c +++ b/cfb/cfbglblt8.c @@ -23,6 +23,7 @@ Except as contained in this notice, the name of The Open Group 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 Open Group. */ +/* $XFree86: xc/programs/Xserver/cfb/cfbglblt8.c,v 3.6 2001/12/14 19:59:23 dawes Exp $ */ /* * Poly glyph blt. Accepts an arbitrary font <= 32 bits wide, in Copy mode @@ -63,7 +64,7 @@ in this Software without prior written authorization from The Open Group. #ifdef USE_LEFTBITS typedef unsigned char *glyphPointer; -extern unsigned long endtab[]; +extern CfbBits endtab[]; #define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \ (dst) &= widthMask; \ @@ -92,13 +93,18 @@ static void cfbPolyGlyphBlt8Clipped(); #define USE_STIPPLE_CODE #endif -#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && !defined(USE_LEFTBITS) +#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && PSZ == 8 && !defined(USE_LEFTBITS) #ifdef USE_STIPPLE_CODE #undef USE_STIPPLE_CODE #endif +#include "stip68kgnu.h" #endif +#if PSZ == 24 +#define DST_INC 3 +#else #define DST_INC (PGSZB >> PWSH) +#endif /* cfbStippleStack/cfbStippleStackTE are coded in assembly language. * They are only provided on some architecures. @@ -116,31 +122,31 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { - register unsigned long c; #ifndef GLYPHROP - register unsigned long pixel; + register CfbBits pixel; +#endif +#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE) + register CfbBits c; + register CfbBits *dst; #endif - register unsigned long *dst; register glyphPointer glyphBits; register int xoff; FontPtr pfont = pGC->font; CharInfoPtr pci; - unsigned long *dstLine; - unsigned long *pdstBase; + CfbBits *dstLine; + CfbBits *pdstBase; int hTmp; int bwidthDst; int widthDst; int h; - int ew; BoxRec bbox; /* for clipping */ - int widthDiff; int w; RegionPtr clip; BoxPtr extents; #ifdef USE_LEFTBITS int widthGlyph; - unsigned long widthMask; + CfbBits widthMask; #endif #ifndef STIPPLE #ifdef USE_STIPPLE_CODE @@ -207,7 +213,7 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) pixel = cfbGetGCPrivate(pGC)->xor; #endif - cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long) + cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits) widthDst = bwidthDst / PGSZB; while (nglyph--) @@ -215,12 +221,20 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) pci = *ppci++; glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci); xoff = x + pci->metrics.leftSideBearing; +#if PSZ == 24 + dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst +((xoff>> 2)*3); +#else dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst + (xoff >> PWSH); +#endif x += pci->metrics.characterWidth; - if (hTmp = pci->metrics.descent + pci->metrics.ascent) + if ((hTmp = pci->metrics.descent + pci->metrics.ascent)) { +#if PSZ == 24 + xoff &= 0x03; +#else xoff &= PIM; +#endif /* PSZ == 24 */ #ifdef STIPPLE STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); #else @@ -234,7 +248,7 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) #endif do { dst = dstLine; - dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); + dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst); GlyphBits(glyphBits, w, c) WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); dst += DST_INC; @@ -261,39 +275,43 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) CharInfoPtr *ppci; /* array of character info */ unsigned char *pglyphBase; /* start of array of glyphs */ { - register unsigned long c; #ifndef GLYPHROP - register unsigned long pixel; + register CfbBits pixel; +#endif +#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE) + register CfbBits c; #endif - register unsigned long *dst; register glyphPointer glyphBits; - register int xoff; - unsigned long c1; + register int xoff; +#if defined(USE_LEFT_BITS) || (!defined(STIPPLE) && !defined(USE_STIPPLE_CODE)) + register CfbBits *dst; +#endif CharInfoPtr pci; FontPtr pfont = pGC->font; - unsigned long *dstLine; - unsigned long *pdstBase; - CARD32 *cTmp, *clips; + CfbBits *dstLine; + CfbBits *pdstBase; +#ifdef USE_LEFT_BITS + CARD32 *cTmp; +#endif + CARD32 *clips; int maxAscent, maxDescent; int minLeftBearing; int hTmp; int widthDst; int bwidthDst; - int ew; int xG, yG; BoxPtr pBox; int numRects; - int widthDiff; int w; RegionPtr pRegion; int yBand; #ifdef GLYPHROP - unsigned long bits; + CfbBits bits; #endif #ifdef USE_LEFTBITS int widthGlyph; - unsigned long widthMask; + CfbBits widthMask; #endif #ifdef GLYPHROP @@ -302,7 +320,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) pixel = cfbGetGCPrivate(pGC)->xor; #endif - cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long) + cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits) widthDst = bwidthDst / PGSZB; maxAscent = FONTMAXBOUNDS(pfont,ascent); @@ -338,10 +356,19 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) xG = x + pci->metrics.leftSideBearing; yG = y - pci->metrics.ascent; x += pci->metrics.characterWidth; - if (hTmp = pci->metrics.descent + pci->metrics.ascent) + if ((hTmp = pci->metrics.descent + pci->metrics.ascent)) { +#if PSZ == 24 + dstLine = pdstBase + yG * widthDst + ((xG>> 2)*3); + /* never use (xG*3)>>2 */ +#else dstLine = pdstBase + yG * widthDst + (xG >> PWSH); +#endif +#if PSZ == 24 + xoff = xG & 3; +#else xoff = xG & PIM; +#endif #ifdef USE_LEFTBITS w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; widthGlyph = PADGLYPHWIDTHBYTES(w); @@ -354,7 +381,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) cTmp = clips; do { dst = dstLine; - dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); + dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst); GlyphBits(glyphBits, w, c) c &= *cTmp++; if (c) @@ -394,7 +421,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) #else do { dst = dstLine; - dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); + dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst); GlyphBits(glyphBits, w, c) if (c) { @@ -410,7 +437,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) c = BitLeft(c,PGSZB - xoff); dst += DST_INC; #else /* GLYPHROP */ - if (bits = GetBitGroup(BitRight(c,xoff))) + if ((bits = GetBitGroup(BitRight(c,xoff)))) WriteBitGroup(dst, pixel, bits); c = BitLeft(c,PGSZB - xoff); dst += DST_INC; diff --git a/cfb/cfbhrzvert.c b/cfb/cfbhrzvert.c index 3fe9262ad..6f4f7abe6 100644 --- a/cfb/cfbhrzvert.c +++ b/cfb/cfbhrzvert.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbhrzvert.c,v 3.8 2002/09/16 18:05:30 eich Exp $ */ /*********************************************************** Copyright 1987,1998 The Open Group @@ -58,19 +59,256 @@ SOFTWARE. /* horizontal solid line abs(len) > 1 */ +void cfbHorzS(rop, and, xor, addrl, nlwidth, x1, y1, len) register int rop; -register unsigned long and; -register unsigned long xor; -register unsigned long *addrl; /* pointer to base of bitmap */ +register CfbBits and; +register CfbBits xor; +register CfbBits *addrl; /* pointer to base of bitmap */ int nlwidth; /* width in longwords of bitmap */ int x1; /* initial point */ int y1; int len; /* length of line */ { register int nlmiddle; - register unsigned long startmask; - register unsigned long endmask; + +#if PSZ == 24 + + int leftIndex, rightIndex; + CfbBits piQxelAnd[3], piQxelXor[3]; + piQxelAnd[0] = (and & 0xFFFFFF) | ((and<<24) & 0xFF000000); + piQxelAnd[1] = ((and>>8) & 0xFFFF)| ((and<<16) & 0xFFFF0000); + piQxelAnd[2] = ((and<<8) & 0xFFFFFF00) | ((and>>16) & 0xFF); + + piQxelXor[0] = (xor & 0xFFFFFF) | ((xor<<24) & 0xFF000000); + piQxelXor[1] = ((xor>>8) & 0xFFFF)| ((xor<<16) & 0xFFFF0000); + piQxelXor[2] = ((xor<<8) & 0xFFFFFF00) | ((xor>>16) & 0xFF); + + leftIndex = x1 & 3; + rightIndex = ((x1 + len) < 5)?0:(x1 + len)&3; + nlmiddle = len; + if(leftIndex){ + nlmiddle -= (4 - leftIndex); + } + if(rightIndex){ + nlmiddle -= rightIndex; + } + if (nlmiddle < 0) + nlmiddle = 0; + + nlmiddle >>= 2; + + addrl += (y1 * nlwidth) + (x1 >> 2)*3 + (leftIndex?leftIndex-1:0); + + switch(leftIndex+len){ + case 4: + switch(leftIndex){ + case 0: + *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); + break; + case 1: + *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); + break; + case 2: + *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); + break; + case 3: + *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); + break; + } + break; + case 3: + switch(leftIndex){ + case 0: + *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); + addrl++; + *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); + break; + case 1: + *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); + addrl++; + *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); + break; + case 2: + *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + addrl++; + *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); + break; + } + break; + case 2: + if(leftIndex){ + *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); + addrl++; + } + else{ + *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); + addrl++; + } + *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF); + break; + case 1: /*only if leftIndex = 0 and w = 1*/ + *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF); + break; + case 0: /*never*/ + break; + default: + { + if (rop == GXcopy){ + switch(leftIndex){ + case 0: + break; + case 1: + *addrl = ((*addrl) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrl++; + *addrl++ = piQxelXor[1]; + *addrl++ = piQxelXor[2]; + break; + case 2: + *addrl = ((*addrl) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrl++; + *addrl++ = piQxelXor[2]; + break; + case 3: + *addrl = ((*addrl) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); + addrl++; + break; + } + while(nlmiddle--){ + *addrl++ = piQxelXor[0]; + *addrl++ = piQxelXor[1]; + *addrl++ = piQxelXor[2]; + } + switch(rightIndex){ + case 0: + break; + case 1: + *addrl = ((*addrl) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); + break; + case 2: + *addrl++ = piQxelXor[0]; + *addrl = ((*addrl) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + break; + case 3: + *addrl++ = piQxelXor[0]; + *addrl++ = piQxelXor[1]; + *addrl = ((*addrl) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + } + } + else{ + if(rop == GXxor){ + switch(leftIndex){ + case 0: + break; + case 1: + *addrl++ ^= (piQxelXor[0]&0xFF000000); + *addrl++ ^= piQxelXor[1]; + *addrl++ ^= piQxelXor[2]; + break; + case 2: + *addrl++ ^= (piQxelXor[1]& 0xFFFF0000); + *addrl++ ^= piQxelXor[2]; + break; + case 3: + *addrl++ ^= (piQxelXor[2]& 0xFFFFFF00); + break; + } + while(nlmiddle--){ + *addrl++ ^= piQxelXor[0]; + *addrl++ ^= piQxelXor[1]; + *addrl++ ^= piQxelXor[2]; + } + switch(rightIndex){ + case 0: + break; + case 1: + *addrl ^= (piQxelXor[0]& 0xFFFFFF); + break; + case 2: + *addrl++ ^= piQxelXor[0]; + *addrl ^= (piQxelXor[1]&0xFFFF); + break; + case 3: + *addrl++ ^= piQxelXor[0]; + *addrl++ ^= piQxelXor[1]; + *addrl ^= (piQxelXor[2]&0xFF); + break; + } + } + else{ + switch(leftIndex){ + case 0: + break; + case 1: + *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); + addrl++; + break; + case 2: + *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); + addrl++; + break; + case 3: + *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); + addrl++; + break; + } + while(nlmiddle--){ + *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); + addrl++; + } + switch(rightIndex){ + case 0: + break; + case 1: + *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF); + addrl++; + break; + case 2: + *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); + addrl++; + *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF); + break; + case 3: + *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); + addrl++; + *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); + addrl++; + *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); + break; + } + + } + } + } + } +#else + register CfbBits startmask; + register CfbBits endmask; addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH); @@ -119,56 +357,191 @@ int len; /* length of line */ *addrl = DoMaskRRop (*addrl, and, xor, endmask); } } +#endif } /* vertical solid line */ +void cfbVertS(rop, and, xor, addrl, nlwidth, x1, y1, len) int rop; -register unsigned long and, xor; -register unsigned long *addrl; /* pointer to base of bitmap */ +register CfbBits and, xor; +register CfbBits *addrl; /* pointer to base of bitmap */ register int nlwidth; /* width in longwords of bitmap */ int x1, y1; /* initial point */ register int len; /* length of line */ { +#if PSZ == 24 + int xIdx; + CfbBits and2 = 0, xor2 = 0, mask = 0, mask2; +#endif #ifdef PIXEL_ADDR register PixelType *bits = (PixelType *) addrl; +#if PSZ == 24 + nlwidth <<= PWSH; + xIdx = x1 & 3; + bits = (PixelType *)(addrl + (y1 * nlwidth) + ((x1*3) >> 2)); +#else nlwidth <<= PWSH; bits = bits + (y1 * nlwidth) + x1; +#endif +#if PSZ == 24 + mask2 = 0; + switch(xIdx){ + case 0: + mask = 0xFF000000; + xor &= 0xFFFFFF; + and |= 0xFF000000; + break; + case 3: + mask = 0xFF; + xor &= 0xFFFFFF; + xor <<= 8; + and <<= 8; + and |= 0xFF; + break; + case 1: + mask = 0xFFFFFF; + mask2 = 0xFFFF0000; + xor2 = (xor>>8) & 0xFFFF; + xor &= 0xFF; + xor <<= 24; + and2 = (and >> 8 ) | 0xFFFF0000; + and <<= 24; + and |= 0xFFFFFF; + break; + case 2: + mask = 0x0000FFFF; + mask2 = 0xFFFFFF00; + xor2 = (xor >> 16) & 0xFF; + xor <<= 16; + xor &= 0xFFFF0000; + and2 = (and >> 16) | 0xFFFFFF00; + and <<= 16; + and |= 0xFFFF; + break; + } +#endif /* * special case copy and xor to avoid a test per pixel */ if (rop == GXcopy) { +#if PSZ == 24 + switch(xIdx){ + case 0: + case 3: + while (len--){ + *bits = (*bits & mask)| xor; + bits += nlwidth; + } + break; + case 1: + case 2: + while (len--){ + *bits = (*bits & mask)| xor; + bits++; + *bits = (*bits & mask2)| xor2; + bits--; + bits += nlwidth; + } + break; + } +#else while (len--) { *bits = xor; bits += nlwidth; } +#endif } else if (rop == GXxor) { +#if PSZ == 24 + switch(xIdx){ + case 0: + case 3: + while (len--){ + *bits ^= xor; + bits += nlwidth; + } + break; + case 1: + case 2: + while (len--){ + *bits ^= xor; + bits++; + *bits ^= xor2; + bits--; + bits += nlwidth; + } + break; + } +#else while (len--) { *bits ^= xor; bits += nlwidth; } +#endif } else { +#if PSZ == 24 + switch(xIdx){ + case 0: + while (len--){ + *bits = DoMaskRRop(*bits, and, xor, 0x00FFFFFF); + bits += nlwidth; + } + break; + case 3: + while (len--){ + *bits = DoMaskRRop(*bits, and, xor, 0xFFFFFF00); + bits += nlwidth; + } + break; + case 1: + while (len--){ + *bits = DoMaskRRop(*bits, and, xor, 0xFF000000); + bits++; + *bits = DoMaskRRop(*bits, and2, xor2, 0x0000FFFF); + bits--; + bits += nlwidth; + } + break; + case 2: + while (len--){ + *bits = DoMaskRRop(*bits, and, xor, 0xFFFF0000); + bits++; + *bits = DoMaskRRop(*bits, and2, xor2, 0x000000FF); + bits--; + bits += nlwidth; + } + break; + } +#else while (len--) { *bits = DoRRop(*bits, and, xor); bits += nlwidth; } +#endif } #else /* !PIXEL_ADDR */ +#if PSZ == 24 + addrl = addrl + (y1 * nlwidth) + ((x1*3) >>2); + + and |= ~cfbmask[(x1 & 3)<<1]; + xor &= cfbmask[(x1 & 3)<<1]; +#else addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH); and |= ~cfbmask[x1 & PIM]; xor &= cfbmask[x1 & PIM]; +#endif while (len--) { diff --git a/cfb/cfbigblt8.c b/cfb/cfbigblt8.c index 7e20e2578..aa1060240 100644 --- a/cfb/cfbigblt8.c +++ b/cfb/cfbigblt8.c @@ -26,9 +26,12 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/cfbigblt8.c,v 1.6 2001/12/14 19:59:23 dawes Exp $ */ + #include "X.h" #include "Xmd.h" #include "Xproto.h" +#include "mi.h" #include "cfb.h" #include "fontstruct.h" #include "dixfontstr.h" @@ -51,14 +54,18 @@ cfbImageGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) { ExtentInfoRec info; /* used by QueryGlyphExtents() */ xRectangle backrect; - int fillStyle; - int alu; int fgPixel; - int rop; - int xor; - int and; - int pm; - cfbPrivGC *priv; + cfbPrivGC *priv; + + /* + * We can't avoid GC validations if calling mi functions. + */ + if ((pGC->ops->PolyFillRect == miPolyFillRect) || + (pGC->ops->PolyGlyphBlt == miPolyGlyphBlt)) + { + miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + return; + } QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); diff --git a/cfb/cfbimage.c b/cfb/cfbimage.c index af0fcc11d..1983ae48a 100644 --- a/cfb/cfbimage.c +++ b/cfb/cfbimage.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbimage.c,v 1.13 2001/12/14 19:59:23 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -54,10 +55,7 @@ SOFTWARE. #include "cfb.h" #include "cfbmskbits.h" #include "servermd.h" - -#ifdef LOWMEMFTPT #include "mi.h" -#endif /* ifdef LOWMEMFTPT */ void cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) @@ -68,7 +66,6 @@ cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) int format; char *pImage; { - int bitsPerPixel; PixmapPtr pPixmap; if ((w == 0) || (h == 0)) @@ -82,21 +79,21 @@ cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) if (!pPixmap) return; - cfbGetGCPrivate(pGC)->fExpose = FALSE; + pGC->fExpose = FALSE; if (format == ZPixmap) (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, w, h, x, y); else (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, w, h, x, y, 1); - cfbGetGCPrivate(pGC)->fExpose = TRUE; + pGC->fExpose = TRUE; FreeScratchPixmapHeader(pPixmap); } else { - unsigned long oldFg, oldBg; + CfbBits oldFg, oldBg; XID gcv[3]; - unsigned long oldPlanemask; + CfbBits oldPlanemask; unsigned long i; long bytesPer; @@ -124,6 +121,7 @@ cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) gcv[1] = oldFg; gcv[2] = oldBg; DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0); + ValidateGC(pDraw, pGC); } } @@ -153,6 +151,12 @@ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine) return; } pScreen = pDrawable->pScreen; + /* + * XFree86 DDX empties the root borderClip when the VT is + * switched away; this checks for that case + */ + if (!cfbDrawableEnabled (pDrawable)) + return; if (format == ZPixmap) { pPixmap = GetScratchPixmapHeader(pScreen, w, h, @@ -176,7 +180,9 @@ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine) } else { -#if PSZ == 8 + +#if IMAGE_BYTE_ORDER == LSBFirst + pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1, /*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine); if (!pPixmap) diff --git a/cfb/cfbline.c b/cfb/cfbline.c index 019d93720..432cb62d9 100644 --- a/cfb/cfbline.c +++ b/cfb/cfbline.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbline.c,v 3.6 2001/12/14 19:59:23 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -114,7 +115,7 @@ cfbLineSS (pDrawable, pGC, mode, npt, pptInit) unsigned int oc1; /* outcode of point 1 */ unsigned int oc2; /* outcode of point 2 */ - unsigned long *addrl; /* address of destination pixmap */ + CfbBits *addrl; /* address of destination pixmap */ int nlwidth; /* width in longwords of destination pixmap */ int xorg, yorg; /* origin of window */ @@ -134,11 +135,11 @@ cfbLineSS (pDrawable, pGC, mode, npt, pptInit) register int x1, x2; RegionPtr cclip; cfbPrivGCPtr devPriv; - unsigned long xor, and; + CfbBits xor, and; int alu; devPriv = cfbGetGCPrivate(pGC); - cclip = devPriv->pCompositeClip; + cclip = pGC->pCompositeClip; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); @@ -428,11 +429,16 @@ cfbLineSS (pDrawable, pGC, mode, npt, pptInit) (x2 < pbox->x2) && (y2 < pbox->y2)) { - unsigned long mask; - unsigned long scrbits; + CfbBits mask; + CfbBits scrbits; +#if PSZ == 24 + mask = cfbmask[(x2 & 3)<<1]; + addrl += (y2 * nlwidth) + ((x2*3) >> 2); +#else mask = cfbmask[x2 & PIM]; addrl += (y2 * nlwidth) + (x2 >> PWSH); +#endif scrbits = *addrl; *addrl = (scrbits & ~mask) | (DoRRop (scrbits, and, xor) & mask); @@ -476,7 +482,7 @@ cfbLineSD( pDrawable, pGC, mode, npt, pptInit) register unsigned int oc1; /* outcode of point 1 */ register unsigned int oc2; /* outcode of point 2 */ - unsigned long *addrl; /* address of destination pixmap */ + CfbBits *addrl; /* address of destination pixmap */ int nlwidth; /* width in longwords of destination pixmap */ int xorg, yorg; /* origin of window */ @@ -502,7 +508,7 @@ cfbLineSD( pDrawable, pGC, mode, npt, pptInit) cfbPrivGCPtr devPriv; devPriv = cfbGetGCPrivate(pGC); - cclip = devPriv->pCompositeClip; + cclip = pGC->pCompositeClip; rrops[0].rop = devPriv->rop; rrops[0].and = devPriv->and; rrops[0].xor = devPriv->xor; @@ -632,7 +638,6 @@ cfbLineSD( pDrawable, pGC, mode, npt, pptInit) int clip1 = 0, clip2 = 0; int clipdx, clipdy; int err; - int dashIndexTmp, dashOffsetTmp; if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1, @@ -724,14 +729,19 @@ dontStep: ; (x2 < pbox->x2) && (y2 < pbox->y2)) { - unsigned long mask; + CfbBits mask; int pix; pix = 0; if (dashIndex & 1) pix = 1; +#if PSZ == 24 + mask = cfbmask[(x2 & 3)<<1]; + addrl += (y2 * nlwidth) + ((x2 *3)>> 2); +#else mask = cfbmask[x2 & PIM]; addrl += (y2 * nlwidth) + (x2 >> PWSH); +#endif *addrl = DoMaskRRop (*addrl, rrops[pix].and, rrops[pix].xor, mask); break; } diff --git a/cfb/cfbmap.h b/cfb/cfbmap.h index 75a79eb1e..c02ddfb96 100644 --- a/cfb/cfbmap.h +++ b/cfb/cfbmap.h @@ -26,162 +26,298 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/cfbmap.h,v 3.11 2001/12/14 19:59:23 dawes Exp $ */ + /* * Map names around so that multiple depths can be supported simultaneously */ -/* a losing vendor cpp dumps core if we define NAME in terms of CATNAME */ +#if 0 +#undef QuartetBitsTable +#undef QuartetPixelMaskTable +#undef cfb8ClippedLineCopy +#undef cfb8ClippedLineGeneral +#undef cfb8ClippedLineXor +#undef cfb8LineSS1Rect +#undef cfb8LineSS1RectCopy +#undef cfb8LineSS1RectGeneral +#undef cfb8LineSS1RectPreviousCopy +#undef cfb8LineSS1RectXor +#undef cfb8SegmentSS1Rect +#undef cfb8SegmentSS1RectCopy +#undef cfb8SegmentSS1RectGeneral +#undef cfb8SegmentSS1RectShiftCopy +#undef cfb8SegmentSS1RectXor +#undef cfbAllocatePrivates +#undef cfbBSFuncRec +#undef cfbBitBlt +#undef cfbBresD +#undef cfbBresS +#undef cfbChangeWindowAttributes +#undef cfbCloseScreen +#undef cfbCopyArea +#undef cfbCopyImagePlane +#undef cfbCopyPixmap +#undef cfbCopyPlane +#undef cfbCopyRotatePixmap +#undef cfbCopyWindow +#undef cfbCreateGC +#undef cfbCreatePixmap +#undef cfbCreateScreenResources +#undef cfbCreateWindow +#undef cfbDestroyPixmap +#undef cfbDestroyWindow +#undef cfbDoBitblt +#undef cfbDoBitbltCopy +#undef cfbDoBitbltGeneral +#undef cfbDoBitbltOr +#undef cfbDoBitbltXor +#undef cfbFillBoxSolid +#undef cfbFillBoxTile32 +#undef cfbFillBoxTile32sCopy +#undef cfbFillBoxTile32sGeneral +#undef cfbFillBoxTileOdd +#undef cfbFillBoxTileOddCopy +#undef cfbFillBoxTileOddGeneral +#undef cfbFillPoly1RectCopy +#undef cfbFillPoly1RectGeneral +#undef cfbFillRectSolidCopy +#undef cfbFillRectSolidGeneral +#undef cfbFillRectSolidXor +#undef cfbFillRectTile32Copy +#undef cfbFillRectTile32General +#undef cfbFillRectTileOdd +#undef cfbFillSpanTile32sCopy +#undef cfbFillSpanTile32sGeneral +#undef cfbFillSpanTileOddCopy +#undef cfbFillSpanTileOddGeneral +#undef cfbFinishScreenInit +#undef cfbGCFuncs +#undef cfbGetImage +#undef cfbGetScreenPixmap +#undef cfbGetSpans +#undef cfbHorzS +#undef cfbImageGlyphBlt8 +#undef cfbLineSD +#undef cfbLineSS +#undef cfbMapWindow +#undef cfbMatchCommon +#undef cfbNonTEOps +#undef cfbNonTEOps1Rect +#undef cfbPadPixmap +#undef cfbPaintWindow +#undef cfbPolyFillArcSolidCopy +#undef cfbPolyFillArcSolidGeneral +#undef cfbPolyFillRect +#undef cfbPolyGlyphBlt8 +#undef cfbPolyGlyphRop8 +#undef cfbPolyPoint +#undef cfbPositionWindow +#undef cfbPutImage +#undef cfbReduceRasterOp +#undef cfbRestoreAreas +#undef cfbSaveAreas +#undef cfbScreenInit +#undef cfbScreenPrivateIndex +#undef cfbSegmentSD +#undef cfbSegmentSS +#undef cfbSetScanline +#undef cfbSetScreenPixmap +#undef cfbSetSpans +#undef cfbSetupScreen +#undef cfbSolidSpansCopy +#undef cfbSolidSpansGeneral +#undef cfbSolidSpansXor +#undef cfbStippleStack +#undef cfbStippleStackTE +#undef cfbTEGlyphBlt +#undef cfbTEOps +#undef cfbTEOps1Rect +#undef cfbTile32FSCopy +#undef cfbTile32FSGeneral +#undef cfbUnmapWindow +#undef cfbUnnaturalStippleFS +#undef cfbUnnaturalTileFS +#undef cfbValidateGC +#undef cfbVertS +#undef cfbXRotatePixmap +#undef cfbYRotatePixmap +#undef cfbZeroPolyArcSS8Copy +#undef cfbZeroPolyArcSS8General +#undef cfbZeroPolyArcSS8Xor +#undef cfbendpartial +#undef cfbendtab +#undef cfbmask +#undef cfbrmask +#undef cfbstartpartial +#undef cfbstarttab +#endif + +/* a losing vendor cpp dumps core if we define CFBNAME in terms of CATNAME */ #if PSZ != 8 + #if PSZ == 32 -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define NAME(subname) cfb32##subname +#if !defined(UNIXCPP) || defined(ANSICPP) +#define CFBNAME(subname) cfb32##subname #else -#define NAME(subname) cfb32/**/subname +#define CFBNAME(subname) cfb32/**/subname +#endif +#endif + +#if PSZ == 24 +#if !defined(UNIXCPP) || defined(ANSICPP) +#define CFBNAME(subname) cfb24##subname +#else +#define CFBNAME(subname) cfb24/**/subname #endif #endif #if PSZ == 16 -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define NAME(subname) cfb16##subname +#if !defined(UNIXCPP) || defined(ANSICPP) +#define CFBNAME(subname) cfb16##subname #else -#define NAME(subname) cfb16/**/subname +#define CFBNAME(subname) cfb16/**/subname #endif #endif #if PSZ == 4 -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define NAME(subname) cfb4##subname +#if !defined(UNIXCPP) || defined(ANSICPP) +#define CFBNAME(subname) cfb4##subname #else -#define NAME(subname) cfb4/**/subname +#define CFBNAME(subname) cfb4/**/subname #endif #endif -#ifndef NAME +#ifndef CFBNAME cfb can not hack PSZ yet #endif -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#undef CATNAME + +#if !defined(UNIXCPP) || defined(ANSICPP) #define CATNAME(prefix,subname) prefix##subname #else #define CATNAME(prefix,subname) prefix/**/subname #endif -#define cfbScreenPrivateIndex NAME(ScreenPrivateIndex) -#define QuartetBitsTable NAME(QuartetBitsTable) -#define QuartetPixelMaskTable NAME(QuartetPixelMaskTable) -#define cfbAllocatePrivates NAME(AllocatePrivates) -#define cfbBSFuncRec NAME(BSFuncRec) -#define cfbBitBlt NAME(BitBlt) -#define cfbBresD NAME(BresD) -#define cfbBresS NAME(BresS) -#define cfbChangeWindowAttributes NAME(ChangeWindowAttributes) -#define cfbCloseScreen NAME(CloseScreen) -#define cfbCopyArea NAME(CopyArea) -#define cfbCopyImagePlane NAME(CopyImagePlane) -#define cfbCopyPixmap NAME(CopyPixmap) -#define cfbCopyPlane NAME(CopyPlane) -#define cfbCopyRotatePixmap NAME(CopyRotatePixmap) -#define cfbCopyWindow NAME(CopyWindow) -#define cfbCreateGC NAME(CreateGC) -#define cfbCreatePixmap NAME(CreatePixmap) -#define cfbCreateWindow NAME(CreateWindow) -#define cfbCreateScreenResources NAME(CreateScreenResources) -#define cfbDestroyPixmap NAME(DestroyPixmap) -#define cfbDestroyWindow NAME(DestroyWindow) -#define cfbDoBitblt NAME(DoBitblt) -#define cfbDoBitbltCopy NAME(DoBitbltCopy) -#define cfbDoBitbltGeneral NAME(DoBitbltGeneral) -#define cfbDoBitbltOr NAME(DoBitbltOr) -#define cfbDoBitbltXor NAME(DoBitbltXor) -#define cfbFillBoxSolid NAME(FillBoxSolid) -#define cfbFillBoxTile32 NAME(FillBoxTile32) -#define cfbFillBoxTile32sCopy NAME(FillBoxTile32sCopy) -#define cfbFillBoxTile32sGeneral NAME(FillBoxTile32sGeneral) -#define cfbFillBoxTileOdd NAME(FillBoxTileOdd) -#define cfbFillBoxTileOddCopy NAME(FillBoxTileOddCopy) -#define cfbFillBoxTileOddGeneral NAME(FillBoxTileOddGeneral) -#define cfbFillPoly1RectCopy NAME(FillPoly1RectCopy) -#define cfbFillPoly1RectGeneral NAME(FillPoly1RectGeneral) -#define cfbFillRectSolidCopy NAME(FillRectSolidCopy) -#define cfbFillRectSolidGeneral NAME(FillRectSolidGeneral) -#define cfbFillRectSolidXor NAME(FillRectSolidXor) -#define cfbFillRectTile32Copy NAME(FillRectTile32Copy) -#define cfbFillRectTile32General NAME(FillRectTile32General) -#define cfbFillRectTileOdd NAME(FillRectTileOdd) -#define cfbFillSpanTile32sCopy NAME(FillSpanTile32sCopy) -#define cfbFillSpanTile32sGeneral NAME(FillSpanTile32sGeneral) -#define cfbFillSpanTileOddCopy NAME(FillSpanTileOddCopy) -#define cfbFillSpanTileOddGeneral NAME(FillSpanTileOddGeneral) -#define cfbFinishScreenInit NAME(FinishScreenInit) -#define cfbGCFuncs NAME(GCFuncs) -#define cfbGetImage NAME(GetImage) -#define cfbGetSpans NAME(GetSpans) -#define cfbHorzS NAME(HorzS) -#define cfbImageGlyphBlt8 NAME(ImageGlyphBlt8) -#define cfbLineSD NAME(LineSD) -#define cfbLineSS NAME(LineSS) -#define cfbMapWindow NAME(MapWindow) -#define cfbMatchCommon NAME(MatchCommon) -#define cfbNonTEOps NAME(NonTEOps) -#define cfbNonTEOps1Rect NAME(NonTEOps1Rect) -#define cfbPadPixmap NAME(PadPixmap) -#define cfbPaintWindow NAME(PaintWindow) -#define cfbPolyGlyphBlt8 NAME(PolyGlyphBlt8) -#define cfbPolyGlyphRop8 NAME(PolyGlyphRop8) -#define cfbPolyFillArcSolidCopy NAME(PolyFillArcSolidCopy) -#define cfbPolyFillArcSolidGeneral NAME(PolyFillArcSolidGeneral) -#define cfbPolyFillRect NAME(PolyFillRect) -#define cfbPolyPoint NAME(PolyPoint) -#define cfbPositionWindow NAME(PositionWindow) -#define cfbPutImage NAME(PutImage) -#define cfbReduceRasterOp NAME(ReduceRasterOp) -#define cfbRestoreAreas NAME(RestoreAreas) -#define cfbSaveAreas NAME(SaveAreas) -#define cfbScreenInit NAME(ScreenInit) -#define cfbSegmentSD NAME(SegmentSD) -#define cfbSegmentSS NAME(SegmentSS) -#define cfbSetScanline NAME(SetScanline) -#define cfbSetSpans NAME(SetSpans) -#define cfbSetupScreen NAME(SetupScreen) -#define cfbSolidSpansCopy NAME(SolidSpansCopy) -#define cfbSolidSpansGeneral NAME(SolidSpansGeneral) -#define cfbSolidSpansXor NAME(SolidSpansXor) -#define cfbStippleStack NAME(StippleStack) -#define cfbStippleStackTE NAME(StippleStackTE) -#define cfbTEGlyphBlt NAME(TEGlyphBlt) -#define cfbTEOps NAME(TEOps) -#define cfbTEOps1Rect NAME(TEOps1Rect) -#define cfbTile32FSCopy NAME(Tile32FSCopy) -#define cfbTile32FSGeneral NAME(Tile32FSGeneral) -#define cfbUnmapWindow NAME(UnmapWindow) -#define cfbUnnaturalStippleFS NAME(UnnaturalStippleFS) -#define cfbUnnaturalTileFS NAME(UnnaturalTileFS) -#define cfbValidateGC NAME(ValidateGC) -#define cfbVertS NAME(VertS) -#define cfbXRotatePixmap NAME(XRotatePixmap) -#define cfbYRotatePixmap NAME(YRotatePixmap) -#define cfbendpartial NAME(endpartial) -#define cfbendtab NAME(endtab) -#define cfbmask NAME(mask) -#define cfbrmask NAME(rmask) -#define cfbstartpartial NAME(startpartial) -#define cfbstarttab NAME(starttab) -#define cfb8LineSS1Rect NAME(LineSS1Rect) -#define cfb8SegmentSS1Rect NAME(SegmentSS1Rect) -#define cfb8ClippedLineCopy NAME(ClippedLineCopy) -#define cfb8ClippedLineXor NAME(ClippedLineXor) -#define cfb8ClippedLineGeneral NAME(ClippedLineGeneral ) -#define cfb8SegmentSS1RectCopy NAME(SegmentSS1RectCopy) -#define cfb8SegmentSS1RectXor NAME(SegmentSS1RectXor) -#define cfb8SegmentSS1RectGeneral NAME(SegmentSS1RectGeneral ) -#define cfb8SegmentSS1RectShiftCopy NAME(SegmentSS1RectShiftCopy) -#define cfb8LineSS1RectCopy NAME(LineSS1RectCopy) -#define cfb8LineSS1RectXor NAME(LineSS1RectXor) -#define cfb8LineSS1RectGeneral NAME(LineSS1RectGeneral ) -#define cfb8LineSS1RectPreviousCopy NAME(LineSS1RectPreviousCopy) -#define cfbZeroPolyArcSS8Copy NAME(ZeroPolyArcSSCopy) -#define cfbZeroPolyArcSS8Xor NAME(ZeroPolyArcSSXor) -#define cfbZeroPolyArcSS8General NAME(ZeroPolyArcSSGeneral) +#define QuartetBitsTable CFBNAME(QuartetBitsTable) +#define QuartetPixelMaskTable CFBNAME(QuartetPixelMaskTable) +#define cfb8ClippedLineCopy CFBNAME(ClippedLineCopy) +#define cfb8ClippedLineGeneral CFBNAME(ClippedLineGeneral ) +#define cfb8ClippedLineXor CFBNAME(ClippedLineXor) +#define cfb8LineSS1Rect CFBNAME(LineSS1Rect) +#define cfb8LineSS1RectCopy CFBNAME(LineSS1RectCopy) +#define cfb8LineSS1RectGeneral CFBNAME(LineSS1RectGeneral ) +#define cfb8LineSS1RectPreviousCopy CFBNAME(LineSS1RectPreviousCopy) +#define cfb8LineSS1RectXor CFBNAME(LineSS1RectXor) +#define cfb8SegmentSS1Rect CFBNAME(SegmentSS1Rect) +#define cfb8SegmentSS1RectCopy CFBNAME(SegmentSS1RectCopy) +#define cfb8SegmentSS1RectGeneral CFBNAME(SegmentSS1RectGeneral ) +#define cfb8SegmentSS1RectShiftCopy CFBNAME(SegmentSS1RectShiftCopy) +#define cfb8SegmentSS1RectXor CFBNAME(SegmentSS1RectXor) +#define cfbAllocatePrivates CFBNAME(AllocatePrivates) +#define cfbBSFuncRec CFBNAME(BSFuncRec) +#define cfbBitBlt CFBNAME(BitBlt) +#define cfbBresD CFBNAME(BresD) +#define cfbBresS CFBNAME(BresS) +#define cfbChangeWindowAttributes CFBNAME(ChangeWindowAttributes) +#define cfbCloseScreen CFBNAME(CloseScreen) +#define cfbCopyArea CFBNAME(CopyArea) +#define cfbCopyImagePlane CFBNAME(CopyImagePlane) +#define cfbCopyPixmap CFBNAME(CopyPixmap) +#define cfbCopyPlane CFBNAME(CopyPlane) +#define cfbCopyRotatePixmap CFBNAME(CopyRotatePixmap) +#define cfbCopyWindow CFBNAME(CopyWindow) +#define cfbCreateGC CFBNAME(CreateGC) +#define cfbCreatePixmap CFBNAME(CreatePixmap) +#define cfbCreateScreenResources CFBNAME(CreateScreenResources) +#define cfbCreateWindow CFBNAME(CreateWindow) +#define cfbDestroyPixmap CFBNAME(DestroyPixmap) +#define cfbDestroyWindow CFBNAME(DestroyWindow) +#define cfbDoBitblt CFBNAME(DoBitblt) +#define cfbDoBitbltCopy CFBNAME(DoBitbltCopy) +#define cfbDoBitbltGeneral CFBNAME(DoBitbltGeneral) +#define cfbDoBitbltOr CFBNAME(DoBitbltOr) +#define cfbDoBitbltXor CFBNAME(DoBitbltXor) +#define cfbFillBoxSolid CFBNAME(FillBoxSolid) +#define cfbFillBoxTile32 CFBNAME(FillBoxTile32) +#define cfbFillBoxTile32sCopy CFBNAME(FillBoxTile32sCopy) +#define cfbFillBoxTile32sGeneral CFBNAME(FillBoxTile32sGeneral) +#define cfbFillBoxTileOdd CFBNAME(FillBoxTileOdd) +#define cfbFillBoxTileOddCopy CFBNAME(FillBoxTileOddCopy) +#define cfbFillBoxTileOddGeneral CFBNAME(FillBoxTileOddGeneral) +#define cfbFillPoly1RectCopy CFBNAME(FillPoly1RectCopy) +#define cfbFillPoly1RectGeneral CFBNAME(FillPoly1RectGeneral) +#define cfbFillRectSolidCopy CFBNAME(FillRectSolidCopy) +#define cfbFillRectSolidGeneral CFBNAME(FillRectSolidGeneral) +#define cfbFillRectSolidXor CFBNAME(FillRectSolidXor) +#define cfbFillRectTile32Copy CFBNAME(FillRectTile32Copy) +#define cfbFillRectTile32General CFBNAME(FillRectTile32General) +#define cfbFillRectTileOdd CFBNAME(FillRectTileOdd) +#define cfbFillSpanTile32sCopy CFBNAME(FillSpanTile32sCopy) +#define cfbFillSpanTile32sGeneral CFBNAME(FillSpanTile32sGeneral) +#define cfbFillSpanTileOddCopy CFBNAME(FillSpanTileOddCopy) +#define cfbFillSpanTileOddGeneral CFBNAME(FillSpanTileOddGeneral) +#define cfbFinishScreenInit CFBNAME(FinishScreenInit) +#define cfbGCFuncs CFBNAME(GCFuncs) +#define cfbGetImage CFBNAME(GetImage) +#define cfbGetScreenPixmap CFBNAME(GetScreenPixmap) +#define cfbGetSpans CFBNAME(GetSpans) +#define cfbHorzS CFBNAME(HorzS) +#define cfbImageGlyphBlt8 CFBNAME(ImageGlyphBlt8) +#define cfbLineSD CFBNAME(LineSD) +#define cfbLineSS CFBNAME(LineSS) +#define cfbMapWindow CFBNAME(MapWindow) +#define cfbMatchCommon CFBNAME(MatchCommon) +#define cfbNonTEOps CFBNAME(NonTEOps) +#define cfbNonTEOps1Rect CFBNAME(NonTEOps1Rect) +#define cfbPadPixmap CFBNAME(PadPixmap) +#define cfbPaintWindow CFBNAME(PaintWindow) +#define cfbPolyFillArcSolidCopy CFBNAME(PolyFillArcSolidCopy) +#define cfbPolyFillArcSolidGeneral CFBNAME(PolyFillArcSolidGeneral) +#define cfbPolyFillRect CFBNAME(PolyFillRect) +#define cfbPolyGlyphBlt8 CFBNAME(PolyGlyphBlt8) +#define cfbPolyGlyphRop8 CFBNAME(PolyGlyphRop8) +#define cfbPolyPoint CFBNAME(PolyPoint) +#define cfbPositionWindow CFBNAME(PositionWindow) +#define cfbPutImage CFBNAME(PutImage) +#define cfbReduceRasterOp CFBNAME(ReduceRasterOp) +#define cfbRestoreAreas CFBNAME(RestoreAreas) +#define cfbSaveAreas CFBNAME(SaveAreas) +#define cfbScreenInit CFBNAME(ScreenInit) +#define cfbScreenPrivateIndex CFBNAME(ScreenPrivateIndex) +#define cfbSegmentSD CFBNAME(SegmentSD) +#define cfbSegmentSS CFBNAME(SegmentSS) +#define cfbSetScanline CFBNAME(SetScanline) +#define cfbSetScreenPixmap CFBNAME(SetScreenPixmap) +#define cfbSetSpans CFBNAME(SetSpans) +#define cfbSetupScreen CFBNAME(SetupScreen) +#define cfbSolidSpansCopy CFBNAME(SolidSpansCopy) +#define cfbSolidSpansGeneral CFBNAME(SolidSpansGeneral) +#define cfbSolidSpansXor CFBNAME(SolidSpansXor) +#define cfbStippleStack CFBNAME(StippleStack) +#define cfbStippleStackTE CFBNAME(StippleStackTE) +#define cfbTEGlyphBlt CFBNAME(TEGlyphBlt) +#define cfbTEOps CFBNAME(TEOps) +#define cfbTEOps1Rect CFBNAME(TEOps1Rect) +#define cfbTile32FSCopy CFBNAME(Tile32FSCopy) +#define cfbTile32FSGeneral CFBNAME(Tile32FSGeneral) +#define cfbUnmapWindow CFBNAME(UnmapWindow) +#define cfbUnnaturalStippleFS CFBNAME(UnnaturalStippleFS) +#define cfbUnnaturalTileFS CFBNAME(UnnaturalTileFS) +#define cfbValidateGC CFBNAME(ValidateGC) +#define cfbVertS CFBNAME(VertS) +#define cfbXRotatePixmap CFBNAME(XRotatePixmap) +#define cfbYRotatePixmap CFBNAME(YRotatePixmap) +#define cfbZeroPolyArcSS8Copy CFBNAME(ZeroPolyArcSSCopy) +#define cfbZeroPolyArcSS8General CFBNAME(ZeroPolyArcSSGeneral) +#define cfbZeroPolyArcSS8Xor CFBNAME(ZeroPolyArcSSXor) +#define cfbendpartial CFBNAME(endpartial) +#define cfbendtab CFBNAME(endtab) +#define cfbmask CFBNAME(mask) +#define cfbrmask CFBNAME(rmask) +#define cfbstartpartial CFBNAME(startpartial) +#define cfbstarttab CFBNAME(starttab) #endif /* PSZ != 8 */ diff --git a/cfb/cfbmskbits.c b/cfb/cfbmskbits.c index 4c26e3576..cbf364770 100644 --- a/cfb/cfbmskbits.c +++ b/cfb/cfbmskbits.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.c,v 3.2 2001/01/17 22:36:35 dawes Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -215,6 +216,38 @@ PixelGroup cfbendtab[] = #endif /* PGSZ */ #endif +#if PSZ == 24 +#if PGSZ == 32 +PixelGroup cfbstarttab[] = + { + cfbBits(0x00000000), + cfbBits(0x000000FF), + cfbBits(0x0000FFFF), + cfbBits(0x00FFFFFF), + }; +PixelGroup cfbendtab[] = + { + cfbBits(0x00000000), + cfbBits(0xFFFFFF00), + cfbBits(0xFFFF0000), + cfbBits(0xFF000000), + }; +#else /* PGSZ == 64 */ +PixelGroup cfbstarttab[] = + { + cfbBits(0x0000000000000000), + cfbBits(0x000000FFFFFFFFFF), + cfbBits(0x000000000000FFFF), + }; +PixelGroup cfbendtab[] = + { + cfbBits(0x0000000000000000), + cfbBits(0xFFFFFFFFFF000000), + cfbBits(0xFFFF000000000000), + }; +#endif /* PGSZ */ +#endif /* PSZ == 24 */ + #if PSZ == 32 #if PGSZ == 32 PixelGroup cfbstarttab[] = @@ -388,6 +421,48 @@ PixelGroup cfbendpartial[] = #endif /* PGSZ */ #endif /* PSZ == 16 */ +#if PSZ == 24 +#if PGSZ == 32 +PixelGroup cfbstartpartial[] = + { + cfbBits(0xFFFFFFFF), + cfbBits(0x000000FF), + cfbBits(0x0000FFFF), + cfbBits(0x00FFFFFF), + }; + +PixelGroup cfbendpartial[] = + { + cfbBits(0xFFFFFFFF), + cfbBits(0xFFFFFF00), + cfbBits(0xFFFF0000), + cfbBits(0xFF000000), + }; +#else /* PGSZ == 64 */ +PixelGroup cfbstartpartial[] = + { + cfbBits(0xFFFFFFFFFFFFFFFF), + cfbBits(0x0000FFFFFFFFFFFF), + cfbBits(0x000000FFFFFFFFFF), + cfbBits(0x00000000FFFFFFFF), + cfbBits(0x0000000000FFFFFF), + cfbBits(0x000000000000FFFF), + cfbBits(0x00000000000000FF), + }; + +PixelGroup cfbendpartial[] = + { + cfbBits(0xFFFFFFFFFFFFFFFF), + cfbBits(0xFFFFFFFFFFFF0000), + cfbBits(0xFFFFFFFFFF000000), + cfbBits(0xFFFFFFFF00000000), + cfbBits(0xFFFFFF0000000000), + cfbBits(0xFFFF000000000000), + cfbBits(0xFF00000000000000), + }; +#endif /* PGSZ */ +#endif /* PSZ == 24 */ + #if PSZ == 32 #if PGSZ == 32 PixelGroup cfbstartpartial[] = @@ -559,6 +634,58 @@ PixelGroup cfbrmask[] = #endif /* PGSZ */ #endif /* PSZ == 16 */ +#if PSZ == 24 +#if PGSZ == 32 +PixelGroup cfbmask[] = + { + cfbBits(0xFFFFFF00), + cfbBits(0x00000000), + cfbBits(0x000000FF), + cfbBits(0xFFFF0000), + cfbBits(0x0000FFFF), + cfbBits(0xFF000000), + cfbBits(0x00FFFFFF), + cfbBits(0x00000000), + }; +PixelGroup cfbrmask[] = + { + cfbBits(0x000000FF), + cfbBits(0xFFFFFFFF), + cfbBits(0xFFFFFF00), + cfbBits(0x0000FFFF), + cfbBits(0xFFFF0000), + cfbBits(0x00FFFFFF), + cfbBits(0xFF000000), + cfbBits(0xFFFFFFFF), + }; +#else /* PGSZ == 64 */ +PixelGroup cfbmask[] = + { + cfbBits(0xFFFFFF0000000000), + cfbBits(0x000000FFFFFF0000), + cfbBits(0x000000000000FFFF), + }; +PixelGroup cfbmask2[] = + { + cfbBits(0x0000000000000000), + cfbBits(0x0000000000000000), + cfbBits(0xFF00000000000000), + }; +PixelGroup cfbrmask[] = + { + cfbBits(0x000000FFFFFFFFFF), + cfbBits(0xFFFFFF000000FFFF), + cfbBits(0xFFFFFFFFFFFF0000), + }; +PixelGroup cfbrmask2[] = + { + cfbBits(0x0000000000000000), + cfbBits(0x0000000000000000), + cfbBits(0x00FFFFFFFFFFFFFF), + }; +#endif /* PGSZ */ +#endif /* PSZ == 24 */ + #if PSZ == 32 #if PGSZ == 32 PixelGroup cfbmask[] = @@ -726,6 +853,30 @@ PixelGroup QuartetBitsTable[] = { }; #endif /* PSZ == 16 */ +#if PSZ == 24 +PixelGroup QuartetBitsTable[] = { +#if PGSZ == 32 +#if (BITMAP_BIT_ORDER == MSBFirst) + 0x00000000, /* 0 - 0 */ + 0x00000001, /* 1 - 1 */ +#else /* (BITMAP_BIT_ORDER == LSBFirst */ + 0x00000000, /* 0 - 0 */ + 0x00000001, /* 1 - 1 */ +#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ +#else /* PGSZ == 64 */ +#if (BITMAP_BIT_ORDER == MSBFirst) + 0x00000000, /* 0 - 00 */ + 0x00000002, /* 1 - 10 */ + 0x00000003, /* 2 - 11*/ +#else /* (BITMAP_BIT_ORDER == LSBFirst */ + 0x00000000, /* 0 - 00 */ + 0x00000001, /* 1 - 01 */ + 0x00000003, /* 2 - 11 */ +#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ +#endif /* PGSZ */ +}; +#endif /* PSZ == 24 */ + #if PSZ == 32 PixelGroup QuartetBitsTable[] = { #if PGSZ == 32 @@ -1195,6 +1346,34 @@ PixelGroup QuartetPixelMaskTable[] = { }; #endif /* PSZ == 16 */ +#if PSZ == 24 +PixelGroup QuartetPixelMaskTable[] = { +#if PGSZ == 32 +/* Four pixels consist three pixel groups....*/ + 0x00000000, 0x00FFFFFF, /*0x00000000, *//*0*/ +/* 0x00000000, 0x00000000, 0x00000000,*/ /*0*/ +/* 0x00FFFFFF, 0x00000000, 0x00000000,*/ /*1*/ +/* 0xFF000000, 0x0000FFFF, 0x00000000,*/ /*2*/ +/* 0xFFFFFFFF, 0x0000FFFF, 0x00000000,*/ /*3*/ +/* 0x00000000, 0xFFFF0000, 0x000000FF,*/ /*4*/ +/* 0x00FFFFFF, 0xFFFF0000, 0x000000FF,*/ /*5*/ +/* 0xFF000000, 0xFFFFFFFF, 0x000000FF,*/ /*6*/ +/* 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF,*/ /*7*/ +/* 0x00000000, 0x00000000, 0xFFFFFF00,*/ /*8*/ +/* 0x00FFFFFF, 0x00000000, 0xFFFFFF00,*/ /*9*/ +/* 0xFF000000, 0x0000FFFF, 0xFFFFFF00,*/ /*10*/ +/* 0xFFFFFFFF, 0x0000FFFF, 0xFFFFFF00,*/ /*11*/ +/* 0x00000000, 0xFFFF0000, 0xFFFFFFFF,*/ /*12*/ +/* 0x00FFFFFF, 0xFFFF0000, 0xFFFFFFFF,*/ /*13*/ +/* 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*14*/ +/* 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*15*/ +#else /* PGSZ == 64 */ + 0x0000000000000000, 0x0000000000FFFFFF, + 0x0000FFFFFF000000, 0xFFFFFFFFFFFFFFFF +#endif /* PGSZ */ +}; +#endif /* PSZ == 24 */ + #if PSZ == 32 PixelGroup QuartetPixelMaskTable[] = { #if PGSZ == 32 @@ -1208,3 +1387,12 @@ PixelGroup QuartetPixelMaskTable[] = { #endif /* PGSZ */ }; #endif /* PSZ == 32 */ + +#if PSZ == 24 +int cfb24Shift[] = +#if (BITMAP_BIT_ORDER == MSBFirst) +{8,0,16,16,8,24,0,0}; +#else /* (BITMAP_BIT_ORDER == LSBFirst) */ +{0,0,24,8,16,16,8,0}; +#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ +#endif diff --git a/cfb/cfbmskbits.h b/cfb/cfbmskbits.h index 7de664157..dac519001 100644 --- a/cfb/cfbmskbits.h +++ b/cfb/cfbmskbits.h @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.h,v 3.13 2001/10/28 03:33:01 tsi Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -33,6 +34,11 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "X.h" #include "Xmd.h" #include "servermd.h" +#if defined(XFREE86) || ( defined(__OpenBSD__) && defined(__alpha__) ) \ + || (defined(__bsdi__)) +#include "xf86_ansic.h" +#include "compiler.h" +#endif /* * ========================================================================== @@ -68,18 +74,18 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. * B is PGSZB. All the other values are derived from these * two. This table does not show all combinations! * - * name cfb8,4 cfb32,4 cfb8,8 cfb32,8 - * ---- ------ ------- ------ ------- - * PSZ 8 32 8 32 - * PGSZ 32 32 64 64 - * PGSZB 4 4 8 8 - * PGSZBMSK 0xF 0xF 0xFF 0xFF - * PPW 4 1 8 2 - * PPWMSK 0xF 0x1 0xFF 0x3 - * PLST 3 0 7 1 - * PIM 0x3 0x0 0x7 0x1 - * PWSH 2 0 3 1 - * PMSK 0xFF 0xFFFFFFFF 0xFF 0xFFFFFFFF + * name cfb8,4 cfb24,4 cfb32,4 cfb8,8 cfb24,8 cfb32,8 + * ---- ------ ------- ------ ------ ------ ------- + * PSZ 8 24 32 8 24 32 + * PGSZ 32 32 32 64 64 64 + * PGSZB 4 4 4 8 8 8 + * PGSZBMSK 0xF 0xF? 0xF 0xFF 0xFF 0xFF + * PPW 4 1 1 8 2 2 + * PPWMSK 0xF 0x1 0x1 0xFF 0x3? 0x3 + * PLST 3 0 0 7 1 1 + * PIM 0x3 0x0 0x0 0x7 0x1? 0x1 + * PWSH 2 0 0 3 1 1 + * PMSK 0xFF 0xFFFFFF 0xFFFFFFFF 0xFF 0xFFFFFF 0xFFFFFFFF * * * I have also added a new macro, PFILL, that takes one pixel and @@ -95,6 +101,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. * parameter to the putbits and putbitsrop macros that is the plane * mask. * ========================================================================== + * + * Keith Packard (keithp@suse.com) + * 64bit code is no longer supported; it requires DIX support + * for repadding images which significantly impacts performance */ /* @@ -102,22 +112,26 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. * -DPSZ=foo on the compilation command line. */ +#ifndef PSZ +#define PSZ 8 +#endif + /* * PixelGroup is the data type used to operate on groups of pixels. - * We typedef it here to unsigned long with the assumption that you - * want to manipulate as many pixels at a time as you can. If unsigned - * long is not appropriate for your server, define it to something else + * We typedef it here to CARD32 with the assumption that you + * want to manipulate 32 bits worth of pixels at a time as you can. If CARD32 + * is not appropriate for your server, define it to something else * before including this file. In this case you will also have to define * PGSZB to the size in bytes of PixelGroup. */ #ifndef PixelGroup -typedef unsigned long PixelGroup; -#ifdef LONG64 -#define PGSZB 8 -#else +#define PixelGroup CARD32 #define PGSZB 4 -#endif /* LONG64 */ #endif /* PixelGroup */ + +#ifndef CfbBits +#define CfbBits CARD32 +#endif #define PGSZ (PGSZB << 3) #define PPW (PGSZ/PSZ) @@ -171,6 +185,15 @@ typedef CARD8 PixelType; typedef CARD16 PixelType; #endif +#if PSZ == 24 +#undef PMSK +#define PMSK 0xFFFFFF +/*#undef PIM +#define PIM 3*/ +#define PIXEL_ADDR +typedef CARD32 PixelType; +#endif + #if PSZ == 32 #undef PMSK #define PMSK 0xFFFFFFFF @@ -385,6 +408,109 @@ getleftbits(psrc, w, dst) #if PSZ != 32 || PPW != 1 +# if (PSZ == 24 && PPW == 1) +#define maskbits(x, w, startmask, endmask, nlw) {\ + startmask = cfbstarttab[(x)&3]; \ + endmask = cfbendtab[((x)+(w)) & 3]; \ + nlw = ((((x)+(w))*3)>>2) - (((x)*3 +3)>>2); \ +} + +#define mask32bits(x, w, startmask, endmask) \ + startmask = cfbstarttab[(x)&3]; \ + endmask = cfbendtab[((x)+(w)) & 3]; + +#define maskpartialbits(x, w, mask) \ + mask = cfbstartpartial[(x) & 3] & cfbendpartial[((x)+(w)) & 3]; + +#define maskbits24(x, w, startmask, endmask, nlw) \ + startmask = cfbstarttab24[(x) & 3]; \ + endmask = cfbendtab24[((x)+(w)) & 3]; \ + if (startmask){ \ + nlw = (((w) - (4 - ((x) & 3))) >> 2); \ + } else { \ + nlw = (w) >> 2; \ + } + +#define getbits24(psrc, dst, index) {\ + register int idx; \ + switch(idx = ((index)&3)<<1){ \ + case 0: \ + dst = (*(psrc) &cfbmask[idx]); \ + break; \ + case 6: \ + dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]); \ + break; \ + default: \ + dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]) | \ + BitRight(((*((psrc)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ + }; \ +} + +#define putbits24(src, x, w, pdst, planemask, index) {\ + register PixelGroup dstpixel; \ + register unsigned int idx; \ + switch(idx = ((index)&3)<<1){ \ + case 0: \ + dstpixel = (*(pdst) &cfbmask[idx]); \ + break; \ + case 6: \ + dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \ + break; \ + default: \ + dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \ + BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ + }; \ + dstpixel &= ~(planemask); \ + dstpixel |= (src & planemask); \ + *(pdst) &= cfbrmask[idx]; \ + switch(idx){ \ + case 0: \ + *(pdst) |= (dstpixel & cfbmask[idx]); \ + break; \ + case 2: \ + case 4: \ + pdst++;idx++; \ + *(pdst) = ((*(pdst)) & cfbrmask[idx]) | \ + (BitLeft(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ + pdst--;idx--; \ + case 6: \ + *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ + break; \ + }; \ +} + +#define putbitsrop24(src, x, pdst, planemask, rop) \ +{ \ + register PixelGroup t1, dstpixel; \ + register unsigned int idx; \ + switch(idx = (x)<<1){ \ + case 0: \ + dstpixel = (*(pdst) &cfbmask[idx]); \ + break; \ + case 6: \ + dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \ + break; \ + default: \ + dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \ + BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ + }; \ + DoRop(t1, rop, (src), dstpixel); \ + dstpixel &= ~planemask; \ + dstpixel |= (t1 & planemask); \ + *(pdst) &= cfbrmask[idx]; \ + switch(idx){ \ + case 0: \ + *(pdst) |= (dstpixel & cfbmask[idx]); \ + break; \ + case 2: \ + case 4: \ + *((pdst)+1) = ((*((pdst)+1)) & cfbrmask[idx+1]) | \ + (BitLeft(dstpixel, cfb24Shift[idx+1]) & (cfbmask[idx+1])); \ + case 6: \ + *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ + }; \ +} +# else /* PSZ == 24 && PPW == 1 */ #define maskbits(x, w, startmask, endmask, nlw) \ startmask = cfbstarttab[(x)&PIM]; \ endmask = cfbendtab[((x)+(w)) & PIM]; \ @@ -400,6 +526,17 @@ getleftbits(psrc, w, dst) startmask = cfbstarttab[(x)&PIM]; \ endmask = cfbendtab[((x)+(w)) & PIM]; +/* FIXME */ +#define maskbits24(x, w, startmask, endmask, nlw) \ + abort() +#define getbits24(psrc, dst, index) \ + abort() +#define putbits24(src, x, w, pdst, planemask, index) \ + abort() +#define putbitsrop24(src, x, pdst, planemask, rop) \ + abort() + +#endif /* PSZ == 24 && PPW == 1 */ #define getbits(psrc, x, w, dst) \ if ( ((x) + (w)) <= PPW) \ @@ -425,8 +562,8 @@ if ( ((x)+(w)) <= PPW) \ } \ else \ { \ - unsigned long m; \ - unsigned long n; \ + unsigned int m; \ + unsigned int n; \ PixelGroup pm = PFILL(planemask); \ m = PPW-(x); \ n = (w) - m; \ @@ -484,8 +621,8 @@ if ( ((x)+(w)) <= PPW) \ } \ else \ { \ - unsigned long m; \ - unsigned long n; \ + CfbBits m; \ + CfbBits n; \ PixelGroup t1, t2; \ PixelGroup pm; \ PFILL2(planemask, pm); \ @@ -552,6 +689,15 @@ else \ */ /* useful only when not spanning destination longwords */ +#if PSZ == 24 +#define putbitsmropshort24(src,x,w,pdst,index) {\ + PixelGroup _tmpmask; \ + PixelGroup _t1; \ + maskpartialbits ((x), (w), _tmpmask); \ + _t1 = SCRRIGHT((src), (x)); \ + DoMaskMergeRop24(_t1, pdst, _tmpmask, index); \ +} +#endif #define putbitsmropshort(src,x,w,pdst) {\ PixelGroup _tmpmask; \ PixelGroup _t1; \ @@ -583,6 +729,22 @@ if ((x) + (w) <= PPW) {\ #if GETLEFTBITS_ALIGNMENT == 1 #define getleftbits(psrc, w, dst) dst = *((unsigned int *) psrc) +#define getleftbits24(psrc, w, dst, idx){ \ + regiseter int index; \ + switch(index = ((idx)&3)<<1){ \ + case 0: \ + dst = (*((unsigned int *) psrc))&cfbmask[index]; \ + break; \ + case 2: \ + case 4: \ + dst = BitLeft(((*((unsigned int *) psrc))&cfbmask[index]), cfb24Shift[index]); \ + dst |= BitRight(((*((unsigned int *) psrc)+1)&cfbmask[index]), cfb4Shift[index]); \ + break; \ + case 6: \ + dst = BitLeft((*((unsigned int *) psrc)),cfb24Shift[index]); \ + break; \ + }; \ +} #endif /* GETLEFTBITS_ALIGNMENT == 1 */ #define getglyphbits(psrc, x, w, dst) \ @@ -650,16 +812,76 @@ if ((x) + (w) <= PPW) {\ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ } +/* I just copied this to get the linker satisfied on PowerPC, + * so this may not be correct at all. + */ +#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \ +{ \ + PixelGroup q; \ + q = *(psrcstip) >> (xt); \ + q = ((ones) ? q : ~q) & 1; \ + *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ +} #else /* BITMAP_BIT_ORDER == LSB */ + +/* this must load 32 bits worth; for most machines, thats an int */ +#define CfbFetchUnaligned(x) ldl_u(x) + #define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \ { \ PixelGroup q; \ - q = *(psrcstip) >> (xt); \ + q = CfbFetchUnaligned(psrcstip) >> (xt); \ if ( ((xt)+(w)) > (PPW*PSZ) ) \ - q |= (*((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \ + q |= (CfbFetchUnaligned((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ } +#if PSZ == 24 +# if 0 +#define getstipplepixels24(psrcstip,xt,w,ones,psrcpix,destpix,stipindex,srcindex,dstindex) \ +{ \ + PixelGroup q; \ + CfbBits src; \ + register unsigned int sidx; \ + register unsigned int didx; \ + sidx = ((srcindex) & 3)<<1; \ + didx = ((dstindex) & 3)<<1; \ + q = *(psrcstip) >> (xt); \ +/* if((srcindex)!=0)*/ \ +/* src = (((*(psrcpix)) << cfb24Shift[sidx]) & (cfbmask[sidx])) |*/ \ +/* (((*((psrcpix)+1)) << cfb24Shift[sidx+1]) & (cfbmask[sidx+1])); */\ +/* else */\ + src = (*(psrcpix))&0xFFFFFF; \ + if ( ((xt)+(w)) > PGSZ ) \ + q |= (*((psrcstip)+1)) << (PGSZ -(xt)); \ + q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ + src &= QuartetPixelMaskTable[q]; \ + *(destpix) &= cfbrmask[didx]; \ + switch(didx) {\ + case 0: \ + *(destpix) |= (src &cfbmask[didx]); \ + break; \ + case 2: \ + case 4: \ + destpix++;didx++; \ + *(destpix) = ((*(destpix)) & (cfbrmask[didx]))| \ + (BitLeft(src, cfb24Shift[didx]) & (cfbmask[didx])); \ + destpix--; didx--;\ + case 6: \ + *(destpix) |= (BitRight(src, cfb24Shift[didx]) & cfbmask[didx]); \ + break; \ + }; \ +} +# else +#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \ +{ \ + PixelGroup q; \ + q = *(psrcstip) >> (xt); \ + q = ((ones) ? q : ~q) & 1; \ + *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ +} +# endif +#endif /* PSZ == 24 */ #endif extern PixelGroup cfbstarttab[]; @@ -670,3 +892,6 @@ extern PixelGroup cfbrmask[]; extern PixelGroup cfbmask[]; extern PixelGroup QuartetBitsTable[]; extern PixelGroup QuartetPixelMaskTable[]; +#if PSZ == 24 +extern int cfb24Shift[]; +#endif diff --git a/cfb/cfbpixmap.c b/cfb/cfbpixmap.c index 37cec5c7d..bd2e1b6f1 100644 --- a/cfb/cfbpixmap.c +++ b/cfb/cfbpixmap.c @@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/cfb/cfbpixmap.c,v 1.5 2001/12/14 19:59:23 dawes Exp $ */ /* pixmap management written by drewry, september 1986 @@ -59,7 +60,7 @@ SOFTWARE. #include "cfb.h" #include "cfbmskbits.h" -extern unsigned long endtab[]; +extern CfbBits endtab[]; PixmapPtr cfbCreatePixmap (pScreen, width, height, depth) @@ -146,9 +147,9 @@ cfbPadPixmap(pPixmap) { register int width = (pPixmap->drawable.width) * (pPixmap->drawable.bitsPerPixel); register int h; - register unsigned long mask; - register unsigned long *p; - register unsigned long bits; /* real pattern bits */ + register CfbBits mask; + register CfbBits *p; + register CfbBits bits; /* real pattern bits */ register int i; int rep; /* repeat count for pattern */ @@ -161,7 +162,7 @@ cfbPadPixmap(pPixmap) mask = endtab[width]; - p = (unsigned long *)(pPixmap->devPrivate.ptr); + p = (CfbBits *)(pPixmap->devPrivate.ptr); for (h=0; h < pPixmap->drawable.height; h++) { *p &= mask; @@ -230,8 +231,8 @@ cfbXRotatePixmap(pPix, rw) PixmapPtr pPix; register int rw; { - register unsigned long *pw, *pwFinal; - register unsigned long t; + register CfbBits *pw, *pwFinal; + register CfbBits t; int rot; if (pPix == NullPixmap) @@ -247,7 +248,7 @@ cfbXRotatePixmap(pPix, rw) ErrorF("cfbXRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel); return; } - pw = (unsigned long *)pPix->devPrivate.ptr; + pw = (CfbBits *)pPix->devPrivate.ptr; modulus (rw, (int) pPix->drawable.width, rot); if(pPix->drawable.width == PPW) { @@ -263,25 +264,25 @@ cfbXRotatePixmap(pPix, rw) { ErrorF("cfb internal error: trying to rotate odd-sized pixmap.\n"); #ifdef notdef - register unsigned long *pwTmp; + register CfbBits *pwTmp; int size, tsize; tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth); - pwTmp = (unsigned long *) ALLOCATE_LOCAL(pPix->drawable.height * tsize); + pwTmp = (CfbBits *) ALLOCATE_LOCAL(pPix->drawable.height * tsize); if (!pwTmp) return; /* divide pw (the pixmap) in two vertically at (w - rot) and swap */ tsize >>= 2; size = pPix->devKind >> SIZE0F(PixelGroup); - cfbQuickBlt((long *)pw, (long *)pwTmp, + cfbQuickBlt((CfbBits *)pw, (CfbBits *)pwTmp, 0, 0, 0, 0, (int)pPix->drawable.width - rot, (int)pPix->drawable.height, size, tsize); - cfbQuickBlt((long *)pw, (long *)pw, + cfbQuickBlt((CfbBits *)pw, (CfbBits *)pw, (int)pPix->drawable.width - rot, 0, 0, 0, rot, (int)pPix->drawable.height, size, size); - cfbQuickBlt((long *)pwTmp, (long *)pw, + cfbQuickBlt((CfbBits *)pwTmp, (CfbBits *)pw, 0, 0, rot, 0, (int)pPix->drawable.width - rot, (int)pPix->drawable.height, tsize, size); diff --git a/cfb/cfbply1rct.c b/cfb/cfbply1rct.c index b1e5c8ff1..e75708b96 100644 --- a/cfb/cfbply1rct.c +++ b/cfb/cfbply1rct.c @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/cfbply1rct.c,v 3.9 2001/12/14 19:59:24 dawes Exp $ */ #include "X.h" @@ -50,25 +51,32 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) { cfbPrivGCPtr devPriv; int nwidth; - unsigned long *addrl, *addr; + CfbBits *addrl, *addr; +#if PSZ == 24 + CfbBits startmask, endmask; + register int pidx; +#else +#if PPW > 1 + CfbBits mask, bits = ~((CfbBits)0); +#endif +#endif int maxy; int origin; register int vertex1, vertex2; - int c; + int c = 0; BoxPtr extents; int clip; int y; - int *vertex1p, *vertex2p; + int *vertex1p = NULL, *vertex2p; int *endp; - int x1, x2; - int dx1, dx2; - int dy1, dy2; - int e1, e2; - int step1, step2; - int sign1, sign2; + int x1 = 0, x2 = 0; + int dx1 = 0, dx2 = 0; + int dy1 = 0, dy2 = 0; + int e1 = 0, e2 = 0; + int step1 = 0, step2 = 0; + int sign1 = 0, sign2 = 0; int h; int l, r; - unsigned long mask, bits = ~((unsigned long)0); int nmiddle; RROP_DECLARE @@ -80,7 +88,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) devPriv = cfbGetGCPrivate(pGC); #ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) + if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) { miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); return; @@ -88,7 +96,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) #endif origin = *((int *) &pDrawable->x); vertex2 = origin - ((origin & 0x8000) << 1); - extents = &devPriv->pCompositeClip->extents; + extents = &pGC->pCompositeClip->extents; RROP_FETCH_GCPRIV(devPriv); vertex1 = *((int *) &extents->x1) - vertex2; vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001; @@ -167,9 +175,9 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) return; } -#define AddrYPlus(a,y) (unsigned long *) (((unsigned char *) (a)) + (y) * nwidth) +#define AddrYPlus(a,y) (CfbBits *) (((unsigned char *) (a)) + (y) * nwidth) - cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, unsigned long); + cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, CfbBits); addrl = AddrYPlus(addrl,y + pDrawable->y); origin = intToX(origin); vertex2p = vertex1p; @@ -178,7 +186,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) vertex2p = (int *) ptsIn; #define Setup(c,x,vertex,dx,dy,e,sign,step) {\ x = intToX(vertex); \ - if (dy = intToY(c) - y) { \ + if ((dy = intToY(c) - y)) { \ dx = intToX(c) - x; \ step = 0; \ if (dx >= 0) \ @@ -273,13 +281,40 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) #define LWRD_SHIFT 3 #endif /* PGSZ */ +#if PSZ == 24 + addr = (CfbBits *)((char *)addrl + ((l * 3) & ~0x03)); +#else /* PSZ == 24 */ #if PWSH > LWRD_SHIFT l = l >> (PWSH - LWRD_SHIFT); #endif #if PWSH < LWRD_SHIFT l = l << (LWRD_SHIFT - PWSH); #endif - addr = (unsigned long *) (((char *) addrl) + l); + addr = (CfbBits *) (((char *) addrl) + l); +#endif /* PSZ == 24 */ +#if PSZ == 24 + if (nmiddle <= 1){ + if (nmiddle) + RROP_SOLID24(addr, l); + } else { + maskbits(l, nmiddle, startmask, endmask, nmiddle); + pidx = l & 3; + if (startmask){ + RROP_SOLID_MASK(addr, startmask, pidx-1); + addr++; + if (pidx == 3) + pidx = 0; + } + while (--nmiddle >= 0){ + RROP_SOLID(addr, pidx); + addr++; + if (++pidx == 3) + pidx = 0; + } + if (endmask) + RROP_SOLID_MASK(addr, endmask, pidx); + } +#else /* PSZ == 24 */ #if PPW > 1 if (c + nmiddle < PPW) { @@ -301,10 +336,11 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) RROP_SOLID(addr); addr++; } #if PPW > 1 - if (mask = ~SCRRIGHT(bits, r & PIM)) + if ((mask = ~SCRRIGHT(bits, r & PIM))) RROP_SOLID_MASK(addr,mask); } #endif +#endif /* PSZ == 24 */ if (!--h) break; addrl = AddrYPlus (addrl, 1); diff --git a/cfb/cfbpntwin.c b/cfb/cfbpntwin.c index bf53cb3f9..d21544b37 100644 --- a/cfb/cfbpntwin.c +++ b/cfb/cfbpntwin.c @@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/cfb/cfbpntwin.c,v 3.7 2002/09/16 18:05:31 eich Exp $ */ #include "X.h" @@ -57,6 +58,11 @@ SOFTWARE. #include "cfbmskbits.h" #include "mi.h" +#ifdef PANORAMIX +#include "panoramiX.h" +#include "panoramiXsrv.h" +#endif + void cfbPaintWindow(pWin, pRegion, what) WindowPtr pWin; @@ -68,6 +74,7 @@ cfbPaintWindow(pWin, pRegion, what) pPrivWin = cfbGetWindowPrivate(pWin); + switch (what) { case PW_BACKGROUND: switch (pWin->backgroundState) { @@ -90,11 +97,22 @@ cfbPaintWindow(pWin, pRegion, what) } else { + int xorg = pWin->drawable.x; + int yorg = pWin->drawable.y; +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + int index = pWin->drawable.pScreen->myNum; + if(WindowTable[index] == pWin) { + xorg -= panoramiXdataPtr[index].x; + yorg -= panoramiXdataPtr[index].y; + } + } +#endif cfbFillBoxTileOdd ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pWin->background.pixmap, - (int) pWin->drawable.x, (int) pWin->drawable.y); + xorg, yorg); } break; case BackgroundPixel: @@ -122,16 +140,30 @@ cfbPaintWindow(pWin, pRegion, what) } else { + int xorg, yorg; + for (pBgWin = pWin; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); + xorg = pBgWin->drawable.x; + yorg = pBgWin->drawable.y; + +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + int index = pWin->drawable.pScreen->myNum; + if(WindowTable[index] == pBgWin) { + xorg -= panoramiXdataPtr[index].x; + yorg -= panoramiXdataPtr[index].y; + } + } +#endif + cfbFillBoxTileOdd ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pWin->border.pixmap, - (int) pBgWin->drawable.x, - (int) pBgWin->drawable.y); + xorg, yorg); } break; } @@ -191,15 +223,24 @@ cfbFillBoxSolid (pDrawable, nBox, pBox, pixel) BoxPtr pBox; unsigned long pixel; { - unsigned long *pdstBase; + CfbBits *pdstBase; int widthDst; register int h; - register unsigned long rrop_xor; - register unsigned long *pdst; - register unsigned long leftMask, rightMask; + register CfbBits rrop_xor; + register CfbBits *pdst; int nmiddle; - register int m; int w; +#if PSZ == 24 + int leftIndex, rightIndex; + CfbBits piQxelArray[3], *pdstULC; /*upper left corner*/ + + piQxelArray[0] = (pixel&0xFFFFFF) | ((pixel&0xFF)<<24); + piQxelArray[1] = ((pixel&0xFFFF00)>>8) | ((pixel&0xFFFF)<<16); + piQxelArray[2] = ((pixel&0xFFFFFF)<<8) | ((pixel&0xFF0000)>>16); +#else + register CfbBits leftMask, rightMask; + register int m; +#endif cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase); @@ -224,6 +265,168 @@ cfbFillBoxSolid (pDrawable, nBox, pBox, pixel) else { #endif +#if PSZ == 24 +/* _Box has x1, y1, x2, y2*/ + leftIndex = pBox->x1 & 3; + rightIndex = ((leftIndex+w)<5)?0:(pBox->x2 &3); + nmiddle = w - rightIndex; + if(leftIndex){ + nmiddle -= (4 - leftIndex); + } + nmiddle >>= 2; + if(nmiddle < 0) + nmiddle = 0; + + pdst = pdstBase + pBox->y1 * widthDst + ((pBox->x1*3) >> 2); + + switch(leftIndex+w){ + case 4: + switch(leftIndex){ + case 0: + while(h--){ + *pdst++ = piQxelArray[0]; + *pdst++ = piQxelArray[1]; + *pdst = piQxelArray[2]; + pdst -=2; + pdst += widthDst; + } + break; + case 1: + while(h--){ + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelArray[1]; + *pdst = piQxelArray[2]; + pdst -=2; + pdst += widthDst; + } + break; + case 2: + while(h--){ + *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); + pdst++; + *pdst-- = piQxelArray[2]; + pdst += widthDst; + } + break; + case 3: + while(h--){ + *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00); + pdst += widthDst; + } + break; + } + break; + case 3: + switch(leftIndex){ + case 0: + while(h--){ + *pdst++ = piQxelArray[0]; + *pdst++ = piQxelArray[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); + pdst--; + pdst--; + pdst += widthDst; + } + break; + case 1: + while(h--){ + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelArray[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); + pdst--; + pdst--; + pdst += widthDst; + } + break; + case 2: + while(h--){ + *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); + pdst++; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); + pdst--; + pdst += widthDst; + } + break; + } + break; + case 2: + while(h--){ + if(leftIndex){ + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); + pdst++; + } + else{ + *pdst++ = piQxelArray[0]; + } + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF); + pdst--; + pdst += widthDst; + } + break; + case 1: /*only if leftIndex = 0 and w = 1*/ + while(h--){ + *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF); + pdst += widthDst; + } + break; + case 0: /*never*/ + break; + default: + { + w = nmiddle; + pdstULC = pdst; +/* maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);*/ + while(h--){ + nmiddle = w; + pdst = pdstULC; + switch(leftIndex){ + case 0: + break; + case 1: + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelArray[1]; + *pdst++ = piQxelArray[2]; + break; + case 2: + *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); + pdst++; + *pdst++ = piQxelArray[2]; + break; + case 3: + *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00); + pdst++; + break; + } + while(nmiddle--){ + *pdst++ = piQxelArray[0]; + *pdst++ = piQxelArray[1]; + *pdst++ = piQxelArray[2]; + } + switch(rightIndex){ + case 0: + break; + case 1: + *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF); + break; + case 2: + *pdst++ = piQxelArray[0]; + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF); + break; + case 3: + *pdst++ = piQxelArray[0]; + *pdst++ = piQxelArray[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); + break; + } + pdstULC += widthDst; + } + + } + } +#else pdst += (pBox->x1 >> PWSH); if ((pBox->x1 & PIM) + w <= PPW) { @@ -267,6 +470,7 @@ cfbFillBoxSolid (pDrawable, nBox, pBox, pixel) } } } +#endif #if PSZ == 8 } #endif @@ -280,30 +484,219 @@ cfbFillBoxTile32 (pDrawable, nBox, pBox, tile) BoxPtr pBox; /* pointer to list of boxes to fill */ PixmapPtr tile; /* rotated, expanded tile */ { - register unsigned long rrop_xor; - register unsigned long *pdst; - register int m; - unsigned long *psrc; + register CfbBits *pdst; + CfbBits *psrc; int tileHeight; int widthDst; int w; int h; - register unsigned long leftMask; - register unsigned long rightMask; int nmiddle; int y; int srcy; - unsigned long *pdstBase; + CfbBits *pdstBase; +#if PSZ == 24 + int leftIndex, rightIndex; + CfbBits piQxelArray[3], *pdstULC; +#else + register CfbBits rrop_xor; + register CfbBits leftMask; + register CfbBits rightMask; + register int m; +#endif tileHeight = tile->drawable.height; - psrc = (unsigned long *)tile->devPrivate.ptr; + psrc = (CfbBits *)tile->devPrivate.ptr; cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase); while (nBox--) { +#if PSZ == 24 + w = pBox->x2 - pBox->x1; + h = pBox->y2 - pBox->y1; + y = pBox->y1; + leftIndex = pBox->x1 & 3; +/* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/ + rightIndex = pBox->x2 &3; + nmiddle = w - rightIndex; + if(leftIndex){ + nmiddle -= (4 - leftIndex); + } + nmiddle >>= 2; + if(nmiddle < 0) + nmiddle = 0; + + pdst = pdstBase + ((pBox->x1 *3)>> 2) + pBox->y1 * widthDst; + srcy = y % tileHeight; + +#define StepTile piQxelArray[0] = (psrc[srcy] & 0xFFFFFF) | ((psrc[srcy] & 0xFF)<<24); \ + piQxelArray[1] = (psrc[srcy] & 0xFFFF00) | ((psrc[srcy] & 0xFFFF)<<16); \ + piQxelArray[2] = ((psrc[srcy] & 0xFF0000)>>16) | \ + ((psrc[srcy] & 0xFFFFFF)<<8); \ + /*rrop_xor = psrc[srcy];*/ \ + ++srcy; \ + if (srcy == tileHeight) \ + srcy = 0; + + switch(leftIndex+w){ + case 4: + switch(leftIndex){ + case 0: + while(h--){ + StepTile + *pdst++ = piQxelArray[0]; + *pdst++ = piQxelArray[1]; + *pdst = piQxelArray[2]; + pdst-=2; + pdst += widthDst; + } + break; + case 1: + while(h--){ + StepTile + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelArray[1]; + *pdst = piQxelArray[2]; + pdst-=2; + pdst += widthDst; + } + break; + case 2: + while(h--){ + StepTile + *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); + pdst++; + *pdst-- = piQxelArray[2]; + pdst += widthDst; + } + break; + case 3: + while(h--){ + StepTile + *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00); + pdst += widthDst; + } + break; + } + break; + case 3: + switch(leftIndex){ + case 0: + while(h--){ + StepTile + *pdst++ = piQxelArray[0]; + *pdst++ = piQxelArray[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); + pdst--; + pdst--; + pdst += widthDst; + } + break; + case 1: + while(h--){ + StepTile + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelArray[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); + pdst--; + pdst--; + pdst += widthDst; + } + break; + case 2: + while(h--){ + StepTile + *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); + pdst++; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); + pdst--; + pdst += widthDst; + } + break; + } + break; + case 2: + while(h--){ + StepTile + if(leftIndex){ + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); + pdst++; + } + else{ + *pdst++ = piQxelArray[0]; + } + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF); + pdst--; + pdst += widthDst; + } + break; + case 1: /*only if leftIndex = 0 and w = 1*/ + while(h--){ + StepTile + *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF); + pdst += widthDst; + } + break; + case 0: /*never*/ + break; + default: + { + w = nmiddle; + pdstULC = pdst; + + while(h--){ + StepTile + nmiddle = w; + pdst = pdstULC; + switch(leftIndex){ + case 0: + break; + case 1: + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelArray[1]; + *pdst++ = piQxelArray[2]; + break; + case 2: + *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); + pdst++; + *pdst++ = piQxelArray[2]; + break; + case 3: + *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00); + pdst++; + break; + } + while(nmiddle--){ + *pdst++ = piQxelArray[0]; + *pdst++ = piQxelArray[1]; + *pdst++ = piQxelArray[2]; + } + switch(rightIndex){ + case 0: + break; + case 1: + *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF); + break; + case 2: + *pdst++ = piQxelArray[0]; + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF); + break; + case 3: + *pdst++ = piQxelArray[0]; + *pdst++ = piQxelArray[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); + break; + } + pdstULC += widthDst; + } + } + } +#else w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; y = pBox->y1; @@ -365,6 +758,7 @@ cfbFillBoxTile32 (pDrawable, nBox, pBox, tile) } } } +#endif pBox++; } } diff --git a/cfb/cfbpolypnt.c b/cfb/cfbpolypnt.c index bf2217fb1..d8b781397 100644 --- a/cfb/cfbpolypnt.c +++ b/cfb/cfbpolypnt.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbpolypnt.c,v 3.6 2001/12/14 19:59:24 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -58,6 +59,10 @@ in this Software without prior written authorization from The Open Group. } \ } +#if PSZ == 24 +# include "cfbrrop24.h" +#endif + void cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; @@ -68,24 +73,31 @@ cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) { register INT32 pt; register INT32 c1, c2; - register unsigned long ClipMask = 0x80008000; - register unsigned long xor; + register CARD32 ClipMask = 0x80008000; + register CfbBits xor; #ifdef PIXEL_ADDR register PixelType *addrp; register int npwidth; +#if PSZ != 24 PixelType *addrpt; +#endif #else - register unsigned long *addrl; + register CfbBits *addrl; register int nlwidth; register int xoffset; - unsigned long *addrlt; + CfbBits *addrlt; +#endif +#if PSZ == 24 + RROP_DECLARE + register int xtmp; + register PixelType *p; #endif register INT32 *ppt; RegionPtr cclip; int nbox; register int i; register BoxPtr pbox; - unsigned long and; + CfbBits and; int rop = pGC->alu; int off; cfbPrivGCPtr devPriv; @@ -95,7 +107,7 @@ cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) rop = devPriv->rop; if (rop == GXnoop) return; - cclip = devPriv->pCompositeClip; + cclip = pGC->pCompositeClip; xor = devPriv->xor; if ((mode == CoordModePrevious) && (npt > 1)) { @@ -109,13 +121,27 @@ cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) off -= (off & 0x8000) << 1; #ifdef PIXEL_ADDR cfbGetPixelWidthAndPointer(pDrawable, npwidth, addrp); +#if PSZ == 24 + addrp = addrp + pDrawable->y * npwidth; +#else addrp = addrp + pDrawable->y * npwidth + pDrawable->x; +#endif if (rop == GXcopy) { +#if PSZ == 24 + RROP_COPY_SETUP(xor) +#endif if (!(npwidth & (npwidth - 1))) { npwidth = ffs(npwidth) - 1; +#if PSZ == 24 + PointLoop( + xtmp = pDrawable->x + intToX(pt); + p = addrp + (intToY(pt) << npwidth) + ((xtmp * 3) >>2); + RROP_SOLID24_COPY(p, xtmp)) +#else PointLoop(*(addrp + (intToY(pt) << npwidth) + intToX(pt)) = xor;) +#endif } #ifdef sun else if (npwidth == 1152) @@ -126,25 +152,49 @@ cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) #endif else { +#if PSZ == 24 + PointLoop( + xtmp = pDrawable->x + intToX(pt); + p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2); + RROP_SOLID24_COPY(p, xtmp)) +#else PointLoop(*(addrp + intToY(pt) * npwidth + intToX(pt)) = xor;) +#endif } } else { and = devPriv->and; +#if PSZ == 24 + RROP_SET_SETUP(xor, and) + PointLoop( + xtmp = pDrawable->x + intToX(pt); + p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2); + RROP_SOLID24_SET(p, xtmp)) +#else PointLoop( addrpt = addrp + intToY(pt) * npwidth + intToX(pt); *addrpt = DoRRop (*addrpt, and, xor);) +#endif } #else /* !PIXEL_ADDR */ cfbGetLongWidthAndPointer(pDrawable, nlwidth, addrl); addrl = addrl + pDrawable->y * nlwidth + (pDrawable->x >> PWSH); xoffset = pDrawable->x & PIM; and = devPriv->and; +#if PSZ == 24 PointLoop( addrlt = addrl + intToY(pt) * nlwidth + ((intToX(pt) + xoffset) >> PWSH); *addrlt = DoRRop (*addrlt, and | ~cfbmask[(intToX(pt) + xoffset) & PIM], xor & cfbmask[(intToX(pt) + xoffset) & PIM]); ) +#else + PointLoop( addrlt = addrl + intToY(pt) * nlwidth + + ((intToX(pt) + xoffset) >> PWSH); + *addrlt = DoRRop (*addrlt, + and | ~cfbmask[((intToX(pt) + xoffset) & 3)<<1], + xor & cfbmask[((intToX(pt) + xoffset) & 3)<<1]); + ) +#endif #endif /* PIXEL_ADDR */ } diff --git a/cfb/cfbpush8.c b/cfb/cfbpush8.c index 850de518d..0de172f03 100644 --- a/cfb/cfbpush8.c +++ b/cfb/cfbpush8.c @@ -2,6 +2,8 @@ * Push Pixels for 8 bit displays. */ +/* $XFree86: xc/programs/Xserver/cfb/cfbpush8.c,v 1.6 2001/12/14 19:59:24 dawes Exp $ */ + /* Copyright 1989, 1998 The Open Group @@ -51,17 +53,17 @@ cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg) DrawablePtr pDrawable; int dx, dy, xOrg, yOrg; { - register unsigned long *src, *dst; - register unsigned long pixel; - register unsigned long c, bits; - unsigned long *pdstLine, *psrcLine; - unsigned long *pdstBase; + register CfbBits *src, *dst; + register CfbBits pixel; + register CfbBits c, bits; + CfbBits *pdstLine, *psrcLine; + CfbBits *pdstBase; int srcWidth; int dstWidth; int xoff; int nBitmapLongs, nPixmapLongs; int nBitmapTmp, nPixmapTmp; - unsigned long rightMask; + CfbBits rightMask; BoxRec bbox; cfbPrivGCPtr devPriv; @@ -71,7 +73,7 @@ cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg) bbox.y2 = bbox.y1 + dy; devPriv = cfbGetGCPrivate(pGC); - switch (RECT_IN_REGION(pGC->pScreen, devPriv->pCompositeClip, &bbox)) + switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) { case rgnPART: #ifndef LOWMEMFTPT @@ -85,7 +87,7 @@ cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg) cfbGetLongWidthAndPointer (pDrawable, dstWidth, pdstBase) - psrcLine = (unsigned long *) pBitmap->devPrivate.ptr; + psrcLine = (CfbBits *) pBitmap->devPrivate.ptr; srcWidth = (int) pBitmap->devKind >> PWSH; pixel = devPriv->xor; diff --git a/cfb/cfbrctstp8.c b/cfb/cfbrctstp8.c index 9b9db7462..7f6e93919 100644 --- a/cfb/cfbrctstp8.c +++ b/cfb/cfbrctstp8.c @@ -1,6 +1,7 @@ /* * Fill 32 bit stippled rectangles for 8 bit frame buffers */ +/* $XFree86: xc/programs/Xserver/cfb/cfbrctstp8.c,v 3.6 2001/12/14 19:59:24 dawes Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -56,36 +57,34 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) int nBox; /* number of boxes to fill */ register BoxPtr pBox; /* pointer to list of boxes to fill */ { - unsigned long *src; + CfbBits *src; int stippleHeight; int nlwDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ register int h; /* height of current box */ - unsigned long startmask; - unsigned long endmask; /* masks for reggedy bits at either end of line */ + CfbBits startmask; + CfbBits endmask; /* masks for reggedy bits at either end of line */ int nlwMiddle; /* number of longwords between sides of boxes */ register int nlw; /* loop version of nlwMiddle */ - unsigned long *dstLine; - register unsigned long *dst; /* pointer to bits we're writing */ - unsigned long *dstTmp; + CfbBits *dstLine; + register CfbBits *dst; /* pointer to bits we're writing */ + CfbBits *dstTmp; int y; /* current scan line */ - unsigned long *pbits;/* pointer to start of pixmap */ - register unsigned long bits; /* bits from stipple */ - int rot, lastStop, i; - register unsigned long xor, and; - cfbPrivGCPtr devPriv; + CfbBits *pbits;/* pointer to start of pixmap */ + register CfbBits bits; /* bits from stipple */ + int rot; + register CfbBits xor; PixmapPtr stipple; int wEnd; - devPriv = cfbGetGCPrivate(pGC); - stipple = devPriv->pRotatedPixmap; + stipple = pGC->pRotatedPixmap; cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); stippleHeight = stipple->drawable.height; - src = (unsigned long *)stipple->devPrivate.ptr; + src = (CfbBits *)stipple->devPrivate.ptr; cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) @@ -108,6 +107,7 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) rot = (pBox->x1 & ((PGSZ-1) & ~PIM)); pBox++; y = y % stippleHeight; +#if PPW == 4 if (cfb8StippleRRop == GXcopy) { if (w < PGSZ*2) @@ -124,8 +124,8 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) dstLine += nlwDst; if (startmask) { - *dst = *dst & ~startmask | - GetPixelGroup (bits) & startmask; + *dst = (*dst & ~startmask) | + (GetPixelGroup (bits) & startmask); dst++; RotBitsLeft (bits, PGSZB); } @@ -137,8 +137,8 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) } if (endmask) { - *dst = *dst & ~endmask | - GetPixelGroup (bits) & endmask; + *dst = (*dst & ~endmask) | + (GetPixelGroup (bits) & endmask); } } } @@ -158,8 +158,8 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) dstLine += nlwDst; if (startmask) { - *dstTmp = *dstTmp & ~startmask | - GetPixelGroup (bits) & startmask; + *dstTmp = (*dstTmp & ~startmask) | + (GetPixelGroup (bits) & startmask); dstTmp++; RotBitsLeft (bits, PGSZB); } @@ -183,7 +183,7 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) { dst = dstTmp + (nlwMiddle << 3); *dst = (*dst & ~endmask) | - GetPixelGroup (bits) & endmask; + (GetPixelGroup(bits) & endmask); } while (w--) { @@ -203,6 +203,7 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) } } else +#endif /* PPW == 4 */ { while (h--) { @@ -246,13 +247,13 @@ cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox) BoxPtr pBox; /* pointer to list of boxes to fill */ { int x, y, w, h; - int nlwMiddle, nlwDst, nlwTmp; - unsigned long startmask, endmask; - register unsigned long *dst; - unsigned long *dstLine, *pbits, *dstTmp; - unsigned long *src; - register unsigned long xor; - register unsigned long bits, mask; + int nlwMiddle, nlwDst; + CfbBits startmask, endmask; + register CfbBits *dst; + CfbBits *dstLine, *pbits, *dstTmp; + CfbBits *src; + register CfbBits xor; + register CfbBits bits, mask; int rot; int wEnd; cfbPrivGCPtr devPriv; @@ -261,8 +262,8 @@ cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox) register int nlw; devPriv = cfbGetGCPrivate(pGC); - stipple = devPriv->pRotatedPixmap; - src = (unsigned long *)stipple->devPrivate.ptr; + stipple = pGC->pRotatedPixmap; + src = (CfbBits *)stipple->devPrivate.ptr; stippleHeight = stipple->drawable.height; cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); @@ -289,6 +290,7 @@ cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox) h = pBox->y2 - y; pBox++; y %= stippleHeight; +#if PPW == 4 if (cfb8StippleRRop == GXcopy) { xor = devPriv->xor; @@ -418,6 +420,7 @@ cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox) } } else +#endif /* PPW == 4 */ { while (h--) { @@ -461,8 +464,8 @@ cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox) int nBox; register BoxPtr pBox; { - unsigned long *pdstBase; /* pointer to start of bitmap */ - unsigned long *pdstLine; /* current destination line */ + CfbBits *pdstBase; /* pointer to start of bitmap */ + CfbBits *pdstLine; /* current destination line */ int nlwDst; /* width in longwords of bitmap */ PixmapPtr pStipple; /* pointer to stipple we want to fill with */ int nlwMiddle; @@ -470,14 +473,14 @@ cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox) int x, y, w, h, xrem, xSrc, ySrc; int stwidth, stippleWidth; int stippleHeight; - register unsigned long bits, inputBits; + register CfbBits bits, inputBits; register int partBitsLeft; int nextPartBits; int bitsLeft, bitsWhole; - register unsigned long *pdst; /* pointer to current word in bitmap */ - unsigned long *srcTemp, *srcStart; - unsigned long *psrcBase; - unsigned long startmask, endmask; + register CfbBits *pdst; /* pointer to current word in bitmap */ + CfbBits *srcTemp, *srcStart; + CfbBits *psrcBase; + CfbBits startmask, endmask; if (pGC->fillStyle == FillStippled) cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); @@ -502,7 +505,7 @@ cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox) stwidth = pStipple->devKind >> PWSH; stippleWidth = pStipple->drawable.width; stippleHeight = pStipple->drawable.height; - psrcBase = (unsigned long *) pStipple->devPrivate.ptr; + psrcBase = (CfbBits *) pStipple->devPrivate.ptr; /* * The Target: diff --git a/cfb/cfbrrop.c b/cfb/cfbrrop.c index 69ec0278d..1ee6771e0 100644 --- a/cfb/cfbrrop.c +++ b/cfb/cfbrrop.c @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/cfbrrop.c,v 1.6 2001/12/14 19:59:24 dawes Exp $ */ /* cfb reduced rasterop computations */ @@ -123,10 +124,10 @@ in this Software without prior written authorization from The Open Group. int cfbReduceRasterOp (rop, fg, pm, andp, xorp) int rop; - unsigned long fg, pm; - unsigned long *andp, *xorp; + CfbBits fg, pm; + CfbBits *andp, *xorp; { - unsigned long and, xor; + CfbBits and, xor; int rrop; fg = PFILL (fg); @@ -197,6 +198,9 @@ cfbReduceRasterOp (rop, fg, pm, andp, xorp) and = 0; xor = ~0; break; + default: + and = xor = 0; + break; } and |= ~pm; xor &= pm; diff --git a/cfb/cfbrrop.h b/cfb/cfbrrop.h index 4423e040d..d6f095e6b 100644 --- a/cfb/cfbrrop.h +++ b/cfb/cfbrrop.h @@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/cfbrrop.h,v 3.10 2001/12/14 19:59:24 dawes Exp $ */ + #ifndef GXcopy #include "X.h" #endif @@ -38,34 +40,162 @@ in this Software without prior written authorization from The Open Group. #endif #if RROP == GXcopy -#define RROP_DECLARE register unsigned long rrop_xor; +#if PSZ == 24 +#define RROP_DECLARE register CfbBits rrop_xor; \ + CfbBits piQxelXor[3], spiQxelXor[8]; +#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \ + spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ + spiQxelXor[2] = rrop_xor << 24; \ + spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \ + spiQxelXor[4] = rrop_xor << 16; \ + spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ + spiQxelXor[6] = rrop_xor << 8; \ + spiQxelXor[1] = spiQxelXor[7] = 0; \ + piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ + piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ + piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); +#define RROP_SOLID24(dst,index) {\ + register int idx = ((index) & 3)<< 1; \ + *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \ + if (idx == 2 || idx == 4){ \ + idx++; \ + *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \ + } \ + } +#define RROP_SOLID(dst, idx) \ + (*(dst) = piQxelXor[(idx)]) +#define RROP_SOLID_MASK(dst,mask,idx) \ + (*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask))) +#else #define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; +#define RROP_DECLARE register CfbBits rrop_xor; #define RROP_SOLID(dst) (*(dst) = (rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask))) +#endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy) #endif /* GXcopy */ #if RROP == GXxor -#define RROP_DECLARE register unsigned long rrop_xor; +#if PSZ == 24 +#define RROP_DECLARE register CfbBits rrop_xor; \ + CfbBits piQxelXor[3], spiQxelXor[8]; +#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \ + spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ + spiQxelXor[2] = rrop_xor << 24; \ + spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \ + spiQxelXor[4] = rrop_xor << 16; \ + spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ + spiQxelXor[6] = rrop_xor << 8; \ + spiQxelXor[1] = spiQxelXor[7] = 0; \ + piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ + piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ + piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); +#define RROP_SOLID24(dst,index) {\ + register int idx = ((index) & 3)<< 1; \ + *(dst) ^= spiQxelXor[idx]; \ + if (idx == 2 || idx == 4) \ + *((dst)+1) ^= spiQxelXor[idx+1]; \ + } +#define RROP_SOLID(dst,idx) \ + (*(dst) ^= piQxelXor[(idx)]) +#define RROP_SOLID_MASK(dst,mask,idx) \ + (*(dst) ^= (piQxelXor[(idx)] & (mask))) +#else +#define RROP_DECLARE register CfbBits rrop_xor; #define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; #define RROP_SOLID(dst) (*(dst) ^= (rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask))) +#endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor) #endif /* GXxor */ #if RROP == GXand -#define RROP_DECLARE register unsigned long rrop_and; +#if PSZ == 24 +#define RROP_DECLARE register CfbBits rrop_and; \ + CfbBits piQxelAnd[3], spiQxelAnd[6]; +#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ + spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \ + spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \ + spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \ + spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \ + spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \ + spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \ + piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \ + piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \ + piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); +#define RROP_SOLID24(dst,index) {\ + switch((index) & 3){ \ + case 0: \ + *(dst) &= spiQxelAnd[0]; \ + break; \ + case 3: \ + *(dst) &= spiQxelAnd[1]; \ + break; \ + case 1: \ + *(dst) &= spiQxelAnd[2]; \ + *((dst)+1) &= spiQxelAnd[3]; \ + break; \ + case 2: \ + *(dst) &= spiQxelAnd[4]; \ + *((dst)+1) &= spiQxelAnd[5]; \ + break; \ + } \ + } +#define RROP_SOLID(dst,idx) \ + (*(dst) &= piQxelAnd[(idx)]) +#define RROP_SOLID_MASK(dst,mask,idx) \ + (*(dst) &= (piQxelAnd[(idx)] | ~(mask))) +#else +#define RROP_DECLARE register CfbBits rrop_and; #define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; #define RROP_SOLID(dst) (*(dst) &= (rrop_and)) #define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask))) +#endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And) #endif /* GXand */ #if RROP == GXor -#define RROP_DECLARE register unsigned long rrop_or; +#if PSZ == 24 +#define RROP_DECLARE register CfbBits rrop_or; \ + CfbBits piQxelOr[3], spiQxelOr[6]; +#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \ + spiQxelOr[0] = rrop_or & 0xFFFFFF; \ + spiQxelOr[1] = rrop_or << 24; \ + spiQxelOr[2] = rrop_or << 16; \ + spiQxelOr[3] = rrop_or << 8; \ + spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \ + spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \ + piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \ + piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \ + piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16); +#define RROP_SOLID24(dst,index) {\ + switch((index) & 3){ \ + case 0: \ + *(dst) |= spiQxelOr[0]; \ + break; \ + case 3: \ + *(dst) |= spiQxelOr[3]; \ + break; \ + case 1: \ + *(dst) |= spiQxelOr[1]; \ + *((dst)+1) |= spiQxelOr[4]; \ + break; \ + case 2: \ + *(dst) |= spiQxelOr[2]; \ + *((dst)+1) |= spiQxelOr[5]; \ + break; \ + } \ + } +#define RROP_SOLID(dst,idx) \ + (*(dst) |= piQxelOr[(idx)]) +#define RROP_SOLID_MASK(dst,mask,idx) \ + (*(dst) |= (piQxelOr[(idx)] & (mask))) +#else +#define RROP_DECLARE register CfbBits rrop_or; #define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; #define RROP_SOLID(dst) (*(dst) |= (rrop_or)) #define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask))) +#endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or) #endif /* GXor */ @@ -78,11 +208,58 @@ in this Software without prior written authorization from The Open Group. #endif /* GXnoop */ #if RROP == GXset -#define RROP_DECLARE register unsigned long rrop_and, rrop_xor; +#if PSZ == 24 +#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; \ + CfbBits piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6]; +#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ + rrop_xor = (devPriv)->xor; \ + spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ + spiQxelXor[1] = rrop_xor << 24; \ + spiQxelXor[2] = rrop_xor << 16; \ + spiQxelXor[3] = rrop_xor << 8; \ + spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \ + spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ + spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \ + spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \ + spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \ + spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \ + spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \ + spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \ + piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \ + piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \ + piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \ + piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ + piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ + piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); +#define RROP_SOLID24(dst,index) {\ + switch((index) & 3){ \ + case 0: \ + *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \ + break; \ + case 3: \ + *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \ + break; \ + case 1: \ + *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \ + *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \ + break; \ + case 2: \ + *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \ + *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \ + break; \ + } \ + } +#define RROP_SOLID(dst,idx) \ + (*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)])) +#define RROP_SOLID_MASK(dst,mask,idx) \ + (*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask))) +#else +#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; #define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ rrop_xor = (devPriv)->xor; #define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask))) +#endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General) #endif /* GXset */ @@ -126,24 +303,24 @@ in this Software without prior written authorization from The Open Group. #define RROP_SPAN(pdst,nmiddle) {\ int part = (nmiddle) & RROP_UNROLL_MASK; \ (nmiddle) >>= RROP_UNROLL_SHIFT; \ - (pdst) += part * (sizeof (unsigned long) / sizeof (*pdst)); \ + (pdst) += part * (sizeof (CfbBits) / sizeof (*pdst)); \ switch (part) {\ - RROP_UNROLL_CASE((unsigned long *) (pdst)) \ + RROP_UNROLL_CASE((CfbBits *) (pdst)) \ } \ while (--(nmiddle) >= 0) { \ - (pdst) += RROP_UNROLL * (sizeof (unsigned long) / sizeof (*pdst)); \ - RROP_UNROLL_LOOP((unsigned long *) (pdst)) \ + (pdst) += RROP_UNROLL * (sizeof (CfbBits) / sizeof (*pdst)); \ + RROP_UNROLL_LOOP((CfbBits *) (pdst)) \ } \ } #else #define RROP_SPAN(pdst,nmiddle) \ while (--(nmiddle) >= 0) { \ - RROP_SOLID((unsigned long *) (pdst)); \ - (pdst) += sizeof (unsigned long) / sizeof (*pdst); \ + RROP_SOLID((CfbBits *) (pdst)); \ + (pdst) += sizeof (CfbBits) / sizeof (*pdst); \ } #endif -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define RROP_NAME_CAT(prefix,suffix) prefix##suffix #else #define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix diff --git a/cfb/cfbscrinit.c b/cfb/cfbscrinit.c index ad8bee4f5..dae88ff5c 100644 --- a/cfb/cfbscrinit.c +++ b/cfb/cfbscrinit.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbscrinit.c,v 1.19 2001/01/17 22:36:36 dawes Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -43,13 +44,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "cfbmskbits.h" #include "mibstore.h" - -miBSFuncRec cfbBSFuncRec = { +BSFuncRec cfbBSFuncRec = { cfbSaveAreas, cfbRestoreAreas, - (void (*)()) 0, - (PixmapPtr (*)()) 0, - (PixmapPtr (*)()) 0, + (BackingStoreSetClipmaskRgnProcPtr) 0, + (BackingStoreGetImagePixmapProcPtr) 0, + (BackingStoreGetSpansPixmapProcPtr) 0, }; Bool @@ -80,9 +80,6 @@ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width) int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ { - int i; - extern RegionPtr (*cfbPuntCopyPlane)(); - if (!cfbAllocatePrivates(pScreen, (int *) 0, (int *) 0)) return FALSE; pScreen->defColormap = FakeClientID(0); @@ -108,12 +105,10 @@ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width) pScreen->CreateGC = cfbCreateGC; pScreen->CreateColormap = cfbInitializeColormap; pScreen->DestroyColormap = (void (*)())NoopDDA; -#ifdef STATIC_COLOR pScreen->InstallColormap = cfbInstallColormap; pScreen->UninstallColormap = cfbUninstallColormap; pScreen->ListInstalledColormaps = cfbListInstalledColormaps; pScreen->StoreColors = (void (*)())NoopDDA; -#endif pScreen->ResolveColor = cfbResolveColor; pScreen->BitmapToRegion = mfbPixmapToRegion; @@ -137,6 +132,7 @@ cfbCreateScreenResources(pScreen) } #endif +Bool cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) register ScreenPtr pScreen; pointer pbits; /* pointer to screen bitmap */ @@ -144,7 +140,6 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ { - int i, j; #ifdef CFB_NEED_SCREEN_PRIVATE pointer oldDevPrivate; #endif @@ -164,19 +159,18 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) #endif if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth, ndepths, depths, - defaultVisual, nvisuals, visuals, - (miBSFuncPtr) 0)) + defaultVisual, nvisuals, visuals)) return FALSE; /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = cfbCloseScreen; - /* init backing store here so we can overwrite CloseScreen without stepping - * on the backing store wrapped version */ - miInitializeBackingStore (pScreen, &cfbBSFuncRec); #ifdef CFB_NEED_SCREEN_PRIVATE pScreen->CreateScreenResources = cfbCreateScreenResources; pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate; pScreen->devPrivate = oldDevPrivate; #endif + pScreen->BackingStoreFuncs = cfbBSFuncRec; + pScreen->GetScreenPixmap = cfbGetScreenPixmap; + pScreen->SetScreenPixmap = cfbSetScreenPixmap; return TRUE; } @@ -193,3 +187,28 @@ cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) return FALSE; return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width); } + +PixmapPtr +cfbGetScreenPixmap(pScreen) + ScreenPtr pScreen; +{ +#ifdef CFB_NEED_SCREEN_PRIVATE + return (PixmapPtr)pScreen->devPrivates[cfbScreenPrivateIndex].ptr; +#else + return (PixmapPtr)pScreen->devPrivate; +#endif +} + +void +cfbSetScreenPixmap(pPix) + PixmapPtr pPix; +{ +#ifdef CFB_NEED_SCREEN_PRIVATE + if (pPix) + pPix->drawable.pScreen->devPrivates[cfbScreenPrivateIndex].ptr = + (pointer)pPix; +#else + if (pPix) + pPix->drawable.pScreen->devPrivate = (pointer)pPix; +#endif +} diff --git a/cfb/cfbsetsp.c b/cfb/cfbsetsp.c index 4a3d2fbfe..2096d4e34 100644 --- a/cfb/cfbsetsp.c +++ b/cfb/cfbsetsp.c @@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/cfb/cfbsetsp.c,v 3.5 2001/12/14 19:59:24 dawes Exp $ */ #include "X.h" #include "Xmd.h" @@ -67,6 +68,7 @@ SOFTWARE. * boxes, we may not want to start grabbing bits at psrc but at some offset * further on.) */ +void cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemask) int y; int xOrigin; /* where this scanline starts */ @@ -83,19 +85,46 @@ cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemas register int tmpSrc; /* scratch buffer to collect bits in */ int dstBit; /* offset in bits from beginning of * word */ + int offSrc; + int nl; +#if PSZ == 24 + register char *psrcb, *pdstb; + register int xIndex; +#else register int nstart; /* number of bits from first partial */ register int nend; /* " " last partial word */ - int offSrc; - int startmask, endmask, nlMiddle, nl; + int startmask, endmask, nlMiddle; +#endif DeclareMergeRop() InitializeMergeRop(alu,planemask); +#if PSZ == 24 + pdst = pdstBase + (y * widthDst); + xIndex = xStart; + pdstb = (char *)pdst + (xStart * 3); + offSrc = xStart - xOrigin; + psrcb = (char *)psrc + (offSrc * 3); +#else pdst = pdstBase + (y * widthDst) + (xStart >> PWSH); psrc += (xStart - xOrigin) >> PWSH; offSrc = (xStart - xOrigin) & PIM; +#endif w = xEnd - xStart; dstBit = xStart & PIM; +#if PSZ == 24 + nl = w; + while (nl--){ + psrc = (unsigned int *)((unsigned long)psrcb & ~0x03); + getbits24(psrc, tmpSrc, offSrc); + pdst = (int *)((unsigned long)pdstb & ~0x03); + DoMergeRop24(tmpSrc, pdst, xIndex); + offSrc++; + psrcb += 3; + xIndex++; + pdstb += 3; + } +#else /* PSZ == 24 */ if (dstBit + w <= PPW) { maskpartialbits(dstBit, w, startmask); @@ -139,6 +168,7 @@ cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemas getbits(psrc, offSrc, nend, tmpSrc); putbitsmropshort(tmpSrc, 0, nend, pdst); } +#endif /* PSZ == 24 */ } @@ -160,7 +190,7 @@ cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted) int fSorted; { unsigned int *psrc = (unsigned int *)pcharsrc; - unsigned long *pdstBase; /* start of dst bitmap */ + CfbBits *pdstBase; /* start of dst bitmap */ int widthDst; /* width of bitmap in words */ register BoxPtr pbox, pboxLast, pboxTest; register DDXPointPtr pptLast; diff --git a/cfb/cfbsolid.c b/cfb/cfbsolid.c index ead63a757..6d8a95692 100644 --- a/cfb/cfbsolid.c +++ b/cfb/cfbsolid.c @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/cfbsolid.c,v 3.8 2002/09/16 18:05:31 eich Exp $ */ #include "X.h" @@ -117,17 +118,18 @@ RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox) BoxPtr pBox; { register int m; - register unsigned long *pdst; + register CfbBits *pdst; RROP_DECLARE - register unsigned long leftMask, rightMask; - unsigned long *pdstBase, *pdstRect; + CfbBits *pdstBase, *pdstRect; int nmiddle; int h; int w; int widthDst; - cfbPrivGCPtr devPriv; - - devPriv = cfbGetGCPrivate(pGC); +#if PSZ == 24 + int leftIndex, rightIndex; +#else + register CfbBits leftMask, rightMask; +#endif cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) @@ -153,6 +155,577 @@ RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox) else { #endif +#if PSZ == 24 + leftIndex = pBox->x1 &3; +/* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/ + rightIndex = pBox->x2 &3; + + nmiddle = w - rightIndex; + if(leftIndex){ + nmiddle -= (4 - leftIndex); + } + nmiddle >>= 2; + if(nmiddle < 0) + nmiddle = 0; + + pdstRect += (pBox->x1 * 3) >> 2; + pdst = pdstRect; + switch(leftIndex+w){ + case 4: + switch(leftIndex){ + case 0: + while(h--){ +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst++ = piQxelXor[1]; + *pdst-- = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= piQxelXor[1]; + *pdst-- ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= piQxelAnd[1]; + *pdst-- &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= piQxelOr[1]; + *pdst-- |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst--; +#endif + pdst--; + pdst += widthDst; + } + break; + case 1: + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelXor[1]; + *pdst-- = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFF000000); + *pdst++ ^= piQxelXor[1]; + *pdst-- ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); + *pdst++ &= piQxelAnd[1]; + *pdst-- &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFF000000); + *pdst++ |= piQxelOr[1]; + *pdst-- |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst--; +#endif + pdst--; + pdst += widthDst; + } + break; + case 2: + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + pdst++; + *pdst-- = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); + *pdst-- ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[1] | 0xFFFF); + *pdst-- &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[1] & 0xFFFF0000); + *pdst-- |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst--; +#endif + pdst += widthDst; + } + break; + case 3: + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); +#endif +#if RROP == GXxor + *pdst ^= (piQxelXor[2] & 0xFFFFFF00); +#endif +#if RROP == GXand + *pdst &= (piQxelAnd[2] | 0xFF); +#endif +#if RROP == GXor + *pdst |= (piQxelOr[2] & 0xFFFFFF00); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); +#endif + pdst += widthDst; + } + break; + } + break; + case 3: + switch(leftIndex){ + case 0: + while(h--){ +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst++ = piQxelXor[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= piQxelXor[1]; + *pdst-- ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= piQxelAnd[1]; + *pdst-- &= (piQxeAnd[2] | 0xFFFFFF00); +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= piQxelOr[1]; + *pdst-- |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst--; +#endif + pdst--; + pdst += widthDst; + } + break; + case 1: + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelXor[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFF000000); + *pdst++ ^= piQxelXor[1]; + *pdst-- ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); + *pdst++ &= piQxelAnd[1]; + *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFF000000); + *pdst++ |= piQxelOr[1]; + *pdst-- |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst--; +#endif + pdst--; + pdst += widthDst; + } + break; + case 2: + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + pdst++; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); + *pdst-- ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[1] | 0xFFFF); + *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[1] & 0xFFFF0000); + *pdst-- |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst--; +#endif + pdst += widthDst; + } + break; + case 3: + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); +#endif +#if RROP == GXxor + *pdst ^= (piQxelXor[2] & 0xFFFFFF00); +#endif +#if RROP == GXand + *pdst &= (piQxelAnd[2] | 0xFF); +#endif +#if RROP == GXor + *pdst |= (piQxelOr[2] & 0xFFFFFF00); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); +#endif + pdst += widthDst; + } + break; + } + break; + case 2: /* leftIndex + w = 2*/ + switch(leftIndex){ + case 2: + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + pdst++; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); + *pdst-- ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); + *pdst-- &= (piQxelAnd[2] | 0xFF); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[1] & 0xFFFF0000); + *pdst-- |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst--; +#endif + pdst += widthDst; + } + break; + case 1: + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + pdst++; + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFF000000); + *pdst-- ^= (piQxelXor[1] & 0xFFFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); + *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFF000000); + *pdst-- |= (piQxelOr[1] & 0xFFFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); + pdst--; +#endif + pdst += widthDst; + } + break; + case 0: /*case 2 leftIndex == 0 */ + while(h--){ +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst-- ^= (piQxelXor[1] & 0xFFFF); +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst-- |= (piQxelOr[1] & 0xFFFF); +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); + pdst--; +#endif + pdst += widthDst; + } + break; + } + break; + case 1: /*only if leftIndex = 0 and w = 1*/ + while(h--){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); +#endif +#if RROP == GXxor + *pdst ^= (piQxelXor[0] & 0xFFFFFF); +#endif +#if RROP == GXand + *pdst &= (piQxelAnd[0] | 0xFF000000); +#endif +#if RROP == GXor + *pdst |= (piQxelOr[0] & 0xFFFFFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); +#endif + pdst += widthDst; + } + break; + case 0: /*never*/ + break; + default: + { + while(h--){ + pdst = pdstRect; + switch(leftIndex){ + case 0: + break; + case 1: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelXor[1]; + *pdst++ = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFF000000); + *pdst++ ^= piQxelXor[1]; + *pdst++ ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); + *pdst++ &= piQxelAnd[1]; + *pdst++ &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFF000000); + *pdst++ |= piQxelOr[1]; + *pdst++ |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst++; +#endif + break; + case 2: +#if RROP == GXcopy + *pdst = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000)); + pdst++; + *pdst++ = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^=(piQxelXor[1] & 0xFFFF0000); + *pdst++ ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[1] | 0xFFFF); + *pdst++ &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[1] & 0xFFFF0000); + *pdst++ |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst++; +#endif + break; + case 3: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); + pdst++; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[2] | 0xFF); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[2] & 0xFFFFFF00); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); + pdst++; +#endif + break; + } + m = nmiddle; + while(m--){ +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst++ = piQxelXor[1]; + *pdst++ = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= piQxelXor[1]; + *pdst++ ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= piQxelAnd[1]; + *pdst++ &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= piQxelOr[1]; + *pdst++ |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst++; +#endif + } + switch(rightIndex){ + case 0: + break; + case 1: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); + pdst++; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFFFFFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0xFF); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFFFFFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); + pdst++; +#endif + break; + case 2: +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + pdst++; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= (piQxelXor[1] & 0xFFFF); +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= (piQxelOr[1] & 0xFFFF); +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); + pdst++; +#endif + break; + case 3: +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst++ = piQxelXor[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst++; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= piQxelXor[1]; + *pdst++ ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= piQxelAnd[1]; + *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00); +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= piQxelOr[1]; + *pdst++ |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst++; +#endif + break; + } + pdstRect += widthDst; + } + } + } +#else /* PSZ != 24 */ pdstRect += (pBox->x1 >> PWSH); if ((pBox->x1 & PIM) + w <= PPW) { @@ -193,6 +766,7 @@ RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox) } } } +#endif #if PSZ == 8 } #endif @@ -208,14 +782,13 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int *pwidthInit; /* pointer to list of n widths */ int fSorted; { - unsigned long *pdstBase; + CfbBits *pdstBase; int widthDst; RROP_DECLARE - register unsigned long *pdst; + register CfbBits *pdst; register int nlmiddle; - register unsigned long startmask, endmask; register int w; int x; @@ -226,10 +799,15 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DDXPointPtr pptFree; int *pwidth; cfbPrivGCPtr devPriv; +#if PSZ == 24 + int leftIndex, rightIndex; +#else + register CfbBits startmask, endmask; +#endif devPriv = cfbGetGCPrivate(pGC); RROP_FETCH_GCPRIV(devPriv) - n = nInit * miFindMaxBand(devPriv->pCompositeClip); + n = nInit * miFindMaxBand(pGC->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) @@ -240,8 +818,7 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) } pwidth = pwidthFree; ppt = pptFree; - n = miClipSpans(devPriv->pCompositeClip, - pptInit, pwidthInit, nInit, + n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) @@ -254,6 +831,493 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) w = *pwidth++; if (!w) continue; +#if PSZ == 24 + leftIndex = x &3; +/* rightIndex = ((leftIndex+w)<5)?0:(x+w)&3;*/ + rightIndex = (x+w)&3; + + nlmiddle = w - rightIndex; + if(leftIndex){ + nlmiddle -= (4 - leftIndex); + } +/* nlmiddle += 3;*/ + nlmiddle >>= 2; + if(nlmiddle < 0) + nlmiddle = 0; + + pdst += (x >> 2)*3; + pdst += leftIndex? (leftIndex -1):0; + switch(leftIndex+w){ + case 4: + switch(leftIndex){ + case 0: +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst++ = piQxelXor[1]; + *pdst-- = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= piQxelXor[1]; + *pdst-- ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= piQxelAnd[1]; + *pdst-- &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= piQxelOr[1]; + *pdst-- |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst--; +#endif + pdst--; + break; + case 1: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelXor[1]; + *pdst-- = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFF000000); + *pdst++ ^= piQxelXor[1]; + *pdst-- ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); + *pdst++ &= piQxelAnd[1]; + *pdst-- &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFF000000); + *pdst++ |= piQxelOr[1]; + *pdst-- |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst--; +#endif + pdst--; + break; + case 2: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + pdst++; + *pdst-- = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); + *pdst-- ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[1] | 0xFFFF); + *pdst-- &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[1] & 0xFFFF0000); + *pdst-- |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst--; +#endif + break; + case 3: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); +#endif +#if RROP == GXxor + *pdst ^= (piQxelXor[2] & 0xFFFFFF00); +#endif +#if RROP == GXand + *pdst &= (piQxelAnd[2] | 0xFF); +#endif +#if RROP == GXor + *pdst |= (piQxelOr[2] & 0xFFFFFF00); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); +#endif + break; + } + break; + case 3: + switch(leftIndex){ + case 0: +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst++ = piQxelXor[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= piQxelXor[1]; + *pdst-- ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= piQxelAnd[1]; + *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= piQxelOr[1]; + + *pdst-- |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst--; +#endif + pdst--; + break; + case 1: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelXor[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFF000000); + *pdst++ ^= piQxelXor[1]; + *pdst-- ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); + *pdst++ &= piQxelAnd[1]; + *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFF000000); + *pdst++ |= piQxelOr[1]; + *pdst-- |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst--; +#endif + pdst--; + break; + case 2: +/* pdst++;*/ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + pdst++; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); + *pdst-- ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[1] | 0xFFFF); + *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[1] & 0xFFFF0000); + *pdst-- |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst--; +#endif + break; + } + break; + case 2: /* leftIndex + w = 2*/ + if(leftIndex){ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + pdst++; + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFF000000); + *pdst-- ^= (piQxelXor[1] & 0xFFFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); + *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFF000000); + *pdst-- |= (piQxelOr[1] & 0xFFFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); + pdst--; +#endif + } + else{ /*case 2 leftIndex === 0 */ +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + pdst--; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst-- ^= (piQxelXor[1] & 0xFFFF); +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst-- |= (piQxelOr[1] & 0xFFFF); +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); + pdst--; +#endif + } + break; + case 1: /*only if leftIndex = 0 and w = 1*/ +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); +#endif +#if RROP == GXxor + *pdst ^= (piQxelXor[0] & 0xFFFFFF); +#endif +#if RROP == GXand + *pdst &= (piQxelAnd[0] | 0xFF000000); +#endif +#if RROP == GXor + *pdst |= (piQxelOr[0] & 0xFFFFFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); +#endif + break; + case 0: /*never*/ + break; + default: + { + switch(leftIndex){ + case 0: + break; + case 1: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + pdst++; + *pdst++ = piQxelXor[1]; + *pdst++ = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFF000000); + *pdst++ ^= piQxelXor[1]; + *pdst++ ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); + *pdst++ &= piQxelAnd[1]; + *pdst++ &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFF000000); + *pdst++ |= piQxelOr[1]; + *pdst++ |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst++; +#endif + break; + case 2: +#if RROP == GXcopy + *pdst = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000)); + pdst++; + *pdst++ = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^=(piQxelXor[1] & 0xFFFF0000); + *pdst++ ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[1] | 0xFFFF); + *pdst++ &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[1] & 0xFFFF0000); + *pdst++ |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst++; +#endif + break; + case 3: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); + pdst++; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[2] | 0xFF); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[2] & 0xFFFFFF00); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); + pdst++; +#endif + break; + } + while(nlmiddle--){ +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst++ = piQxelXor[1]; + *pdst++ = piQxelXor[2]; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= piQxelXor[1]; + *pdst++ ^= piQxelXor[2]; +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= piQxelAnd[1]; + *pdst++ &= piQxelAnd[2]; +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= piQxelOr[1]; + *pdst++ |= piQxelOr[2]; +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); + pdst++; +#endif + } + switch(rightIndex){ + case 0: + break; + case 1: +#if RROP == GXcopy + *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); + pdst++; +#endif +#if RROP == GXxor + *pdst++ ^= (piQxelXor[0] & 0xFFFFFF); +#endif +#if RROP == GXand + *pdst++ &= (piQxelAnd[0] | 0xFF); +#endif +#if RROP == GXor + *pdst++ |= (piQxelOr[0] & 0xFFFFFF); +#endif +#if RROP == GXset + *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); +#endif + break; + case 2: +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + pdst++; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= (piQxelXor[1] & 0xFFFF); +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= (piQxelOr[1] & 0xFFFF); +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); + pdst++; +#endif + break; + case 3: +#if RROP == GXcopy + *pdst++ = piQxelXor[0]; + *pdst++ = piQxelXor[1]; + *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + pdst++; +#endif +#if RROP == GXxor + *pdst++ ^= piQxelXor[0]; + *pdst++ ^= piQxelXor[1]; + *pdst++ ^= (piQxelXor[2] & 0xFF); +#endif +#if RROP == GXand + *pdst++ &= piQxelAnd[0]; + *pdst++ &= piQxelAnd[1]; + *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00); +#endif +#if RROP == GXor + *pdst++ |= piQxelOr[0]; + *pdst++ |= piQxelOr[1]; + *pdst++ |= (piQxelOr[2] & 0xFF); +#endif +#if RROP == GXset + *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); + pdst++; + *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); + pdst++; + *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); + pdst++; +#endif + break; + } + } +} +#else #if PSZ == 8 if (w <= PGSZB) { @@ -290,6 +1354,7 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) RROP_SOLID_MASK (pdst, endmask); } } +#endif } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); diff --git a/cfb/cfbteblt8.c b/cfb/cfbteblt8.c index 7653e770b..0cdbddc7a 100644 --- a/cfb/cfbteblt8.c +++ b/cfb/cfbteblt8.c @@ -3,6 +3,7 @@ * 8 bit displays, in Copy mode with no clipping. */ +/* $XFree86: xc/programs/Xserver/cfb/cfbteblt8.c,v 1.6 2001/12/14 19:59:25 dawes Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -159,7 +160,7 @@ typedef unsigned int *glyphPointer; #endif #ifdef USE_LEFTBITS -extern unsigned long endtab[]; +extern CfbBits endtab[]; #define IncChar(c) (c = (glyphPointer) (((char *) c) + glyphBytes)) @@ -313,7 +314,7 @@ extern unsigned long endtab[]; #define StoreBits(o) StorePixels(o,cfb8Pixels[(c) & PGSZBMSK]); #define FirstStep Step #else /* PGSZ == 32 */ -#define StoreBits(o) StorePixels(o,*((unsigned long *) (((char *) cfb8Pixels) + (c & 0x3c)))); +#define StoreBits(o) StorePixels(o,*((CfbBits *) (((char *) cfb8Pixels) + (c & 0x3c)))); #define FirstStep c = BitLeft (c, 2); #endif /* PGSZ */ #endif /* BITMAP_BIT_ORDER */ @@ -328,9 +329,9 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { - register unsigned long c; - register unsigned long *dst; - register unsigned long leftMask, rightMask; + register CfbBits c; + register CfbBits *dst; + register CfbBits leftMask, rightMask; register int hTmp; register int xoff1; register glyphPointer char1; @@ -349,11 +350,14 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) #endif FontPtr pfont = pGC->font; - unsigned long *dstLine; + CfbBits *dstLine; glyphPointer oldRightChar; - unsigned long *pdstBase; + CfbBits *pdstBase; glyphPointer leftChar; - int widthDst, widthLeft; + int widthDst; +#ifndef FAST_CONSTANT_OFFSET_MODE + int widthLeft; +#endif int widthGlyph; int h; int ew; @@ -362,8 +366,8 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) int lshift; int widthGlyphs; #ifdef USE_LEFTBITS - register unsigned long glyphMask; - register unsigned long tmpSrc; + register CfbBits glyphMask; + register CfbBits tmpSrc; register int glyphBytes; #endif @@ -454,8 +458,8 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) leftMask = cfbendtab[xoff1]; rightMask = cfbstarttab[xoff1]; -#define StoreBits0 StorePixels (0,dst[0] & leftMask | \ - GetPixelGroup(c) & rightMask); +#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \ + (GetPixelGroup(c) & rightMask)); #define GetBits GetBitsNS SwitchEm @@ -520,7 +524,8 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) leftMask = cfbendtab[xoff1]; rightMask = cfbstarttab[xoff1]; -#define StoreBits0 StorePixels (0,dst[0] & leftMask | GetPixelGroup(c) & rightMask); +#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \ + (GetPixelGroup(c) & rightMask)); #define GetBits WGetBits1S SwitchEm diff --git a/cfb/cfbtegblt.c b/cfb/cfbtegblt.c index 383926619..0cba03575 100644 --- a/cfb/cfbtegblt.c +++ b/cfb/cfbtegblt.c @@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/cfb/cfbtegblt.c,v 3.6 2001/12/14 19:59:25 dawes Exp $ */ + #include "X.h" #include "Xmd.h" #include "Xproto.h" @@ -91,7 +93,7 @@ cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) { FontPtr pfont = pGC->font; int widthDst; - unsigned long *pdstBase; /* pointer to longword with top row + CfbBits *pdstBase; /* pointer to longword with top row of current glyph */ int w; /* width of glyph and char */ @@ -101,12 +103,12 @@ cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) register unsigned char *pglyph; int widthGlyph; - register unsigned long *pdst;/* pointer to current longword in dst */ + register CfbBits *pdst;/* pointer to current longword in dst */ int hTmp; /* counter for height */ BoxRec bbox; /* for clipping */ register int wtmp,xtemp,width; - unsigned long bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp; + CfbBits bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp; int tmpx; xpos += pDrawable->x; @@ -154,7 +156,7 @@ cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) one day... */ - miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); break; case rgnIN: @@ -174,18 +176,37 @@ cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) while (width > 0) { +#if PSZ == 24 + tmpx = x & 3; + w = 1; +#else tmpx = x & PIM; w = min(width, PPW - tmpx); w = min(w, (PGSZ - xtemp)); - - ptemp = (unsigned long *)(pglyph + (xtemp >> MFB_PWSH)); +#endif + +#if PSZ == 24 + ptemp = (CfbBits *)(pglyph + ((xtemp *3)>> 2)); +#else + ptemp = (CfbBits *)(pglyph + (xtemp >> MFB_PWSH)); +#endif +#if PSZ == 24 + getstipplepixels24(ptemp,xtemp,0,&bgfill,&tmpDst1, xtemp); + getstipplepixels24(ptemp,xtemp,1,&fgfill,&tmpDst2, xtemp); +#else getstipplepixels(ptemp,xtemp,w,0,&bgfill,&tmpDst1); getstipplepixels(ptemp,xtemp,w,1,&fgfill,&tmpDst2); +#endif { - unsigned long tmpDst = tmpDst1 | tmpDst2; - unsigned long *pdsttmp = pdst + (x >> PWSH); + CfbBits tmpDst = tmpDst1 | tmpDst2; +#if PSZ == 24 + CfbBits *pdsttmp = pdst + ((x*3) >> 2); + putbits24(tmpDst,tmpx,w,pdsttmp,pGC->planemask,x); +#else + CfbBits *pdsttmp = pdst + (x >> PWSH); putbits(tmpDst,tmpx,w,pdsttmp,pGC->planemask); +#endif } x += w; xtemp += w; diff --git a/cfb/cfbtile32.c b/cfb/cfbtile32.c index 544857a25..cfa3bd503 100644 --- a/cfb/cfbtile32.c +++ b/cfb/cfbtile32.c @@ -2,6 +2,7 @@ * Fill 32 bit tiled rectangles. Used by both PolyFillRect and PaintWindow. * no depth dependencies. */ +/* $XFree86: xc/programs/Xserver/cfb/cfbtile32.c,v 3.6 2001/12/14 19:59:25 dawes Exp $ */ /* @@ -52,6 +53,93 @@ in this Software without prior written authorization from The Open Group. #define SHARED_IDCACHE #endif +#if PSZ == 24 +#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p))) +/*#define STORE24(p,index) {\ + register int idx = ((index) & 3)<< 1; \ + *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))<<cfb24Shift[idx])&cfbmask[idx])| \ + (*(p)&cfbrmask[idx])); \ + idx++; \ + (p)++; \ + *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))>>cfb24Shift[idx])&cfbmask[idx])| \ + (*(p)&cfbrmask[idx])); \ + (p)--; \ + }*/ +#define STORE24(p,index) MROP_PREBUILT_SOLID24(srcpix, (p), index) + +#define STORE_MASK(p,mask) (*(p) = MROP_PREBUILT_MASK(srcpix,*(p),(mask))) +#define QSTORE(p) ((*(p) = MROP_PREBUILT_SOLID(((srcpix<<24)|srcpix),*(p))), \ + (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \ + (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p)))) + +#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) +# define Expand(left,right) {\ + int part = nlwMiddle & ((PGSZB*2)-1); \ + nlwMiddle *= 3; \ + nlwMiddle >>= PWSH + 3; \ + while (h--) { \ + srcpix = psrc[srcy]; \ + MROP_PREBUILD(srcpix); \ + ++srcy; \ + if (srcy == tileHeight) \ + srcy = 0; \ + left \ + p += part; \ + switch (part) { \ + case 7: \ + STORE24(p - 7, xtmp - 7); \ + case 6: \ + STORE24(p - 6, xtmp - 6); \ + case 5: \ + STORE24(p - 5, xtmp - 5); \ + case 4: \ + STORE24(p - 4, xtmp - 4); \ + case 3: \ + STORE24(p - 3, xtmp - 3); \ + case 2: \ + STORE24(p - 2, xtmp - 2); \ + case 1: \ + STORE24(p - 1, xtmp - 1); \ + } \ + nlw = nlwMiddle; \ + while (nlw) { \ + STORE24 (p + 0, xtmp + 0); \ + STORE24 (p + 1, xtmp + 1); \ + STORE24 (p + 2, xtmp + 2); \ + STORE24 (p + 3, xtmp + 3); \ + STORE24 (p + 4, xtmp + 4); \ + STORE24 (p + 5, xtmp + 5); \ + STORE24 (p + 6, xtmp + 6); \ + STORE24 (p + 7, xtmp + 7); \ + p += 8; \ + xtmp += 8; \ + nlw--; \ + } \ + right \ + p += nlwExtra; \ + } \ +} +#else +#define Expand(left,right) {\ + while (h--) { \ + srcpix = psrc[srcy]; \ + MROP_PREBUILD(srcpix); \ + ++srcy; \ + if (srcy == tileHeight) \ + srcy = 0; \ + left \ + while (nlw--) \ + { \ + STORE24(p,xtmp); \ + if(xtmp&3) p++; \ + xtmp++; \ + } \ + right \ + p += nlwExtra; \ + } \ +} +#endif +#else /*PSZ != 24*/ #define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p))) #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) @@ -119,6 +207,7 @@ in this Software without prior written authorization from The Open Group. } \ } #endif +#endif /*PSZ == 24*/ void MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox) @@ -127,30 +216,33 @@ MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox) int nBox; /* number of boxes to fill */ BoxPtr pBox; /* pointer to list of boxes to fill */ { - register unsigned long srcpix; - unsigned long *psrc; /* pointer to bits in tile, if needed */ + register CfbBits srcpix; + CfbBits *psrc; /* pointer to bits in tile, if needed */ int tileHeight; /* height of the tile */ int nlwDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ register int h; /* height of current box */ - register unsigned long startmask; - register unsigned long endmask; /* masks for reggedy bits at either end of line */ + register CfbBits startmask; + register CfbBits endmask; /* masks for reggedy bits at either end of line */ int nlwMiddle; /* number of longwords between sides of boxes */ int nlwExtra; /* to get from right of box to left of next span */ - register int nlw; /* loop version of nlwMiddle */ - register unsigned long *p; /* pointer to bits we're writing */ + register int nlw = 0; /* loop version of nlwMiddle */ + register CfbBits *p; /* pointer to bits we're writing */ int y; /* current scan line */ int srcy; /* current tile position */ - unsigned long *pbits;/* pointer to start of pixmap */ + CfbBits *pbits;/* pointer to start of pixmap */ PixmapPtr tile; /* rotated, expanded tile */ MROP_DECLARE_REG() MROP_PREBUILT_DECLARE() +#if PSZ == 24 + CfbBits xtmp; +#endif - tile = cfbGetGCPrivate(pGC)->pRotatedPixmap; + tile = pGC->pRotatedPixmap; tileHeight = tile->drawable.height; - psrc = (unsigned long *)tile->devPrivate.ptr; + psrc = (CfbBits *)tile->devPrivate.ptr; MROP_INITIALIZE(pGC->alu, pGC->planemask); @@ -161,10 +253,20 @@ MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox) w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; y = pBox->y1; +#if PSZ == 24 + xtmp = pBox->x1; + p = pbits + (y * nlwDst) + ((pBox->x1*3) >> 2); +/* p = pbits + (y * nlwDst) + ((pBox->x1>> 2)*3);*/ +#else p = pbits + (y * nlwDst) + (pBox->x1 >> PWSH); +#endif srcy = y % tileHeight; +#if PSZ == 24 + if (w == 1 && ((pBox->x1 & 3) == 0 || (pBox->x1 & 3) == 3)) +#else if ( ((pBox->x1 & PIM) + w) <= PPW) +#endif { maskpartialbits(pBox->x1, w, startmask); nlwExtra = nlwDst; @@ -229,23 +331,26 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int n; /* number of spans to fill */ DDXPointPtr ppt; /* pointer to list of start points */ int *pwidth;/* pointer to list of n widths */ - unsigned long *pbits; /* pointer to start of bitmap */ + CfbBits *pbits; /* pointer to start of bitmap */ int nlwDst; /* width in longwords of bitmap */ - register unsigned long *p; /* pointer to current longword in bitmap */ + register CfbBits *p; /* pointer to current longword in bitmap */ register int w; /* current span width */ register int nlw; register int x; - register unsigned long startmask; - register unsigned long endmask; - register unsigned long srcpix; + register CfbBits startmask; + register CfbBits endmask; + register CfbBits srcpix; int y; int *pwidthFree;/* copies of the pointers to free */ DDXPointPtr pptFree; PixmapPtr tile; - unsigned long *psrc; /* pointer to bits in tile */ + CfbBits *psrc; /* pointer to bits in tile */ int tileHeight;/* height of the tile */ MROP_DECLARE_REG () MROP_PREBUILT_DECLARE() +#if PSZ == 24 + CfbBits xtmp; +#endif n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); @@ -262,9 +367,9 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); - tile = cfbGetGCPrivate(pGC)->pRotatedPixmap; + tile = pGC->pRotatedPixmap; tileHeight = tile->drawable.height; - psrc = (unsigned long *)tile->devPrivate.ptr; + psrc = (CfbBits *)tile->devPrivate.ptr; MROP_INITIALIZE(pGC->alu, pGC->planemask); @@ -280,11 +385,21 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) y = ppt->y; ++ppt; w = *pwidth++; +#if PSZ == 24 +/* p = pbits + (y * nlwDst) + ((x*3) >> 2);*/ + xtmp = x; + p = pbits + (y * nlwDst) + ((x >> 2)*3); +#else p = pbits + (y * nlwDst) + (x >> PWSH); +#endif srcpix = psrc[y & tileHeight]; MROP_PREBUILD(srcpix); +#if PSZ == 24 + if ((x & 3) + w < 5) +#else if ((x & PIM) + w < PPW) +#endif { maskpartialbits(x, w, startmask); *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); @@ -295,12 +410,23 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) if (startmask) { *p = MROP_PREBUILT_MASK(srcpix, *p, startmask); +#if PSZ == 24 + if(xtmp&3) p++; + xtmp++; +#else p++; +#endif } while (nlw--) { +#if PSZ == 24 + STORE24(p,xtmp); + if(xtmp&3) p++; + ++xtmp; +#else STORE(p); ++p; +#endif } if (endmask) { @@ -318,11 +444,21 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) y = ppt->y; ++ppt; w = *pwidth++; +#if PSZ == 24 +/* p = pbits + (y * nlwDst) + ((x *3)>> 2);*/ + p = pbits + (y * nlwDst) + ((x >> 2)*3); + xtmp = x; +#else p = pbits + (y * nlwDst) + (x >> PWSH); +#endif srcpix = psrc[y % tileHeight]; MROP_PREBUILD(srcpix); +#if PSZ == 24 + if ((x & 3) + w < 5) +#else if ((x & PIM) + w < PPW) +#endif { maskpartialbits(x, w, startmask); *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); @@ -333,12 +469,23 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) if (startmask) { *p = MROP_PREBUILT_MASK(srcpix, *p, startmask); +#if PSZ == 24 + if(xtmp&3)p++; + xtmp++; +#else p++; +#endif } while (nlw--) { +#if PSZ == 24 + STORE24(p,xtmp); + if(xtmp&3)p++; + xtmp++; +#else STORE(p); ++p; +#endif } if (endmask) { diff --git a/cfb/cfbtileodd.c b/cfb/cfbtileodd.c index 2307f6b55..85efd614e 100644 --- a/cfb/cfbtileodd.c +++ b/cfb/cfbtileodd.c @@ -2,6 +2,7 @@ * Fill odd tiled rectangles and spans. * no depth dependencies. */ +/* $XFree86: xc/programs/Xserver/cfb/cfbtileodd.c,v 3.6 2001/12/14 19:59:25 dawes Exp $ */ /* @@ -45,11 +46,11 @@ in this Software without prior written authorization from The Open Group. #include "mergerop.h" -#if PGSZ == 32 +#if PSZ == 24 +#define LEFTSHIFT_AMT (3) +#else /* PSZ != 24 */ #define LEFTSHIFT_AMT (5 - PWSH) -#else /* PGSZ == 64 */ -#define LEFTSHIFT_AMT (6 - PWSH) -#endif /* PGSZ */ +#endif /* PSZ == 24*/ #define LastTileBits {\ tmp = bits; \ @@ -59,6 +60,23 @@ in this Software without prior written authorization from The Open Group. bits = *pSrc; \ } +#if PSZ == 24 +#define ResetTileBits {\ + pSrc = pSrcLine; \ + nlwSrc = widthSrc;\ + if (tileEndPart) { \ + if (4 - xoff + tileEndPart <= 4) {\ + bits = *pSrc++; \ + nlwSrc--; \ + } else \ + bits = BitLeft(tmp, tileEndLeftShift) | \ + BitRight(bits, tileEndRightShift); \ + xoff = (xoff + xoffStep) & 3; \ + leftShift = xoff << LEFTSHIFT_AMT; \ + rightShift = PGSZ - leftShift; \ + }\ +} +#else #define ResetTileBits {\ pSrc = pSrcLine; \ nlwSrc = widthSrc;\ @@ -74,6 +92,7 @@ in this Software without prior written authorization from The Open Group. rightShift = PGSZ - leftShift; \ }\ } +#endif #define NextTileBits {\ if (nlwSrc == 1) {\ @@ -109,8 +128,8 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ int h; /* height of current box */ - unsigned long startmask; - unsigned long endmask;/* masks for reggedy bits at either end of line */ + CfbBits startmask; + CfbBits endmask;/* masks for reggedy bits at either end of line */ int nlwMiddle; /* number of longwords between sides of boxes */ int nlwSrc; /* number of whole longwords in source */ @@ -122,24 +141,23 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan MROP_DECLARE_REG() - unsigned long *pDstBase; /* pointer to start of dest */ - unsigned long *pDstLine; /* poitner to start of dest box */ - unsigned long *pSrcBase; /* pointer to start of source */ - unsigned long *pSrcLine; /* pointer to start of source line */ - register unsigned long *pDst; - register unsigned long *pSrc; - register unsigned long bits, tmp; - register int nlwPart; + CfbBits *pdstBase; /* pointer to start of dest */ + CfbBits *pDstLine; /* poitner to start of dest box */ + CfbBits *pSrcBase; /* pointer to start of source */ + CfbBits *pSrcLine; /* pointer to start of source line */ + register CfbBits *pDst; + register CfbBits *pSrc; + register CfbBits bits, tmp = 0; int xoffStart, xoff; int leftShiftStart, rightShiftStart, nlwSrcStart; - unsigned long tileEndMask; + CfbBits tileEndMask; int tileEndLeftShift, tileEndRightShift; int xoffStep; int tileEndPart; int needFirst; - unsigned long narrow[2]; - unsigned long narrowMask; - int narrowShift; + CfbBits narrow[2]; + CfbBits narrowMask = 0; + int narrowShift = 0; Bool narrowTile; MROP_INITIALIZE (alu, planemask) @@ -156,15 +174,24 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan widthSrc = 2; narrowTile = TRUE; } - pSrcBase = (unsigned long *)tile->devPrivate.ptr; + pSrcBase = (CfbBits *)tile->devPrivate.ptr; - cfbGetLongWidthAndPointer (pDrawable, widthDst, pDstBase) + cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) +#if PSZ == 24 + tileEndPart = (4 - tileWidth) & 3; + tileEndMask = cfbendpartial[tileWidth & 3]; +#else tileEndPart = tileWidth & PIM; tileEndMask = cfbendpartial[tileEndPart]; +#endif /* PSZ == 24 */ tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT; tileEndRightShift = PGSZ - tileEndLeftShift; +#if PSZ == 24 + xoffStep = 4 - tileEndPart; +#else xoffStep = PPW - tileEndPart; +#endif /* PSZ == 24 */ /* * current assumptions: tile > 32 bits wide. */ @@ -174,8 +201,13 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan h = pBox->y2 - pBox->y1; modulus (pBox->x1 - xrot, tileWidth, srcx); modulus (pBox->y1 - yrot, tileHeight, srcy); +#if PSZ == 24 + xoffDst = (4 - pBox->x1) & 3; + if (w == 1 && (xoffDst == 0 || xoffDst == 1)) +#else xoffDst = pBox->x1 & PIM; if (xoffDst + w < PPW) +#endif { maskpartialbits(pBox->x1, w, startmask); endmask = 0; @@ -185,9 +217,17 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan { maskbits (pBox->x1, w, startmask, endmask, nlwMiddle) } - pDstLine = pDstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); +#if PSZ == 24 + pDstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2); +#else + pDstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); +#endif pSrcLine = pSrcBase + (srcy * widthSrc); +#if PSZ == 24 + xoffSrc = (4 - srcx) & 3; +#else xoffSrc = srcx & PIM; +#endif if (xoffSrc >= xoffDst) { xoffStart = xoffSrc - xoffDst; @@ -195,12 +235,20 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan } else { +#if PSZ == 24 + xoffStart = 4 - (xoffDst - xoffSrc); +#else xoffStart = PPW - (xoffDst - xoffSrc); +#endif needFirst = 0; } leftShiftStart = (xoffStart) << LEFTSHIFT_AMT; rightShiftStart = PGSZ - leftShiftStart; +#if PSZ == 24 + nlwSrcStart = widthSrc - ((srcx*3) >> 2); +#else nlwSrcStart = widthSrc - (srcx >> PWSH); +#endif while (h--) { /* XXX only works when narrowShift >= PPW/2 */ @@ -208,15 +256,24 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan { tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */ narrow[0] = tmp | SCRRIGHT (tmp, narrowShift); +#if PSZ == 24 + narrow[1] = BitLeft (tmp, 8) | + BitRight(tmp, 16); +#else narrow[1] = SCRLEFT (tmp, PPW - narrowShift) | SCRRIGHT(tmp, 2 * narrowShift - PPW); +#endif pSrcLine = narrow; } xoff = xoffStart; leftShift = leftShiftStart; rightShift = rightShiftStart; nlwSrc = nlwSrcStart; +#if PSZ == 24 + pSrc = pSrcLine + ((srcx * 3) >> 2); +#else pSrc = pSrcLine + (srcx >> PWSH); +#endif pDst = pDstLine; bits = 0; if (needFirst) @@ -238,7 +295,8 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan #if MROP == Mcopy if (nlwSrc > 1) { - nlwPart = nlw; + int nlwPart = nlw; + if (nlwPart >= nlwSrc) nlwPart = nlwSrc - 1; nlw -= nlwPart; @@ -327,8 +385,8 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current span */ - unsigned long startmask; - unsigned long endmask; /* masks for reggedy bits at either end of line */ + CfbBits startmask; + CfbBits endmask; /* masks for reggedy bits at either end of line */ int nlwSrc; /* number of whole longwords in source */ register int nlw; /* loop version of nlwMiddle */ @@ -339,24 +397,23 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, MROP_DECLARE_REG() - unsigned long *pDstBase; /* pointer to start of dest */ - unsigned long *pDstLine; /* poitner to start of dest box */ - unsigned long *pSrcBase; /* pointer to start of source */ - unsigned long *pSrcLine; /* pointer to start of source line */ - register unsigned long *pDst; - register unsigned long *pSrc; - register unsigned long bits, tmp; - register int nlwPart; + CfbBits *pdstBase; /* pointer to start of dest */ + CfbBits *pDstLine; /* poitner to start of dest box */ + CfbBits *pSrcBase; /* pointer to start of source */ + CfbBits *pSrcLine; /* pointer to start of source line */ + register CfbBits *pDst; + register CfbBits *pSrc; + register CfbBits bits, tmp = 0; int xoffStart, xoff; int leftShiftStart, rightShiftStart, nlwSrcStart; - unsigned long tileEndMask; + CfbBits tileEndMask; int tileEndLeftShift, tileEndRightShift; int xoffStep; int tileEndPart; int needFirst; - unsigned long narrow[2]; - unsigned long narrowMask; - int narrowShift; + CfbBits narrow[2]; + CfbBits narrowMask = 0; + int narrowShift = 0; Bool narrowTile; MROP_INITIALIZE (alu, planemask) @@ -373,22 +430,36 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, widthSrc = 2; narrowTile = TRUE; } - pSrcBase = (unsigned long *)tile->devPrivate.ptr; + pSrcBase = (CfbBits *)tile->devPrivate.ptr; - cfbGetLongWidthAndPointer (pDrawable, widthDst, pDstBase) + cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) +#if PSZ == 24 + tileEndPart = (4 - tileWidth) & 3; + tileEndMask = cfbendpartial[tileWidth & 3]; +#else tileEndPart = tileWidth & PIM; tileEndMask = cfbendpartial[tileEndPart]; +#endif tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT; tileEndRightShift = PGSZ - tileEndLeftShift; +#if PSZ == 24 + xoffStep = 4 - tileEndPart; +#else xoffStep = PPW - tileEndPart; +#endif while (n--) { w = *pwidth++; modulus (ppt->x - xrot, tileWidth, srcx); modulus (ppt->y - yrot, tileHeight, srcy); +#if PSZ == 24 + xoffDst = (4 - ppt->x) & 3; + if (w == 1 && (xoffDst == 0 || xoffDst == 1)) +#else xoffDst = ppt->x & PIM; if (xoffDst + w < PPW) +#endif { maskpartialbits(ppt->x, w, startmask); endmask = 0; @@ -398,9 +469,17 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, { maskbits (ppt->x, w, startmask, endmask, nlw) } - pDstLine = pDstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); +#if PSZ == 24 + pDstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3)>> 2); +#else + pDstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); +#endif pSrcLine = pSrcBase + (srcy * widthSrc); +#if PSZ == 24 + xoffSrc = (4 - srcx) & 3; +#else xoffSrc = srcx & PIM; +#endif if (xoffSrc >= xoffDst) { xoffStart = xoffSrc - xoffDst; @@ -408,26 +487,43 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, } else { +#if PSZ == 24 + xoffStart = 4 - (xoffDst - xoffSrc); +#else xoffStart = PPW - (xoffDst - xoffSrc); +#endif needFirst = 0; } leftShiftStart = (xoffStart) << LEFTSHIFT_AMT; rightShiftStart = PGSZ - leftShiftStart; +#if PSZ == 24 + nlwSrcStart = widthSrc - ((srcx*3) >> 2); +#else nlwSrcStart = widthSrc - (srcx >> PWSH); +#endif /* XXX only works when narrowShift >= PPW/2 */ if (narrowTile) { tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */ narrow[0] = tmp | SCRRIGHT (tmp, narrowShift); +#if PSZ == 24 + narrow[1] = BitLeft (tmp, 8) | + BitRight(tmp, 16); +#else narrow[1] = SCRLEFT (tmp, PPW - narrowShift) | SCRRIGHT(tmp, 2 * narrowShift - PPW); +#endif pSrcLine = narrow; } xoff = xoffStart; leftShift = leftShiftStart; rightShift = rightShiftStart; nlwSrc = nlwSrcStart; +#if PSZ == 24 + pSrc = pSrcLine + ((srcx * 3) >> 2); +#else pSrc = pSrcLine + (srcx >> PWSH); +#endif pDst = pDstLine; bits = 0; if (needFirst) @@ -448,7 +544,8 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, #if MROP == Mcopy if (nlwSrc > 1) { - nlwPart = nlw; + int nlwPart = nlw; + if (nlwPart >= nlwSrc) nlwPart = nlwSrc - 1; nlw -= nlwPart; @@ -534,8 +631,8 @@ MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ int h; /* height of current box */ - unsigned long startmask; - unsigned long endmask;/* masks for reggedy bits at either end of line */ + CfbBits startmask; + CfbBits endmask;/* masks for reggedy bits at either end of line */ int nlMiddle; /* number of longwords between sides of boxes */ register int nl; /* loop version of nlMiddle */ @@ -548,22 +645,26 @@ MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan MROP_DECLARE_REG() - unsigned long *pdstBase; /* pointer to start of dest */ - unsigned long *pdstLine; /* poitner to start of dest box */ - unsigned long *psrcBase; /* pointer to start of source */ - unsigned long *psrcLine; /* pointer to fetch point of source */ - unsigned long *psrcStart; /* pointer to start of source line */ - register unsigned long *pdst; - register unsigned long *psrc; - register unsigned long bits, bits1; + CfbBits *pdstBase; /* pointer to start of dest */ + CfbBits *pdstLine; /* poitner to start of dest box */ + CfbBits *psrcBase; /* pointer to start of source */ + CfbBits *psrcLine; /* pointer to fetch point of source */ + CfbBits *psrcStart; /* pointer to start of source line */ + register CfbBits *pdst; + register CfbBits *psrc; + register CfbBits bits, bits1; register int nlTemp; MROP_INITIALIZE (alu, planemask) - psrcBase = (unsigned long *)tile->devPrivate.ptr; + psrcBase = (CfbBits *)tile->devPrivate.ptr; tileHeight = tile->drawable.height; tileWidth = tile->drawable.width; +#if PSZ == 24 + widthSrc = tile->devKind / PGSZB; +#else widthSrc = tileWidth >> PWSH; +#endif cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) @@ -575,16 +676,30 @@ MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan /* set up source */ modulus (pBox->x1 - xrot, tileWidth, srcx); modulus (pBox->y1 - yrot, tileHeight, srcy); +#if PSZ == 24 + xoffSrc = (4 - srcx) & 3; + srcStart = (srcx * 3) >> 2; +#else xoffSrc = srcx & PIM; srcStart = (srcx >> PWSH); +#endif psrcStart = psrcBase + (srcy * widthSrc); psrcLine = psrcStart + srcStart; /* set up dest */ +#if PSZ == 24 + xoffDst = (4 - pBox->x1) & 3; + pdstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2); +#else xoffDst = pBox->x1 & PIM; pdstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); +#endif /* set up masks */ +#if PSZ == 24 + if (w == 1 && (xoffDst == 0 || xoffDst == 1)) +#else if (xoffDst + w < PPW) +#endif { maskpartialbits(pBox->x1, w, startmask); endmask = 0; @@ -827,8 +942,8 @@ MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ - unsigned long startmask; - unsigned long endmask;/* masks for reggedy bits at either end of line */ + CfbBits startmask; + CfbBits endmask;/* masks for reggedy bits at either end of line */ int nlMiddle; /* number of longwords between sides of boxes */ register int nl; /* loop version of nlMiddle */ @@ -841,22 +956,26 @@ MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, MROP_DECLARE_REG() - unsigned long *pdstBase; /* pointer to start of dest */ - unsigned long *pdstLine; /* poitner to start of dest box */ - unsigned long *psrcBase; /* pointer to start of source */ - unsigned long *psrcLine; /* pointer to fetch point of source */ - unsigned long *psrcStart; /* pointer to start of source line */ - register unsigned long *pdst; - register unsigned long *psrc; - register unsigned long bits, bits1; + CfbBits *pdstBase; /* pointer to start of dest */ + CfbBits *pdstLine; /* poitner to start of dest box */ + CfbBits *psrcBase; /* pointer to start of source */ + CfbBits *psrcLine; /* pointer to fetch point of source */ + CfbBits *psrcStart; /* pointer to start of source line */ + register CfbBits *pdst; + register CfbBits *psrc; + register CfbBits bits, bits1; register int nlTemp; MROP_INITIALIZE (alu, planemask) - psrcBase = (unsigned long *)tile->devPrivate.ptr; + psrcBase = (CfbBits *)tile->devPrivate.ptr; tileHeight = tile->drawable.height; tileWidth = tile->drawable.width; +#if PSZ == 24 + widthSrc = tile->devKind / PGSZB; +#else widthSrc = tileWidth >> PWSH; +#endif cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) @@ -867,16 +986,28 @@ MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, /* set up source */ modulus (ppt->x - xrot, tileWidth, srcx); modulus (ppt->y - yrot, tileHeight, srcy); +#if PSZ == 24 + xoffSrc = (4 - srcx) & 3; + srcStart = (srcx * 3) >> 2; +#else xoffSrc = srcx & PIM; srcStart = (srcx >> PWSH); +#endif psrcStart = psrcBase + (srcy * widthSrc); psrcLine = psrcStart + srcStart; /* set up dest */ +#if PSZ == 24 + xoffDst = (4 - ppt->x) & 3; + pdstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3) >> 2); + /* set up masks */ + if (w == 1 && (xoffDst == 0 || xoffDst == 1)) +#else xoffDst = ppt->x & PIM; pdstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); /* set up masks */ if (xoffDst + w < PPW) +#endif { maskpartialbits(ppt->x, w, startmask); endmask = 0; diff --git a/cfb/cfbzerarc.c b/cfb/cfbzerarc.c index 37b7023d5..c13e37739 100644 --- a/cfb/cfbzerarc.c +++ b/cfb/cfbzerarc.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfbzerarc.c,v 3.3 2001/12/14 19:59:25 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -57,6 +58,10 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) register int x; PixelType *addrp; register PixelType *yorgp, *yorgop; +#if PSZ == 24 + int xorg, xorg3, xorgo, xorgo3; + register int xtmp; +#endif RROP_DECLARE register int yoffset; int npwidth, dyoffset; @@ -71,16 +76,31 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) yorgop = addrp + ((info.yorgo + pDraw->y) * npwidth); info.xorg += pDraw->x; info.xorgo += pDraw->x; +#if PSZ == 24 + xorg = info.xorg; + xorg3 = xorg * 3; + info.xorg = (info.xorg * 3) >> 2; + xorgo = info.xorgo; + xorgo3 = xorgo * 3; + info.xorgo = (info.xorgo * 3) >> 2; +#endif MIARCSETUP(); yoffset = y ? npwidth : 0; dyoffset = 0; mask = info.initialMask; if (!(arc->width & 1)) { +#if PSZ == 24 + if (mask & 2) + RROP_SOLID24((yorgp + info.xorgo), xorgo); + if (mask & 8) + RROP_SOLID24((yorgop + info.xorgo), xorgo); +#else if (mask & 2) RROP_SOLID((yorgp + info.xorgo)); if (mask & 8) RROP_SOLID((yorgop + info.xorgo)); +#endif /* PSZ == 24 */ } if (!info.end.x || !info.end.y) { @@ -90,6 +110,34 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { register int xoffset = npwidth; +#if PSZ == 24 + PixelType *yorghb = yorgp + (info.h * npwidth); + register int tmp1, tmp2, tmp1_3, tmp2_3; + + tmp1 = xorg + info.h; + tmp1_3 = tmp1 * 3; + tmp2 = xorg - info.h; + tmp2_3 = tmp2 * 3; + while (1) + { + xtmp = (xorg3 + x * 3) >> 2; + RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); + RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); + xtmp = (xorg3 - x * 3) >> 2; + RROP_SOLID24(yorgp + yoffset + xtmp, xorg - x); + RROP_SOLID24(yorgop - yoffset + xtmp, xorg - x); + if (a < 0) + break; + xtmp = (tmp1_3 - y * 3) >> 2; + RROP_SOLID24(yorghb - xoffset + xtmp, tmp1 - y); + RROP_SOLID24(yorghb + xoffset + xtmp, tmp1 - y); + xtmp = (tmp2_3 + y * 3) >> 2; + RROP_SOLID24(yorghb - xoffset + xtmp, tmp2 + y); + RROP_SOLID24(yorghb + xoffset + xtmp, tmp2 + y); + xoffset += npwidth; + MIARCCIRCLESTEP(yoffset += npwidth;); + } +#else PixelType *yorghb = yorgp + (info.h * npwidth) + info.xorg; PixelType *yorgohb = yorghb - info.h; @@ -113,6 +161,7 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) } yorgp -= info.xorg; yorgop -= info.xorg; +#endif /* PSZ == 24 */ x = info.w; yoffset = info.h * npwidth; } @@ -121,10 +170,19 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = npwidth;); +#if PSZ == 24 + xtmp = (xorg3 + x * 3) >> 2; + RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); + RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); + xtmp = (xorgo3 - x * 3) >> 2; + RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); + RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); +#else RROP_SOLID(yorgp + yoffset + info.xorg + x); RROP_SOLID(yorgp + yoffset + info.xorgo - x); RROP_SOLID(yorgop - yoffset + info.xorgo - x); RROP_SOLID(yorgop - yoffset + info.xorg + x); +#endif MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;); } } @@ -138,6 +196,24 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) mask = info.start.mask; info.start = info.altstart; } +#if PSZ == 24 + if (mask & 1){ + xtmp = (xorg3 + x * 3) >> 2; + RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); + } + if (mask & 2){ + xtmp = (xorgo3 - x * 3) >> 2; + RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); + } + if (mask & 4){ + xtmp = (xorgo3 - x * 3) >> 2; + RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); + } + if (mask & 8){ + xtmp = (xorg3 + x * 3) >> 2; + RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); + } +#else if (mask & 1) RROP_SOLID(yorgp + yoffset + info.xorg + x); if (mask & 2) @@ -146,6 +222,7 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) RROP_SOLID(yorgop - yoffset + info.xorgo - x); if (mask & 8) RROP_SOLID(yorgop - yoffset + info.xorg + x); +#endif /* PSZ == 24 */ if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; @@ -156,16 +233,38 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) } if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; +#if PSZ == 24 + if (mask & 1){ + xtmp = (xorg3 + x * 3) >> 2; + RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); + } + if (mask & 4){ + xtmp = (xorgo3 - x * 3) >> 2; + RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); + } +#else if (mask & 1) RROP_SOLID(yorgp + yoffset + info.xorg + x); if (mask & 4) RROP_SOLID(yorgop - yoffset + info.xorgo - x); +#endif /* PSZ == 24 */ if (arc->height & 1) { +#if PSZ == 24 + if (mask & 2){ + xtmp = (xorgo3 - x * 3) >> 2; + RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); + } + if (mask & 8){ + xtmp = (xorg3 + x * 3) >> 2; + RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); + } +#else if (mask & 2) RROP_SOLID(yorgp + yoffset + info.xorgo - x); if (mask & 8) RROP_SOLID(yorgop - yoffset + info.xorg + x); +#endif /* PSZ == 24 */ } } diff --git a/cfb/stip68kgnu.h b/cfb/stip68kgnu.h index 9b2c7a1b3..9a2bac720 100644 --- a/cfb/stip68kgnu.h +++ b/cfb/stip68kgnu.h @@ -25,101 +25,96 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/stip68kgnu.h,v 3.4 2001/12/14 19:59:25 dawes Exp $ */ /* * Stipple stack macro for 68k GCC - * - * Note - this macro can nott describe the full extent of the - * modifications made to the arguments (GCC does not allow enough - * arguments to __asm statements). Therefore, it is possible - * (though unlikely) that future magic versions of GCC may - * miscompile this somehow. In particular, (stipple) is modified - * by the macro, yet not listed as an output value. */ #define STIPPLE(addr,stipple,value,width,count,shift) \ __asm volatile ( \ - "subqw #1,%1\n\ - lea 0f,a1\n\ - movew #28,d2\n\ - addl %7,d2\n\ - movew #28,d3\n\ - subql #4,%7\n\ - negl %7\n\ + "lea 5f,%/a1\n\ + moveq #28,%/d2\n\ + addl %2,%/d2\n\ + moveq #28,%/d3\n\ + subql #4,%2\n\ + negl %2\n\ 1:\n\ - movel %0,a0\n\ - addl %5,%0\n\ - movel %3@+,d1\n\ - beq 3f\n\ - movel d1,d0\n\ - lsrl d2,d0\n\ - lsll #5,d0\n\ - lsll %7,d1\n\ - jmp a1@(d0:l)\n\ + movel %0,%/a0\n\ + addl %6,%0\n\ + movel %3@+,%/d1\n\ + jeq 3f\n\ + movel %/d1,%/d0\n\ + lsrl %/d2,%/d0\n\ + lsll #5,%/d0\n\ + lsll %2,%/d1\n\ + jmp %/a1@(%/d0:l)\n\ 2:\n\ - addl #4,a0\n\ - movel d1,d0\n\ - lsrl d3,d0\n\ - lsll #5,d0\n\ - lsll #4,d1\n\ - jmp a1@(d0:l)\n\ -0:\n\ - bne 2b ; dbra %1,1b ; bra 4f\n\ - . = 0b + 0x20\n\ - moveb %4,a0@(3)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\ - . = 0b + 0x40\n\ - moveb %4,a0@(2)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\ - . = 0b + 0x60\n\ - movew %4,a0@(2)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\ - . = 0b + 0x80\n\ - moveb %4,a0@(1)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0xa0\n\ - moveb %4,a0@(3) ; moveb %4,a0@(1)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0xc0\n\ - movew %4,a0@(1)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0xe0\n\ - movew %4,a0@(2) ; moveb %4,a0@(1)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0x100\n\ - moveb %4,a0@(0)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0x120\n\ - moveb %4,a0@(3) ; moveb %4,a0@(0)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0x140\n\ - moveb %4,a0@(2) ; moveb %4,a0@(0)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0x160\n\ - movew %4,a0@(2) ; moveb %4,a0@(0)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0x180\n\ - movew %4,a0@(0)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0x1a0\n\ - moveb %4,a0@(3) ; movew %4,a0@(0)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0x1c0\n\ - moveb %4,a0@(2) ; movew %4,a0@(0)\n\ - andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\ - . = 0b + 0x1e0\n\ - movel %4,a0@(0)\n\ - andl d1,d1 ; bne 2b ; \n\ + addl #4,%/a0\n\ + movel %/d1,%/d0\n\ + lsrl %/d3,%/d0\n\ + lsll #5,%/d0\n\ + lsll #4,%/d1\n\ + jmp %/a1@(%/d0:l)\n\ +5:\n\ + jne 2b ; dbra %1,1b ; jra 4f\n\ + . = 5b + 0x20\n\ + moveb %5,%/a0@(3)\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ + . = 5b + 0x40\n\ + moveb %5,%/a0@(2)\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ + . = 5b + 0x60\n\ + movew %5,%/a0@(2)\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ + . = 5b + 0x80\n\ + moveb %5,%/a0@(1)\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0xa0\n\ + moveb %5,%/a0@(3) ; moveb %5,%/a0@(1)\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0xc0\n\ + movew %5,%/a0@(1)\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0xe0\n\ + movew %5,%/a0@(2) ; moveb %5,%/a0@(1)\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0x100\n\ + moveb %5,%/a0@\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0x120\n\ + moveb %5,%/a0@(3) ; moveb %5,%/a0@\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0x140\n\ + moveb %5,%/a0@(2) ; moveb %5,%/a0@\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0x160\n\ + movew %5,%/a0@(2) ; moveb %5,%/a0@\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0x180\n\ + movew %5,%/a0@\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0x1a0\n\ + moveb %5,%/a0@(3) ; movew %5,%/a0@\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0x1c0\n\ + moveb %5,%/a0@(2) ; movew %5,%/a0@\n\ + andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ + . = 5b + 0x1e0\n\ + movel %5,%/a0@\n\ + andl %/d1,%/d1 ; jne 2b ; \n\ 3: dbra %1,1b ; \n\ 4:\n"\ : "=a" (addr), /* %0 */ \ - "=d" (count) /* %1 */ \ - : "0" (addr), /* %2 */ \ - "a" (stipple), /* %3 */ \ - "d" (value), /* %4 */ \ - "a" (width), /* %5 */ \ - "1" (count), /* %6 */ \ - "d" (shift) /* %7 */ \ + "=d" (count), /* %1 */ \ + "=d" (shift), /* %2 */ \ + "=a" (stipple) /* %3 */ \ + : "0" (addr), /* %4 */ \ + "d" (value), /* %5 */ \ + "a" (width), /* %6 */ \ + "1" (count-1), /* %7 */ \ + "2" (shift), /* %8 */ \ + "3" (stipple) /* %9 */ \ : /* ctemp */ "d0", \ /* c */ "d1", \ /* lshift */ "d2", \ diff --git a/cfb/stipsparc.s b/cfb/stipsparc.s index 2c417599e..185795605 100644 --- a/cfb/stipsparc.s +++ b/cfb/stipsparc.s @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/stipsparc.s,v 1.5 2001/12/14 19:59:26 dawes Exp $ */ /* * SPARC assembly code for optimized text rendering. @@ -84,7 +85,7 @@ in this Software without prior written authorization from The Open Group. #define ForEachBits LY4 #define NextBits LY5 -#ifdef SVR4 +#if defined(SVR4) || defined(__ELF__) #ifdef TETEXT #define _cfbStippleStack cfbStippleStackTE #else diff --git a/cfb/stipsprc32.s b/cfb/stipsprc32.s index ce2b949b2..f878fbf80 100644 --- a/cfb/stipsprc32.s +++ b/cfb/stipsprc32.s @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/cfb/stipsprc32.s,v 1.5 2001/12/14 19:59:26 dawes Exp $ */ /* * SPARC assembly code for optimized text rendering. @@ -80,7 +81,7 @@ in this Software without prior written authorization from The Open Group. #define ForEachBits LY4 #define NextBits LY5 -#ifdef SVR4 +#if defined(SVR4) || defined(__ELF__) #ifdef TETEXT #define _cfb32StippleStack cfb32StippleStackTE #else |