GetRandomRgn(...,1) returns the current clipping rgn.

Moved GetRandomRgn and the MetaRgn functions to objects/clipping.c.
This commit is contained in:
Huw Davies 2003-05-19 19:03:19 +00:00 committed by Alexandre Julliard
parent 040b3e1da5
commit fa28b5eac2
3 changed files with 80 additions and 69 deletions

View file

@ -1479,6 +1479,9 @@ typedef struct tagEXTLOGPEN
#define RGN_COPY 5
#define RGN_MIN RGN_AND
#define RGN_MAX RGN_COPY
#define SYSRGN 4
/* Device contexts */
/* Polygon modes */

View file

@ -497,3 +497,77 @@ INT16 WINAPI RestoreVisRgn16( HDC16 hdc16 )
GDI_ReleaseObj( hdc );
return ret;
}
/***********************************************************************
* GetRandomRgn [GDI32.@]
*
* NOTES
* This function is documented in MSDN online for the case of
* dwCode == SYSRGN (4).
*
* For dwCode == 1 it should return the clip region
* 2 " " " the meta region
* 3 " " " the intersection of the clip with
* the meta region (== 'Rao' region).
*
* See http://www.codeproject.com/gdi/cliprgnguide.asp
*/
INT WINAPI GetRandomRgn(HDC hDC, HRGN hRgn, DWORD dwCode)
{
switch (dwCode)
{
case SYSRGN: /* == 4 */
{
DC *dc = DC_GetDCPtr (hDC);
if (!dc) return -1;
CombineRgn (hRgn, dc->hVisRgn, 0, RGN_COPY);
GDI_ReleaseObj( hDC );
/*
* On Windows NT/2000,
* the region returned is in screen coordinates.
* On Windows 95/98,
* the region returned is in window coordinates
*/
if (!(GetVersion() & 0x80000000))
{
POINT org;
GetDCOrgEx(hDC, &org);
OffsetRgn(hRgn, org.x, org.y);
}
return 1;
}
case 1: /* clip region */
return GetClipRgn (hDC, hRgn);
default:
WARN("Unknown dwCode %ld\n", dwCode);
return -1;
}
return -1;
}
/***********************************************************************
* GetMetaRgn (GDI32.@)
*/
INT WINAPI GetMetaRgn( HDC hdc, HRGN hRgn )
{
FIXME( "stub\n" );
return 0;
}
/***********************************************************************
* SetMetaRgn (GDI32.@)
*/
INT WINAPI SetMetaRgn( HDC hdc )
{
FIXME( "stub\n" );
return ERROR;
}

View file

@ -600,11 +600,12 @@ INT WINAPI GetRgnBox( HRGN hrgn, LPRECT rect )
if (obj)
{
INT ret;
TRACE(" %p\n", hrgn );
rect->left = obj->rgn->extents.left;
rect->top = obj->rgn->extents.top;
rect->right = obj->rgn->extents.right;
rect->bottom = obj->rgn->extents.bottom;
TRACE("%p (%ld,%ld-%ld,%ld)\n", hrgn,
rect->left, rect->top, rect->right, rect->bottom);
ret = get_region_type( obj );
GDI_ReleaseObj(hrgn);
return ret;
@ -624,7 +625,7 @@ HRGN WINAPI CreateRectRgn(INT left, INT top, INT right, INT bottom)
if (!(hrgn = REGION_CreateRegion(RGN_DEFAULT_RECTS)))
return 0;
TRACE("\n");
TRACE("%d,%d-%d,%d\n", left, top, right, bottom);
SetRectRgn(hrgn, left, top, right, bottom);
return hrgn;
}
@ -2706,70 +2707,3 @@ HRGN WINAPI CreatePolygonRgn( const POINT *points, INT count,
{
return CreatePolyPolygonRgn( points, &count, 1, mode );
}
/***********************************************************************
* GetRandomRgn [GDI32.@]
*
* NOTES
* This function is documented in MSDN online
*/
INT WINAPI GetRandomRgn(HDC hDC, HRGN hRgn, DWORD dwCode)
{
switch (dwCode)
{
case 4: /* == SYSRGN ? */
{
DC *dc = DC_GetDCPtr (hDC);
OSVERSIONINFOA vi;
POINT org;
if (!dc) return -1;
CombineRgn (hRgn, dc->hVisRgn, 0, RGN_COPY);
/*
* On Windows NT/2000,
* the region returned is in screen coordinates.
* On Windows 95/98,
* the region returned is in window coordinates
*/
vi.dwOSVersionInfoSize = sizeof(vi);
if (GetVersionExA( &vi ) && vi.dwPlatformId == VER_PLATFORM_WIN32_NT)
GetDCOrgEx(hDC, &org);
else
org.x = org.y = 0;
OffsetRgn (hRgn, org.x, org.y);
GDI_ReleaseObj( hDC );
return 1;
}
/* case 1:
return GetClipRgn (hDC, hRgn);
*/
default:
WARN("Unknown dwCode %ld\n", dwCode);
return -1;
}
return -1;
}
/***********************************************************************
* GetMetaRgn (GDI32.@)
*/
INT WINAPI GetMetaRgn( HDC hdc, HRGN hRgn )
{
FIXME( "stub\n" );
return 0;
}
/***********************************************************************
* SetMetaRgn (GDI32.@)
*/
INT WINAPI SetMetaRgn( HDC hdc )
{
FIXME( "stub\n" );
return ERROR;
}