win32u: Allow selecting 32-bit DDBs into display compatible DCs.

Device context bit depths other than 32-bit are emulated and the real bit depth for display DCs is
still 32-bit. Thus, a 32-bit DDB should be allowed to be selected into a display compatible DC even
if the DC reports a different bit depth.

Fix a regression from d171d11.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51805
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-12-29 15:32:52 +08:00 committed by Alexandre Julliard
parent bd0603b19d
commit 60faf44ed1
2 changed files with 3 additions and 3 deletions

View File

@ -2301,7 +2301,6 @@ static void test_display_dc(void)
bpp = GetDeviceCaps(mem_dc, BITSPIXEL);
ok(bpp == dm2.dmBitsPerPel, "Expected bpp %d, got %d.\n", dm2.dmBitsPerPel, bpp);
old_hbitmap = SelectObject(mem_dc, hbitmap);
todo_wine
ok(!!old_hbitmap, "Failed to select bitmap.\n");
bpp = GetDeviceCaps(mem_dc, BITSPIXEL);
ok(bpp == dm2.dmBitsPerPel, "Expected bpp %d, got %d.\n", dm2.dmBitsPerPel, bpp);
@ -2329,7 +2328,6 @@ static void test_display_dc(void)
ok(!old_hbitmap || broken(!!old_hbitmap) /* Win7 dual-QXL test bot and XP */,
"Selecting bitmap succeeded.\n");
else
todo_wine_if(bpps[i] == 32)
ok(!!old_hbitmap || broken(!old_hbitmap) /* Win7 dual-QXL test bot and XP */,
"Failed to select bitmap.\n");

View File

@ -401,7 +401,9 @@ HGDIOBJ WINAPI NtGdiSelectBitmap( HDC hdc, HGDIOBJ handle )
if (!is_bitmapobj_dib( bitmap ) &&
bitmap->dib.dsBm.bmBitsPixel != 1 &&
bitmap->dib.dsBm.bmBitsPixel != NtGdiGetDeviceCaps( hdc, BITSPIXEL ))
bitmap->dib.dsBm.bmBitsPixel != NtGdiGetDeviceCaps( hdc, BITSPIXEL ) &&
/* Display compatible DCs should accept 32-bit DDBs because other color depths are emulated */
!(NtGdiGetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASDISPLAY && bitmap->dib.dsBm.bmBitsPixel == 32))
{
WARN( "Wrong format bitmap %u bpp\n", bitmap->dib.dsBm.bmBitsPixel );
GDI_ReleaseObj( handle );