gdi32: Fix GetClipBox return value for non-memory DCs.

This commit is contained in:
Alexandre Julliard 2012-04-09 15:13:31 +02:00
parent 8abb0ffadd
commit 1ca6ed7748
2 changed files with 26 additions and 3 deletions

View File

@ -409,7 +409,11 @@ INT WINAPI GetClipBox( HDC hdc, LPRECT rect )
if (get_dc_visrect( dc, &visrect ) && !intersect_rect( rect, rect, &visrect ))
ret = NULLREGION;
}
else ret = get_dc_visrect( dc, rect ) ? SIMPLEREGION : NULLREGION;
else
{
ret = is_rect_empty( &dc->vis_rect ) ? ERROR : SIMPLEREGION;
*rect = dc->vis_rect;
}
if (dc->layout & LAYOUT_RTL)
{

View File

@ -345,6 +345,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
unsigned int i;
WORD ramp[3][256];
BOOL ret;
RECT clip;
UINT type;
if (GetObjectType( hdc ) == OBJ_METADC)
{
@ -358,6 +360,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr );
ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
"wrong error %u on %s\n", GetLastError(), descr );
type = GetClipBox( hdc, &clip );
ok( type == ERROR, "GetClipBox returned %d on %s\n", type, descr );
}
else
{
@ -371,8 +375,17 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr );
ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
"wrong error %u on %s\n", GetLastError(), descr );
type = GetClipBox( hdc, &clip );
ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
}
type = GetClipBox( ref_dc, &clip );
ok( type == SIMPLEREGION, "GetClipBox returned %d on %s\n", type, descr );
ok( clip.left == 0 && clip.top == 0 &&
clip.right == GetDeviceCaps( ref_dc, DESKTOPHORZRES ) &&
clip.bottom == GetDeviceCaps( ref_dc, DESKTOPVERTRES ),
"GetClipBox returned %d,%d,%d,%d on %s\n", clip.left, clip.top, clip.right, clip.bottom, descr );
if (GetObjectType( hdc ) == OBJ_MEMDC)
{
char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
@ -400,6 +413,12 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
"wrong error %u on %s\n", GetLastError(), descr );
type = GetClipBox( hdc, &clip );
ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
ok( clip.left == 0 && clip.top == 0 && clip.right == 16 && clip.bottom == 16,
"GetClipBox returned %d,%d,%d,%d on memdc for %s\n",
clip.left, clip.top, clip.right, clip.bottom, descr );
SelectObject( hdc, old );
DeleteObject( dib );
}
@ -412,7 +431,7 @@ static void test_CreateCompatibleDC(void)
HBITMAP bitmap;
INT caps;
screen_dc = GetDC( 0 );
screen_dc = CreateDC( "DISPLAY", NULL, NULL, NULL );
bitmap = CreateBitmap( 10, 10, 1, 1, NULL );
/* Create a DC compatible with the screen */
@ -456,7 +475,7 @@ static void test_CreateCompatibleDC(void)
DeleteMetaFile( CloseMetaFile( hdcMetafile ));
DeleteObject( bitmap );
ReleaseDC( 0, screen_dc );
DeleteDC( screen_dc );
}
static void test_DC_bitmap(void)