[PATCH] fb: Correctly implement CopyArea when using a window with depth 32 and 24bpp.

Robert Ancell robert.ancell at canonical.com
Fri Jun 6 04:52:13 PDT 2014


When using the fb backend at 24bpp it allows a visual with 32 bit depth.
When using CopyArea from a 32bpp pixmap to a window with a 32 bit depth it would
read the ARGB as RGB.

Fix is to correctly ignore the alpha channel in the pixmap when copying.
---
 fb/fbcopy.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 541ef71..5455947 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -242,8 +242,16 @@ fbCopyArea(DrawablePtr pSrcDrawable,
            int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut)
 {
     miCopyProc copy;
+    int src_bpp, dst_bpp;
 
-    if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
+    src_bpp = pSrcDrawable->bitsPerPixel;
+    if (src_bpp < pSrcDrawable->depth)
+        src_bpp = BitsPerPixel (pSrcDrawable->depth);
+    dst_bpp = pDstDrawable->bitsPerPixel;
+    if (dst_bpp < pDstDrawable->depth)
+        dst_bpp = BitsPerPixel (pDstDrawable->depth);
+
+    if (src_bpp != dst_bpp)
         copy = fb24_32CopyMtoN;
     else
         copy = fbCopyNtoN;
-- 
2.0.0



More information about the xorg-devel mailing list