Alexandre Julliard : winex11: Force alpha channel to 0 when blitting to depth 32 from a lower depth.
Alexandre Julliard
julliard at winehq.org
Tue May 18 12:32:57 CDT 2010
Module: wine
Branch: master
Commit: ea596f8a5f7d732bb56b5921ceb964137df0b930
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ea596f8a5f7d732bb56b5921ceb964137df0b930
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue May 18 14:11:51 2010 +0200
winex11: Force alpha channel to 0 when blitting to depth 32 from a lower depth.
---
dlls/winex11.drv/xrender.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index d82cbf6..9678def 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -603,6 +603,32 @@ static Picture get_xrender_picture_source(X11DRV_PDEVICE *physDev, BOOL repeat)
return info->pict_src;
}
+/* return a mask picture used to force alpha to 0 */
+static Picture get_no_alpha_mask(void)
+{
+ static Pixmap pixmap;
+ static Picture pict;
+
+ wine_tsx11_lock();
+ if (!pict)
+ {
+ const WineXRenderFormat *fmt = get_xrender_format( WXR_FORMAT_A8R8G8B8 );
+ XRenderPictureAttributes pa;
+ XRenderColor col;
+
+ pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 32 );
+ pa.repeat = RepeatNormal;
+ pa.component_alpha = True;
+ pict = pXRenderCreatePicture( gdi_display, pixmap, fmt->pict_format,
+ CPRepeat|CPComponentAlpha, &pa );
+ col.red = col.green = col.blue = 0xffff;
+ col.alpha = 0;
+ pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &col, 0, 0, 1, 1 );
+ }
+ wine_tsx11_unlock();
+ return pict;
+}
+
static BOOL fontcmp(LFANDSIZE *p1, LFANDSIZE *p2)
{
if(p1->hash != p2->hash) return TRUE;
@@ -2285,6 +2311,7 @@ BOOL X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE
}
else /* color -> color (can be at different depths) or mono -> mono */
{
+ if (physDevDst->depth == 32 && physDevSrc->depth < 32) mask_pict = get_no_alpha_mask();
src_pict = get_xrender_picture_source( physDevSrc, use_repeat );
wine_tsx11_lock();
@@ -2292,7 +2319,8 @@ BOOL X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE
pixmap, dst_format->pict_format,
CPSubwindowMode|CPRepeat, &pa);
- xrender_blit(PictOpSrc, src_pict, 0, dst_pict, x_src, y_src, 0, 0, xscale, yscale, width, height);
+ xrender_blit(PictOpSrc, src_pict, mask_pict, dst_pict,
+ x_src, y_src, 0, 0, xscale, yscale, width, height);
if(dst_pict) pXRenderFreePicture(gdi_display, dst_pict);
wine_tsx11_unlock();
More information about the wine-cvs
mailing list