xorg-x11-server/u_fb-Correctly-implement-CopyArea-when-using-a-window-with-depth-32-and-24bpp.patch

45 lines
1.5 KiB
Diff
Raw Normal View History

From patchwork Fri Jun 6 11:52:13 2014
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: fb: Correctly implement CopyArea when using a window with depth 32
and 24bpp.
From: Robert Ancell <robert.ancell@canonical.com>
X-Patchwork-Id: 27263
Message-Id: <1402055533-9866-1-git-send-email-robert.ancell@canonical.com>
To: xorg-devel@lists.x.org
Cc: Robert Ancell <robert.ancell@canonical.com>
Date: Fri, 6 Jun 2014 23:52:13 +1200
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 +++++++++-
fb/fbcopy.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--- 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;