summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com>2007-05-01 13:41:48 -0400
committerSoren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com>2007-05-03 12:17:24 -0400
commite0959adcd8df2c61e98e76e708fceef9c7cd54eb (patch)
treef283fcba6d8abb02133c74088d10e7c7169de8b4
parentc1e1d6b98a6708860e5b5f6e21d8d5b1d8ce9075 (diff)
Add fbCompositeRect() as another special case in the switch of doom in fbpict.c
This is phase one of getting the two region walkers in fbcompose.c and fbpict.c merged together.
-rw-r--r--fb/fbcompose.c2
-rw-r--r--fb/fbpict.c66
-rw-r--r--fb/fbpict.h3
3 files changed, 56 insertions, 15 deletions
diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index 24b552e0b..6e4989375 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -4027,7 +4027,7 @@ static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD3
typedef void (*scanStoreProc)(PicturePtr , int , int , int , CARD32 *);
typedef void (*scanFetchProc)(PicturePtr , int , int , int , CARD32 * , CARD32 *, CARD32);
-static void
+void
fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer)
{
CARD32 *src_buffer = scanline_buffer;
diff --git a/fb/fbpict.c b/fb/fbpict.c
index a7359673d..819d21adc 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -1018,14 +1018,6 @@ fbCompositeSolidMask_nx1xn (CARD8 op,
FbBits src;
fbComposeGetSolid(pSrc, src, pDst->format);
-
- if ((src & 0xff000000) != 0xff000000)
- {
- fbCompositeGeneral (op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height);
- return;
- }
fbGetStipDrawable (pMask->pDrawable, maskBits, maskStride, maskBpp, maskXoff, maskYoff);
fbGetDrawable (pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
@@ -1443,6 +1435,48 @@ fbCompositeSolidSrc_nxn (CARD8 op,
}
*/
+#define SCANLINE_BUFFER_LENGTH 2048
+
+static void
+fbCompositeRectWrapper (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
+ CARD32 *scanline_buffer = _scanline_buffer;
+ FbComposeData data;
+
+ data.op = op;
+ data.src = pSrc;
+ data.mask = pMask;
+ data.dest = pDst;
+ data.xSrc = xSrc;
+ data.ySrc = ySrc;
+ data.xMask = xMask;
+ data.yMask = yMask;
+ data.xDest = xDst;
+ data.yDest = yDst;
+ data.width = width;
+ data.height = height;
+
+ if (width > SCANLINE_BUFFER_LENGTH)
+ scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32));
+
+ fbCompositeRect (&data, scanline_buffer);
+
+ if (scanline_buffer != _scanline_buffer)
+ free(scanline_buffer);
+}
+
void
fbComposite (CARD8 op,
PicturePtr pSrc,
@@ -1632,8 +1666,14 @@ fbComposite (CARD8 op,
case PICT_x8r8g8b8:
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
- func = fbCompositeSolidMask_nx1xn;
+ {
+ FbBits src;
+
+ fbComposeGetSolid(pSrc, src, pDst->format);
+ if ((src & 0xff000000) == 0xff000000)
+ func = fbCompositeSolidMask_nx1xn;
break;
+ }
default:
break;
}
@@ -1642,7 +1682,7 @@ fbComposite (CARD8 op,
break;
}
}
- if (func != fbCompositeGeneral)
+ if (func)
srcRepeat = FALSE;
}
else if (!srcRepeat) /* has mask and non-repeating source */
@@ -1755,7 +1795,7 @@ fbComposite (CARD8 op,
break;
}
- if (func != fbCompositeGeneral)
+ if (func)
maskRepeat = FALSE;
}
}
@@ -2043,9 +2083,7 @@ fbComposite (CARD8 op,
}
if (!func) {
- /* no fast path, use the general code */
- fbCompositeGeneral(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
- return;
+ func = fbCompositeRectWrapper;
}
/* if we are transforming, we handle repeats in fbFetchTransformed */
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 5246cd5ac..86f271e7f 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -383,6 +383,9 @@ typedef struct _FbComposeData {
CARD16 height;
} FbComposeData;
+void
+fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer);
+
typedef FASTCALL void (*CombineMaskU) (CARD32 *src, const CARD32 *mask, int width);
typedef FASTCALL void (*CombineFuncU) (CARD32 *dest, const CARD32 *src, int width);
typedef FASTCALL void (*CombineFuncC) (CARD32 *dest, CARD32 *src, CARD32 *mask, int width);