Module: wine Branch: master Commit: 97611dca8b2690a4e0cc4df73a481ee899e2e99c URL: http://source.winehq.org/git/wine.git/?a=commit;h=97611dca8b2690a4e0cc4df73a...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Sep 27 20:45:56 2010 +0200
gdi32: Implement MirrorRgn.
---
dlls/gdi32/gdi32.spec | 2 +- dlls/gdi32/region.c | 21 +++++++++++++++++++++ dlls/user32/tests/win.c | 20 ++++++++++++++++++-- include/wingdi.h | 1 + 4 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 2855206..4901e13 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -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) diff --git a/dlls/gdi32/region.c b/dlls/gdi32/region.c index 1f281c4..b37211f 100644 --- a/dlls/gdi32/region.c +++ b/dlls/gdi32/region.c @@ -1516,6 +1516,27 @@ INT mirror_region( HRGN dst, HRGN src, INT width ) }
/*********************************************************************** + * 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 * * Attempt to merge the rects in the current band with those in the diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index f34025f..f1f590c 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -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);
diff --git a/include/wingdi.h b/include/wingdi.h index fa68c23..e10bbe9 100644 --- a/include/wingdi.h +++ b/include/wingdi.h @@ -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);