gdi32: Return correct color depth for display DCs in GetDeviceCaps().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29184
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-05-31 16:12:44 +08:00 committed by Alexandre Julliard
parent d8e6d2e3d1
commit d171d11167
3 changed files with 18 additions and 4 deletions

View File

@ -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;
}
return 32;
}
case PLANES: return 1;
case NUMBRUSHES: return -1;
case NUMPENS: return -1;

View File

@ -2068,7 +2068,6 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_
dm->dmDisplayFrequency, value);
value = GetDeviceCaps(hdc, BITSPIXEL);
todo_wine_if(dm->dmBitsPerPel != 32)
ok_(__FILE__, line)(value == dm->dmBitsPerPel, "Expected BITSPIXEL %d, got %d.\n",
dm->dmBitsPerPel, value);

View File

@ -162,8 +162,6 @@ static INT CDECL X11DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
{
switch(cap)
{
case BITSPIXEL:
return screen_bpp;
case SIZEPALETTE:
return palette_size;
default: