[PATCH 3/4] gdi32: Make EMFDRV_StretchBlt() compatible with display drivers.

Huw Davies huw at codeweavers.com
Mon May 24 03:09:32 CDT 2021


On Mon, May 17, 2021 at 05:00:21PM +0800, Zhiyi Zhang wrote:

The commit msg could be a bit better.  Prehaps "gdi32: Use a common helper for StretchBlt and AlphaBlend"?

> Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
> ---
>  dlls/gdi32/enhmfdrv/bitblt.c | 121 +++++------------------------------
>  dlls/gdi32/tests/metafile.c  |  29 ++++-----
>  2 files changed, 27 insertions(+), 123 deletions(-)
> 
> diff --git a/dlls/gdi32/enhmfdrv/bitblt.c b/dlls/gdi32/enhmfdrv/bitblt.c
> index 597a6110abd..0fa6226ebaa 100644
> --- a/dlls/gdi32/enhmfdrv/bitblt.c
> +++ b/dlls/gdi32/enhmfdrv/bitblt.c
> @@ -27,14 +27,15 @@
>  #include "enhmetafiledrv.h"
>  #include "wine/debug.h"
>  
> -BOOL CDECL EMFDRV_AlphaBlend( PHYSDEV dev_dst, struct bitblt_coords *dst,
> -                              PHYSDEV dev_src, struct bitblt_coords *src, BLENDFUNCTION func )
> +/* Generate an EMRSTRETCHBLT or EMRALPHABLEND record depending on the alpha_blend parameter */
> +static BOOL emfdrv_stretchblt( PHYSDEV dev_dst, struct bitblt_coords *dst, PHYSDEV dev_src,
> +                               struct bitblt_coords *src, DWORD rop, BOOL alpha_blend )

I would change the final param to be DWORD type (i.e. explicitly pass EMR_STRETCHBLT/ALPHABLEND).

> @@ -155,106 +163,7 @@ BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
>  BOOL CDECL EMFDRV_StretchBlt( PHYSDEV devDst, struct bitblt_coords *dst,
>                                PHYSDEV devSrc, struct bitblt_coords *src, DWORD rop )
>  {
> -    BOOL ret;
> -    PEMRBITBLT pEMR;
> -    UINT emrSize;
> -    UINT bmiSize;
> -    UINT bitsSize;
> -    UINT size;
> -    BITMAP  BM;
> -    WORD nBPP = 0;
> -    LPBITMAPINFOHEADER lpBmiH;
> -    HBITMAP hBitmap = NULL;
> -    DWORD emrType;
> -
> -    if (devSrc->funcs == devDst->funcs) return FALSE;  /* can't use a metafile DC as source */
> -
> -    if (src->log_width == dst->log_width && src->log_height == dst->log_height)
> -    {
> -        emrType = EMR_BITBLT;
> -        emrSize = sizeof(EMRBITBLT);
> -    }
> -    else
> -    {
> -        emrType = EMR_STRETCHBLT;
> -        emrSize = sizeof(EMRSTRETCHBLT);
> -    }

Presumably calls to BitBlt() get encoded as EMR_BITBLT (even if non-stretch
StretchBlt()s don't).  Assuming that's the case, I think it would make sense
to retain what we did here and use EMR_BITBLT where we can (another reason
for passing the type to the helper function).

Huw.



More information about the wine-devel mailing list