win32u: Return -1 for NUMCOLORS with 8-bit display DCs.
According to tests, GetDeviceCaps(NUMCOLORS) returns -1 for display DCs when the current display mode is 8-bit on newer versions of Windows, which makes sense because lower bit depth display modes are actually emulated with 32-bit modes. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52679 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:
parent
bfed433024
commit
a1dda8c376
|
@ -3,6 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2005 Huw Davies
|
* Copyright 2005 Huw Davies
|
||||||
* Copyright 2008 Dmitry Timoshkov
|
* Copyright 2008 Dmitry Timoshkov
|
||||||
|
* Copyright 2019-2022 Zhiyi Zhang for CodeWeavers
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -2314,7 +2315,6 @@ static void test_display_dc(void)
|
||||||
|
|
||||||
value = GetDeviceCaps(hdc, NUMCOLORS);
|
value = GetDeviceCaps(hdc, NUMCOLORS);
|
||||||
if (bpps[i] > 8 || (bpps[i] == 8 && LOBYTE(LOWORD(GetVersion())) >= 6))
|
if (bpps[i] > 8 || (bpps[i] == 8 && LOBYTE(LOWORD(GetVersion())) >= 6))
|
||||||
todo_wine_if(bpps[i] == 8 && LOBYTE(LOWORD(GetVersion())) >= 6)
|
|
||||||
ok(value == -1, "Expected -1, got %d.\n", value);
|
ok(value == -1, "Expected -1, got %d.\n", value);
|
||||||
else if (bpps[i] == 8 && LOBYTE(LOWORD(GetVersion())) < 6)
|
else if (bpps[i] == 8 && LOBYTE(LOWORD(GetVersion())) < 6)
|
||||||
ok(value > 16 && value <= 256, "Got %d.\n", value);
|
ok(value > 16 && value <= 256, "Got %d.\n", value);
|
||||||
|
|
|
@ -294,7 +294,8 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
|
||||||
case LOGPIXELSY: return get_system_dpi();
|
case LOGPIXELSY: return get_system_dpi();
|
||||||
case NUMCOLORS:
|
case NUMCOLORS:
|
||||||
bpp = NtGdiGetDeviceCaps( dev->hdc, BITSPIXEL );
|
bpp = NtGdiGetDeviceCaps( dev->hdc, BITSPIXEL );
|
||||||
return (bpp > 8) ? -1 : (1 << bpp);
|
/* Newer versions of Windows return -1 for 8-bit and higher */
|
||||||
|
return (bpp > 4) ? -1 : (1 << bpp);
|
||||||
case COLORRES:
|
case COLORRES:
|
||||||
/* The observed correspondence between BITSPIXEL and COLORRES is:
|
/* The observed correspondence between BITSPIXEL and COLORRES is:
|
||||||
* BITSPIXEL: 8 -> COLORRES: 18
|
* BITSPIXEL: 8 -> COLORRES: 18
|
||||||
|
|
Loading…
Reference in New Issue