Commit ea596f8a authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Force alpha channel to 0 when blitting to depth 32 from a lower depth.

parent 31e4cf93
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment