summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-09-16 06:43:41 +0000
committerOwen Taylor <otaylor@redhat.com>2005-09-16 06:43:41 +0000
commita9b89bf8984fdc6ada9275b0e414964ea0d52d57 (patch)
treec32df5d127b9196148fd2db8b2a2e5cc37ed2d3d
parenta85f9916a9743d83c8a71586dfa1d64f85f52ea7 (diff)
Bug #4260, Reviewed by B. Biggs
Use & not && for bitwise AND. src/fbpict.c src/fbmmx.c: Take 'dest' as an argument, if pict and dest don't match for RGB, BGR, swap result.
-rw-r--r--pixman/ChangeLog11
-rw-r--r--pixman/src/fbcompose.c4
-rw-r--r--pixman/src/fbmmx.c14
-rw-r--r--pixman/src/fbpict.c20
-rw-r--r--pixman/src/fbpict.h12
5 files changed, 40 insertions, 21 deletions
diff --git a/pixman/ChangeLog b/pixman/ChangeLog
index 79509db52..85616ba1d 100644
--- a/pixman/ChangeLog
+++ b/pixman/ChangeLog
@@ -1,5 +1,16 @@
2005-08-28 Owen Taylor <otaylor@redhat.com>
+ Bug #4260, Reviewed by B. Biggs
+
+ * src/fbcompose.c (fbStore_a8b8g8r8, fbStore_x8b8g8r8): Use & not
+ && for bitwise AND.
+
+ * src/fbpict.h (fbComposeGetSolid) src/fbpict.c src/fbmmx.c: Take
+ 'dest' as an argument, if pict and dest don't match for RGB, BGR,
+ swap result.
+
+2005-08-28 Owen Taylor <otaylor@redhat.com>
+
* src/fbmmx.c (detectCPUFeatures): Use local labels rather than
global labels in the assembly, to be robust if the code is inlined
in multiple places. (#4283, Reported by Marco Manfredini)
diff --git a/pixman/src/fbcompose.c b/pixman/src/fbcompose.c
index ada7249eb..fe0766242 100644
--- a/pixman/src/fbcompose.c
+++ b/pixman/src/fbcompose.c
@@ -1049,7 +1049,7 @@ fbStore_a8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexe
int i;
CARD32 *pixel = (CARD32 *)bits + x;
for (i = 0; i < width; ++i)
- *pixel++ = (values[i] & 0xff00ff00) | ((values[i] >> 16) && 0xff) | ((values[i] & 0xff) << 16);
+ *pixel++ = (values[i] & 0xff00ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16);
}
static FASTCALL void
@@ -1058,7 +1058,7 @@ fbStore_x8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexe
int i;
CARD32 *pixel = (CARD32 *)bits + x;
for (i = 0; i < width; ++i)
- *pixel++ = (values[i] & 0x0000ff00) | ((values[i] >> 16) && 0xff) | ((values[i] & 0xff) << 16);
+ *pixel++ = (values[i] & 0x0000ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16);
}
static FASTCALL void
diff --git a/pixman/src/fbmmx.c b/pixman/src/fbmmx.c
index 580747102..c71089518 100644
--- a/pixman/src/fbmmx.c
+++ b/pixman/src/fbmmx.c
@@ -886,7 +886,7 @@ fbCompositeSolid_nx8888mmx (pixman_operator_t op,
CHECKPOINT();
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
if (src >> 24 == 0)
return;
@@ -964,7 +964,7 @@ fbCompositeSolid_nx0565mmx (pixman_operator_t op,
CHECKPOINT();
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
if (src >> 24 == 0)
return;
@@ -1049,7 +1049,7 @@ fbCompositeSolidMask_nx8888x8888Cmmx (pixman_operator_t op,
CHECKPOINT();
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
srca = src >> 24;
if (srca == 0)
@@ -1424,7 +1424,7 @@ fbCompositeSolidMask_nx8x8888mmx (pixman_operator_t op,
CHECKPOINT();
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
srca = src >> 24;
if (srca == 0)
@@ -1539,7 +1539,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_operator_t op,
CHECKPOINT();
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
srca = src >> 24;
if (srca == 0)
@@ -1670,7 +1670,7 @@ fbCompositeSolidMask_nx8x0565mmx (pixman_operator_t op,
CHECKPOINT();
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
srca = src >> 24;
if (srca == 0)
@@ -2011,7 +2011,7 @@ fbCompositeSolidMask_nx8888x0565Cmmx (pixman_operator_t op,
CHECKPOINT();
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
srca = src >> 24;
if (srca == 0)
diff --git a/pixman/src/fbpict.c b/pixman/src/fbpict.c
index 4c10bc994..27f256620 100644
--- a/pixman/src/fbpict.c
+++ b/pixman/src/fbpict.c
@@ -1,5 +1,5 @@
/*
- * $Id: fbpict.c,v 1.5 2005-08-28 02:32:57 vektor Exp $
+ * $Id: fbpict.c,v 1.5.2.1 2005-09-16 13:43:41 otaylor Exp $
*
* Copyright © 2000 SuSE, Inc.
*
@@ -169,7 +169,7 @@ fbCompositeSolidMask_nx8x8888 (pixman_operator_t op,
FbStride dstStride, maskStride;
CARD16 w;
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
dstMask = FbFullMask (pDst->pDrawable->depth);
srca = src >> 24;
@@ -228,7 +228,7 @@ fbCompositeSolidMask_nx8888x8888C (pixman_operator_t op,
CARD16 w;
CARD32 m, n, o, p;
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
dstMask = FbFullMask (pDst->pDrawable->depth);
srca = src >> 24;
@@ -302,7 +302,7 @@ fbCompositeSolidMask_nx8x0888 (pixman_operator_t op,
CARD16 w;
CARD32 rs,gs,bs,rd,gd,bd;
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
srca = src >> 24;
srcia = 255-srca;
@@ -398,7 +398,7 @@ fbCompositeSolidMask_nx8x0565 (pixman_operator_t op,
FbStride dstStride, maskStride;
CARD16 w,src16;
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
if (src == 0)
return;
@@ -476,7 +476,7 @@ fbCompositeSolidMask_nx8888x0565 (pixman_operator_t op,
FbStride dstStride, maskStride;
CARD16 w, src16;
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
if (src == 0)
return;
@@ -555,7 +555,7 @@ fbCompositeSolidMask_nx8888x0565C (pixman_operator_t op,
CARD16 w;
CARD32 m, n, o;
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
srca = src >> 24;
if (src == 0)
@@ -926,7 +926,7 @@ fbCompositeSolidMask_nx1xn (pixman_operator_t op,
int maskXoff, maskYoff;
FbBits src;
- fbComposeGetSolid(pSrc, src);
+ fbComposeGetSolid(pSrc, pDst, src);
if ((src & 0xff000000) != 0xff000000)
{
@@ -1008,7 +1008,7 @@ fbCompositeTrans_0565xnx0565(pixman_operator_t op,
CARD16 s_16, d_16;
CARD32 s_32, d_32;
- fbComposeGetSolid (pMask, mask);
+ fbComposeGetSolid (pMask, pDst, mask);
maskAlpha = mask >> 27;
if (!maskAlpha)
@@ -1110,7 +1110,7 @@ fbCompositeTrans_0888xnx0888(pixman_operator_t op,
FbBits mask;
CARD16 maskAlpha,maskiAlpha;
- fbComposeGetSolid (pMask, mask);
+ fbComposeGetSolid (pMask, pDst, mask);
maskAlpha = mask >> 24;
maskiAlpha= 255-maskAlpha;
diff --git a/pixman/src/fbpict.h b/pixman/src/fbpict.h
index 539cb6911..a6d2c15a8 100644
--- a/pixman/src/fbpict.h
+++ b/pixman/src/fbpict.h
@@ -1,5 +1,5 @@
/*
- * $Id: fbpict.h,v 1.1 2005-08-11 04:10:13 vektor Exp $
+ * $Id: fbpict.h,v 1.1.4.1 2005-09-16 13:43:41 otaylor Exp $
*
* Copyright © 2000 Keith Packard
* 2005 Lars Knoll & Zack Rusin, Trolltech
@@ -67,7 +67,9 @@
#define Green(x) (((x) >> 8) & 0xff)
#define Blue(x) ((x) & 0xff)
-#define fbComposeGetSolid(pict, bits) { \
+#define IsRGB(pict) ((pict)->image_format.red > (pict)->image_format.blue)
+
+#define fbComposeGetSolid(pict, dest, bits) { \
FbBits *__bits__; \
FbStride __stride__; \
int __bpp__; \
@@ -99,6 +101,12 @@
/* manage missing src alpha */ \
if ((pict)->image_format.alphaMask == 0) \
(bits) |= 0xff000000; \
+ /* Handle RGB/BGR mismatch */ \
+ if (dest && IsRGB(dest) != IsRGB(pict)) \
+ bits = (((bits & 0xff000000)) | \
+ ((bits & 0x00ff0000) >> 16) | \
+ ((bits & 0x0000ff00)) | \
+ ((bits & 0x000000ff) << 16)); \
}
#define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\