summaryrefslogtreecommitdiff
path: root/cfb/cfbtile32.c
diff options
context:
space:
mode:
Diffstat (limited to 'cfb/cfbtile32.c')
-rw-r--r--cfb/cfbtile32.c181
1 files changed, 164 insertions, 17 deletions
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)
{