Commit 76272e07 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Use BI_BITFIELDS to indicate that a 32-bpp DIB doesn't have an alpha channel.

parent 34b70728
......@@ -357,6 +357,7 @@ DWORD nulldrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_
BITMAPINFO *dst_info = (BITMAPINFO *)buffer;
struct gdi_image_bits dst_bits;
struct bitblt_coords orig_dst;
DWORD *masks = (DWORD *)info->bmiColors;
DC *dc = get_nulldrv_dc( dev );
DWORD err;
......@@ -364,7 +365,7 @@ DWORD nulldrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_
if (info->bmiHeader.biBitCount != 32) goto update_format;
if (info->bmiHeader.biCompression == BI_BITFIELDS)
{
DWORD *masks = (DWORD *)info->bmiColors;
if (blend.AlphaFormat & AC_SRC_ALPHA) return ERROR_INVALID_PARAMETER;
if (masks[0] != 0xff0000 || masks[1] != 0x00ff00 || masks[2] != 0x0000ff)
goto update_format;
}
......@@ -390,8 +391,11 @@ update_format:
info->bmiHeader.biPlanes = 1;
info->bmiHeader.biBitCount = 32;
info->bmiHeader.biCompression = BI_RGB;
info->bmiHeader.biCompression = BI_BITFIELDS;
info->bmiHeader.biClrUsed = 0;
masks[0] = 0xff0000;
masks[1] = 0x00ff00;
masks[2] = 0x0000ff;
return ERROR_BAD_FORMAT;
}
......
......@@ -1001,6 +1001,7 @@ DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_b
{
dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
dib_info src_dib;
DWORD *masks = (DWORD *)info->bmiColors;
TRACE( "%p %p\n", dev, info );
......@@ -1008,7 +1009,7 @@ DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_b
if (info->bmiHeader.biBitCount != 32) goto update_format;
if (info->bmiHeader.biCompression == BI_BITFIELDS)
{
DWORD *masks = (DWORD *)info->bmiColors;
if (blend.AlphaFormat & AC_SRC_ALPHA) return ERROR_INVALID_PARAMETER;
if (masks[0] != 0xff0000 || masks[1] != 0x00ff00 || masks[2] != 0x0000ff)
goto update_format;
}
......@@ -1027,8 +1028,11 @@ update_format:
info->bmiHeader.biPlanes = 1;
info->bmiHeader.biBitCount = 32;
info->bmiHeader.biCompression = BI_RGB;
info->bmiHeader.biCompression = BI_BITFIELDS;
info->bmiHeader.biClrUsed = 0;
masks[0] = 0xff0000;
masks[1] = 0x00ff00;
masks[2] = 0x0000ff;
return ERROR_BAD_FORMAT;
}
......
......@@ -760,6 +760,19 @@ static DWORD windrv_GetImage( PHYSDEV dev, BITMAPINFO *info,
lock_surface( physdev->surface );
dev = GET_NEXT_PHYSDEV( dev, pGetImage );
ret = dev->funcs->pGetImage( dev, info, bits, src );
/* don't return alpha if original surface doesn't support it */
if (info->bmiHeader.biBitCount == 32 &&
info->bmiHeader.biCompression == BI_RGB &&
physdev->dibdrv->dib.compression == BI_BITFIELDS)
{
DWORD *colors = (DWORD *)info->bmiColors;
colors[0] = 0xff0000;
colors[1] = 0x00ff00;
colors[2] = 0x0000ff;
info->bmiHeader.biCompression = BI_BITFIELDS;
}
if (!bits->is_copy)
{
/* use the freeing callback to unlock the surface */
......
......@@ -2077,7 +2077,7 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct
format = get_xrender_format_from_bitmapinfo( info );
if (!(func.AlphaFormat & AC_SRC_ALPHA))
format = get_format_without_alpha( format );
else if (format != WXR_FORMAT_A8R8G8B8)
else if (format != WXR_FORMAT_A8R8G8B8 || info->bmiHeader.biCompression != BI_RGB)
return ERROR_INVALID_PARAMETER;
if (!(pict_format = pict_formats[format])) goto update_format;
......
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