gdi32: Introduce NtGdiExtCreateRegion.

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:
Jacek Caban 2021-07-07 15:02:26 +02:00 committed by Alexandre Julliard
parent 18e9da8a8d
commit 94876d81ce
2 changed files with 22 additions and 12 deletions

View File

@ -235,3 +235,19 @@ HBITMAP WINAPI CreateDiscardableBitmap( HDC hdc, INT width, INT height )
{ {
return CreateCompatibleBitmap( hdc, width, height ); return CreateCompatibleBitmap( hdc, width, height );
} }
/***********************************************************************
* ExtCreateRegion (GDI32.@)
*
* Creates a region as specified by the transformation data and region data.
*/
HRGN WINAPI ExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA *data )
{
if (!data)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
return NtGdiExtCreateRegion( xform, count, data );
}

View File

@ -920,7 +920,7 @@ static void translate( POINT *pt, UINT count, const XFORM *xform )
/*********************************************************************** /***********************************************************************
* ExtCreateRegion (GDI32.@) * NtGdiExtCreateRegion (win32u.@)
* *
* Creates a region as specified by the transformation data and region data. * Creates a region as specified by the transformation data and region data.
* *
@ -936,26 +936,20 @@ static void translate( POINT *pt, UINT count, const XFORM *xform )
* NOTES * NOTES
* See GetRegionData(). * See GetRegionData().
*/ */
HRGN WINAPI ExtCreateRegion( const XFORM* lpXform, DWORD dwCount, const RGNDATA* rgndata) HRGN WINAPI NtGdiExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA *rgndata )
{ {
HRGN hrgn = 0; HRGN hrgn = 0;
WINEREGION *obj; WINEREGION *obj;
const RECT *pCurRect, *pEndRect; const RECT *pCurRect, *pEndRect;
if (!rgndata) if (!rgndata || rgndata->rdh.dwSize < sizeof(RGNDATAHEADER))
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
if (rgndata->rdh.dwSize < sizeof(RGNDATAHEADER))
return 0; return 0;
/* XP doesn't care about the type */ /* XP doesn't care about the type */
if( rgndata->rdh.iType != RDH_RECTANGLES ) if( rgndata->rdh.iType != RDH_RECTANGLES )
WARN("(Unsupported region data type: %u)\n", rgndata->rdh.iType); WARN("(Unsupported region data type: %u)\n", rgndata->rdh.iType);
if (lpXform) if (xform)
{ {
const RECT *pCurRect, *pEndRect; const RECT *pCurRect, *pEndRect;
@ -977,7 +971,7 @@ HRGN WINAPI ExtCreateRegion( const XFORM* lpXform, DWORD dwCount, const RGNDATA*
pt[3].x = pCurRect->left; pt[3].x = pCurRect->left;
pt[3].y = pCurRect->bottom; pt[3].y = pCurRect->bottom;
translate( pt, 4, lpXform ); translate( pt, 4, xform );
poly_hrgn = CreatePolyPolygonRgn( pt, &count, 1, WINDING ); poly_hrgn = CreatePolyPolygonRgn( pt, &count, 1, WINDING );
CombineRgn( hrgn, hrgn, poly_hrgn, RGN_OR ); CombineRgn( hrgn, hrgn, poly_hrgn, RGN_OR );
DeleteObject( poly_hrgn ); DeleteObject( poly_hrgn );
@ -1000,7 +994,7 @@ HRGN WINAPI ExtCreateRegion( const XFORM* lpXform, DWORD dwCount, const RGNDATA*
done: done:
if (!hrgn) free_region( obj ); if (!hrgn) free_region( obj );
TRACE("%p %d %p returning %p\n", lpXform, dwCount, rgndata, hrgn ); TRACE("%p %d %p returning %p\n", xform, count, rgndata, hrgn );
return hrgn; return hrgn;
} }