gdi32: Support wrongly ordered rectangles in RectVisible.

This commit is contained in:
Alexandre Julliard 2012-12-14 16:56:28 +01:00
parent 456b4c876e
commit 5215895a11
2 changed files with 17 additions and 0 deletions

View File

@ -392,6 +392,7 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
tmpRect = *rect;
LPtoDP( hdc, (POINT *)&tmpRect, 2 );
order_rect( &tmpRect );
update_dc( dc );
ret = (!get_dc_device_rect( dc, &visrect ) || intersect_rect( &visrect, &visrect, &tmpRect ));

View File

@ -401,6 +401,14 @@ static void test_memory_dc_clipping(void)
ok(rc.left == 0 && rc.top == 0 && rc.right == 100 && rc.bottom == 100,
"expected 0,0-100,100, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
SetRect( &rc, 10, 10, 20, 20 );
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
SetRect( &rc, 20, 20, 10, 10 );
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
DeleteDC(hdc);
DeleteObject(hrgn);
DeleteObject(hrgn_empty);
@ -446,6 +454,14 @@ static void test_window_dc_clipping(void)
"expected 0,0-%d,%d, got %d,%d-%d,%d\n", screen_width, screen_height,
rc.left, rc.top, rc.right, rc.bottom);
SetRect( &rc, 10, 10, 20, 20 );
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
SetRect( &rc, 20, 20, 10, 10 );
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
ret = ExtSelectClipRgn(hdc, 0, RGN_COPY);
ok(ret == SIMPLEREGION || (ret == COMPLEXREGION && GetSystemMetrics(SM_CMONITORS) > 1),
"expected SIMPLEREGION, got %d\n", ret);