Alexandre Julliard : gdi32: Use BI_BITFIELDS to indicate that a 32-bpp DIB doesn' t have an alpha channel.
Alexandre Julliard
julliard at winehq.org
Wed Oct 10 15:07:52 CDT 2012
Module: wine
Branch: master
Commit: 76272e077364d3d78ceaf8912e3bc22ff6a31a48
URL: http://source.winehq.org/git/wine.git/?a=commit;h=76272e077364d3d78ceaf8912e3bc22ff6a31a48
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Oct 10 17:08:05 2012 +0200
gdi32: Use BI_BITFIELDS to indicate that a 32-bpp DIB doesn't have an alpha channel.
---
dlls/gdi32/bitblt.c | 8 ++++++--
dlls/gdi32/dibdrv/bitblt.c | 8 ++++++--
dlls/gdi32/dibdrv/dc.c | 13 +++++++++++++
dlls/winex11.drv/xrender.c | 2 +-
4 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 151434f..ea6d8a7 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -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;
}
diff --git a/dlls/gdi32/dibdrv/bitblt.c b/dlls/gdi32/dibdrv/bitblt.c
index bcaa585..ccddac9 100644
--- a/dlls/gdi32/dibdrv/bitblt.c
+++ b/dlls/gdi32/dibdrv/bitblt.c
@@ -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;
}
diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 00e2229..0e68f80 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -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 */
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index bdb8865..d7f0508 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -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;
More information about the wine-cvs
mailing list