Commit b762fcc9 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Clip the returned DC bounds to the device rectangle.

parent 5917bd39
...@@ -1318,6 +1318,10 @@ UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags) ...@@ -1318,6 +1318,10 @@ UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
{ {
*rect = dc->BoundsRect; *rect = dc->BoundsRect;
ret = is_rect_empty( rect ) ? DCB_RESET : DCB_SET; ret = is_rect_empty( rect ) ? DCB_RESET : DCB_SET;
rect->left = max( rect->left, 0 );
rect->top = max( rect->top, 0 );
rect->right = min( rect->right, dc->vis_rect.right - dc->vis_rect.left );
rect->bottom = min( rect->bottom, dc->vis_rect.bottom - dc->vis_rect.top );
DPtoLP( hdc, (POINT *)rect, 2 ); DPtoLP( hdc, (POINT *)rect, 2 );
} }
if (flags & DCB_RESET) if (flags & DCB_RESET)
......
...@@ -930,7 +930,6 @@ static void test_boundsrect(void) ...@@ -930,7 +930,6 @@ static void test_boundsrect(void)
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 1, 1 ); SetRect( &expect, 6, 6, 1, 1 );
todo_wine
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom ); ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
SetBoundsRect( hdc, NULL, DCB_ENABLE ); SetBoundsRect( hdc, NULL, DCB_ENABLE );
LineTo( hdc, 50, 40 ); LineTo( hdc, 50, 40 );
......
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