gdi32: Implement MirrorRgn.

This commit is contained in:
Alexandre Julliard 2010-09-27 20:45:56 +02:00
parent 440cf085e4
commit 97611dca8b
4 changed files with 41 additions and 3 deletions

View File

@ -363,7 +363,7 @@
@ stub LoadImageColorMatcherA
@ stub LoadImageColorMatcherW
@ stdcall MaskBlt(long long long long long long long long long long long long)
# @ stub MirrorRgn
@ stdcall MirrorRgn(long long)
@ stdcall ModifyWorldTransform(long ptr long)
@ stdcall MoveToEx(long long long ptr)
@ stdcall NamedEscape(long wstr long long ptr long ptr)

View File

@ -1515,6 +1515,27 @@ INT mirror_region( HRGN dst, HRGN src, INT width )
return ret;
}
/***********************************************************************
* MirrorRgn (GDI32.@)
*/
BOOL WINAPI MirrorRgn( HWND hwnd, HRGN hrgn )
{
static const WCHAR user32W[] = {'u','s','e','r','3','2','.','d','l','l',0};
static BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
RECT rect;
/* yes, a HWND in gdi32, don't ask */
if (!pGetWindowRect)
{
HMODULE user32 = GetModuleHandleW(user32W);
if (!user32) return FALSE;
if (!(pGetWindowRect = (void *)GetProcAddress( user32, "GetWindowRect" ))) return FALSE;
}
pGetWindowRect( hwnd, &rect );
return mirror_region( hrgn, hrgn, rect.right - rect.left ) != ERROR;
}
/***********************************************************************
* REGION_Coalesce
*

View File

@ -58,6 +58,7 @@ static BOOL (WINAPI *pGetProcessDefaultLayout)( DWORD *layout );
static BOOL (WINAPI *pSetProcessDefaultLayout)( DWORD layout );
static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
static DWORD (WINAPI *pGetLayout)(HDC hdc);
static BOOL (WINAPI *pMirrorRgn)(HWND hwnd, HRGN hrgn);
static BOOL test_lbuttondown_flag;
static HWND hwndMessage;
@ -6126,7 +6127,7 @@ static void test_winregion(void)
{
HWND hwnd;
RECT r;
int ret;
int ret, width;
HRGN hrgn;
if (!pGetWindowRgnBox)
@ -6159,7 +6160,21 @@ static void test_winregion(void)
ok( r.left == 2 && r.top == 3 && r.right == 10 && r.bottom == 15,
"Expected (2,3,10,15), got (%d,%d,%d,%d)\n", r.left, r.top,
r.right, r.bottom);
DeleteObject(hrgn);
if (pMirrorRgn)
{
hrgn = CreateRectRgn(2, 3, 10, 15);
ret = pMirrorRgn( hwnd, hrgn );
ok( ret == TRUE, "MirrorRgn failed %u\n", ret );
r.left = r.top = r.right = r.bottom = 0;
GetWindowRect( hwnd, &r );
width = r.right - r.left;
r.left = r.top = r.right = r.bottom = 0;
ret = GetRgnBox( hrgn, &r );
ok( ret == SIMPLEREGION, "GetRgnBox failed %u\n", ret );
ok( r.left == width - 10 && r.top == 3 && r.right == width - 2 && r.bottom == 15,
"Wrong rectangle (%d,%d,%d,%d) for width %d\n", r.left, r.top, r.right, r.bottom, width );
}
else win_skip( "MirrorRgn not supported\n" );
}
DestroyWindow(hwnd);
}
@ -6220,6 +6235,7 @@ START_TEST(win)
pSetProcessDefaultLayout = (void *)GetProcAddress( user32, "SetProcessDefaultLayout" );
pGetLayout = (void *)GetProcAddress( gdi32, "GetLayout" );
pSetLayout = (void *)GetProcAddress( gdi32, "SetLayout" );
pMirrorRgn = (void *)GetProcAddress( gdi32, "MirrorRgn" );
if (!RegisterWindowClasses()) assert(0);

View File

@ -3601,6 +3601,7 @@ WINGDIAPI BOOL WINAPI LineDDA(INT,INT,INT,INT,LINEDDAPROC,LPARAM);
WINGDIAPI BOOL WINAPI LineTo(HDC,INT,INT);
WINGDIAPI BOOL WINAPI LPtoDP(HDC,LPPOINT,INT);
WINGDIAPI BOOL WINAPI MaskBlt(HDC,INT,INT,INT,INT,HDC,INT,INT,HBITMAP,INT,INT,DWORD);
WINGDIAPI BOOL WINAPI MirrorRgn(HWND,HRGN);
WINGDIAPI BOOL WINAPI ModifyWorldTransform(HDC,const XFORM *, DWORD);
WINGDIAPI BOOL WINAPI MoveToEx(HDC,INT,INT,LPPOINT);
WINGDIAPI INT WINAPI OffsetClipRgn(HDC,INT,INT);