[PATCH v2 4/4] gdi32: Return correct color depth for display DCs in GetDeviceCaps().
Alexandre Julliard
julliard at winehq.org
Mon May 17 13:34:55 CDT 2021
Zhiyi Zhang <zzhang at codeweavers.com> writes:
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29184
> Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
> ---
> dlls/gdi32/driver.c | 19 ++++++++++++++++++-
> dlls/user32/tests/monitor.c | 1 -
> dlls/winex11.drv/init.c | 2 --
> 3 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
> index a2ebd018bca..2042701dd45 100644
> --- a/dlls/gdi32/driver.c
> +++ b/dlls/gdi32/driver.c
> @@ -460,7 +460,24 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
>
> return pGetSystemMetrics ? pGetSystemMetrics( SM_CYSCREEN ) : 480;
> }
> - case BITSPIXEL: return 32;
> + case BITSPIXEL:
> + {
> + DEVMODEW devmode;
> + WCHAR *display;
> + DC *dc;
> +
> + if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pEnumDisplaySettingsW)
> + {
> + dc = get_nulldrv_dc( dev );
> + display = dc->display[0] ? dc->display : NULL;
> + memset( &devmode, 0, sizeof(devmode) );
> + devmode.dmSize = sizeof(devmode);
> + if (pEnumDisplaySettingsW( display, ENUM_CURRENT_SETTINGS, &devmode )
> + && devmode.dmFields & DM_BITSPERPEL && devmode.dmBitsPerPel)
> + return devmode.dmBitsPerPel;
> + }
Isn't this going to be too slow? GetDeviceCaps(BITSPIXEL) can be called
very frequently.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list