summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2006-11-01 14:29:59 -0800
committerEric Anholt <eric@anholt.net>2007-01-03 10:38:04 -0800
commitfe37d26f30c7a5513c2b41822a4b5d787ace9ecb (patch)
treedcb45c592a0a17085274d6b722b9e9b7b561d233
parent9bc6752f68404b1c34fa3d28ea2f368e4470c69c (diff)
Fix several cases where optimized paths were hit when they shouldn't be.
This fixes a number of rendercheck cases. (cherry picked from commit 6fdfd9dad91d7b7aa292f8c4d268dd27c34de8d3)
-rw-r--r--fb/fbpict.c15
-rw-r--r--fb/fbpict.h47
2 files changed, 46 insertions, 16 deletions
diff --git a/fb/fbpict.c b/fb/fbpict.c
index ccd722af6..38afbea5c 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -891,9 +891,8 @@ fbComposite (CARD8 op,
case PictOpOver:
if (pMask)
{
- if (srcRepeat &&
- pSrc->pDrawable->width == 1 &&
- pSrc->pDrawable->height == 1)
+ if (fbCanGetSolid(pSrc) &&
+ !maskRepeat)
{
srcRepeat = FALSE;
if (PICT_FORMAT_COLOR(pSrc->format)) {
@@ -1005,7 +1004,7 @@ fbComposite (CARD8 op,
{
if (pSrc->pDrawable == pMask->pDrawable &&
xSrc == xMask && ySrc == yMask &&
- !pMask->componentAlpha)
+ !pMask->componentAlpha && !maskRepeat)
{
/* source == mask: non-premultiplied data */
switch (pSrc->format) {
@@ -1069,9 +1068,7 @@ fbComposite (CARD8 op,
else
{
/* non-repeating source, repeating mask => translucent window */
- if (maskRepeat &&
- pMask->pDrawable->width == 1 &&
- pMask->pDrawable->height == 1)
+ if (fbCanGetSolid(pMask))
{
if (pSrc->format == PICT_x8r8g8b8 &&
pDst->format == PICT_x8r8g8b8 &&
@@ -1088,9 +1085,7 @@ fbComposite (CARD8 op,
}
else /* no mask */
{
- if (srcRepeat &&
- pSrc->pDrawable->width == 1 &&
- pSrc->pDrawable->height == 1)
+ if (fbCanGetSolid(pSrc))
{
/* no mask and repeating source */
switch (pSrc->format) {
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 4ad032471..179a07dca 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -30,6 +30,13 @@
#include "renderedge.h"
+
+#if defined(__GNUC__)
+#define INLINE __inline__
+#else
+#define INLINE
+#endif
+
#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
#define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b))
@@ -67,6 +74,40 @@
#define Green(x) (((x) >> 8) & 0xff)
#define Blue(x) ((x) & 0xff)
+/**
+ * Returns TRUE if the fbComposeGetSolid can be used to get a single solid
+ * color representing every source sampling location of the picture.
+ */
+static INLINE Bool
+fbCanGetSolid(PicturePtr pict)
+{
+ if (pict->pDrawable == NULL ||
+ pict->pDrawable->width != 1 ||
+ pict->pDrawable->height != 1)
+ {
+ return FALSE;
+ }
+ if (pict->repeat != RepeatNormal)
+ return FALSE;
+
+ switch (pict->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ case PICT_r8g8b8:
+ case PICT_b8g8r8:
+ case PICT_r5g6b5:
+ case PICT_b5g6r5:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+#define fbCanGetSolid(pict) \
+(pict->pDrawable != NULL && pict->pDrawable->width == 1 && pict->pDrawable->height == 1)
+
#define fbComposeGetSolid(pict, bits, fmt) { \
FbBits *__bits__; \
FbStride __stride__; \
@@ -321,12 +362,6 @@
#define FASTCALL
#endif
-#if defined(__GNUC__)
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-
typedef struct _FbComposeData {
CARD8 op;
PicturePtr src;