Commit 19229020 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

win32u: Create a real bitmap object for display DCs.

TightVNC viewer passes the bitmap object from display DCs to GetDIBits() and expect it to succeed. So merely a bitmap handle no longer suffices. Thus create a real bitmap instead. Fix a regression from 546cbdc2. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54381
parent a47e2a5e
...@@ -2276,9 +2276,7 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_ ...@@ -2276,9 +2276,7 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_
/* Expect GetDIBits() to succeed */ /* Expect GetDIBits() to succeed */
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
value = GetDIBits(hdc, hbmp, 0, 0, NULL, (LPBITMAPINFO)bmi, DIB_RGB_COLORS); value = GetDIBits(hdc, hbmp, 0, 0, NULL, (LPBITMAPINFO)bmi, DIB_RGB_COLORS);
todo_wine
ok(value, "GetDIBits failed, error %#lx.\n", GetLastError()); ok(value, "GetDIBits failed, error %#lx.\n", GetLastError());
todo_wine
ok(bmi->bmiHeader.biCompression == BI_BITFIELDS, "Got unexpected biCompression %lu.\n", bmi->bmiHeader.biCompression); ok(bmi->bmiHeader.biCompression == BI_BITFIELDS, "Got unexpected biCompression %lu.\n", bmi->bmiHeader.biCompression);
ret = GetObjectA(hbmp, sizeof(bitmap), &bitmap); ret = GetObjectA(hbmp, sizeof(bitmap), &bitmap);
...@@ -2292,7 +2290,6 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_ ...@@ -2292,7 +2290,6 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_
todo_wine todo_wine
ok_(__FILE__, line)(bitmap.bmHeight == GetSystemMetrics(SM_CYVIRTUALSCREEN), ok_(__FILE__, line)(bitmap.bmHeight == GetSystemMetrics(SM_CYVIRTUALSCREEN),
"Expected bmHeight %d, got %d.\n", GetSystemMetrics(SM_CYVIRTUALSCREEN), bitmap.bmHeight); "Expected bmHeight %d, got %d.\n", GetSystemMetrics(SM_CYVIRTUALSCREEN), bitmap.bmHeight);
todo_wine
ok_(__FILE__, line)(bitmap.bmBitsPixel == 32, "Expected bmBitsPixel %d, got %d.\n", 32, ok_(__FILE__, line)(bitmap.bmBitsPixel == 32, "Expected bmBitsPixel %d, got %d.\n", 32,
bitmap.bmBitsPixel); bitmap.bmBitsPixel);
ok_(__FILE__, line)(bitmap.bmWidthBytes == get_bitmap_stride(bitmap.bmWidth, bitmap.bmBitsPixel), ok_(__FILE__, line)(bitmap.bmWidthBytes == get_bitmap_stride(bitmap.bmWidth, bitmap.bmBitsPixel),
......
...@@ -278,7 +278,7 @@ void free_dc_ptr( DC *dc ) ...@@ -278,7 +278,7 @@ void free_dc_ptr( DC *dc )
if (dc->hBitmap) if (dc->hBitmap)
{ {
if (dc->is_display) if (dc->is_display)
NtGdiDeleteClientObj( dc->hBitmap ); NtGdiDeleteObjectApp( dc->hBitmap );
else else
GDI_dec_ref_count( dc->hBitmap ); GDI_dec_ref_count( dc->hBitmap );
} }
...@@ -731,7 +731,7 @@ HDC WINAPI NtGdiOpenDCW( UNICODE_STRING *device, const DEVMODEW *devmode, UNICOD ...@@ -731,7 +731,7 @@ HDC WINAPI NtGdiOpenDCW( UNICODE_STRING *device, const DEVMODEW *devmode, UNICOD
hdc = dc->hSelf; hdc = dc->hSelf;
if (is_display) if (is_display)
dc->hBitmap = NtGdiCreateClientObj( NTGDI_OBJ_SURF ); dc->hBitmap = NtGdiCreateCompatibleBitmap( hdc, 1, 1 );
else else
dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP )); dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP ));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment