mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 14:40:50 +00:00
gdi32: Use NtGdiGetRandomRgn for GetClipRgn.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f95687c510
commit
8217ce0fef
|
@ -392,31 +392,6 @@ INT WINAPI NtGdiGetAppClipBox( HDC hdc, RECT *rect )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetClipRgn (GDI32.@)
|
||||
*/
|
||||
INT WINAPI GetClipRgn( HDC hdc, HRGN hRgn )
|
||||
{
|
||||
INT ret = -1;
|
||||
DC * dc;
|
||||
if ((dc = get_dc_ptr( hdc )))
|
||||
{
|
||||
if( dc->hClipRgn )
|
||||
{
|
||||
if (NtGdiCombineRgn( hRgn, dc->hClipRgn, 0, RGN_COPY ) != ERROR)
|
||||
{
|
||||
ret = 1;
|
||||
if (dc->attr->layout & LAYOUT_RTL)
|
||||
mirror_region( hRgn, hRgn, dc->attr->vis_rect.right - dc->attr->vis_rect.left );
|
||||
}
|
||||
}
|
||||
else ret = 0;
|
||||
release_dc_ptr( dc );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetMetaRgn (GDI32.@)
|
||||
*/
|
||||
|
@ -460,11 +435,11 @@ INT WINAPI NtGdiGetRandomRgn( HDC hDC, HRGN hRgn, INT iCode )
|
|||
|
||||
if (!dc) return -1;
|
||||
|
||||
switch (iCode)
|
||||
switch (iCode & ~NTGDI_RGN_MIRROR_RTL)
|
||||
{
|
||||
case 1:
|
||||
if (dc->hClipRgn) NtGdiCombineRgn( hRgn, dc->hClipRgn, 0, RGN_COPY );
|
||||
else ret = 0;
|
||||
if (!dc->hClipRgn) ret = 0;
|
||||
else if (!NtGdiCombineRgn( hRgn, dc->hClipRgn, 0, RGN_COPY )) ret = -1;
|
||||
break;
|
||||
case 2:
|
||||
if (dc->hMetaRgn) NtGdiCombineRgn( hRgn, dc->hMetaRgn, 0, RGN_COPY );
|
||||
|
@ -496,6 +471,11 @@ INT WINAPI NtGdiGetRandomRgn( HDC hDC, HRGN hRgn, INT iCode )
|
|||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Wine extension */
|
||||
if (ret > 0 && (iCode & NTGDI_RGN_MIRROR_RTL) && (dc->attr->layout & LAYOUT_RTL))
|
||||
mirror_region( hRgn, hRgn, dc->attr->vis_rect.right - dc->attr->vis_rect.left );
|
||||
|
||||
release_dc_ptr( dc );
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1633,6 +1633,14 @@ BOOL WINAPI SelectClipPath( HDC hdc, INT mode )
|
|||
return NtGdiSelectClipPath( hdc, mode );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetClipRgn (GDI32.@)
|
||||
*/
|
||||
INT WINAPI GetClipRgn( HDC hdc, HRGN rgn )
|
||||
{
|
||||
return NtGdiGetRandomRgn( hdc, rgn, NTGDI_RGN_MIRROR_RTL | 1 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* IntersectClipRect (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -42,6 +42,8 @@ static void test_GetRandomRgn(void)
|
|||
|
||||
ret = GetRandomRgn(hdc, hrgn, 1);
|
||||
ok(ret == 0, "GetRandomRgn rets %d\n", ret);
|
||||
ret = GetRandomRgn(hdc, NULL, 1);
|
||||
ok(ret == 0, "GetRandomRgn rets %d\n", ret);
|
||||
ret = GetRandomRgn(hdc, hrgn, 2);
|
||||
ok(ret == 0, "GetRandomRgn rets %d\n", ret);
|
||||
ret = GetRandomRgn(hdc, hrgn, 3);
|
||||
|
@ -84,10 +86,13 @@ static void test_GetRandomRgn(void)
|
|||
IntersectClipRect(hdc, rc2.left, rc2.top, rc2.right, rc2.bottom);
|
||||
|
||||
ret = GetRandomRgn(hdc, hrgn, 1);
|
||||
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
|
||||
ok(ret > 0, "GetRandomRgn rets %d\n", ret);
|
||||
GetRgnBox(hrgn, &ret_rc);
|
||||
ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
|
||||
|
||||
ret = GetRandomRgn(hdc, NULL, 1);
|
||||
ok(ret == -1, "GetRandomRgn rets %d\n", ret);
|
||||
|
||||
ret = GetRandomRgn(hdc, hrgn, 2);
|
||||
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
|
||||
GetRgnBox(hrgn, &ret_rc);
|
||||
|
|
|
@ -178,6 +178,9 @@ struct font_enum_entry
|
|||
NEWTEXTMETRICEXW tm;
|
||||
};
|
||||
|
||||
/* flag for NtGdiGetRandomRgn to respect LAYOUT_RTL */
|
||||
#define NTGDI_RGN_MIRROR_RTL 0x80000000
|
||||
|
||||
#endif /* __WINESRC__ */
|
||||
|
||||
struct font_realization_info
|
||||
|
|
Loading…
Reference in a new issue