Commit e8a1a232 authored by Alexandre Julliard's avatar Alexandre Julliard

A few fixes in ExtSelectClipRgn metafile functions.

parent 284bcfcf
......@@ -134,11 +134,16 @@ INT EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
DWORD size, rgnsize;
BOOL ret;
rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(*emr) - 1;
if (!hrgn)
{
if (mode != RGN_COPY) return ERROR;
rgnsize = 0;
}
else rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
if (rgnsize) GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
emr->emr.iType = EMR_EXTSELECTCLIPRGN;
emr->emr.nSize = size;
......
......@@ -490,7 +490,7 @@ BOOL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
if(!index) return FALSE;
rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRFILLRGN) - 1;
size = rgnsize + offsetof(EMRFILLRGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
......@@ -523,7 +523,7 @@ BOOL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT heig
if(!index) return FALSE;
rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRFRAMERGN) - 1;
size = rgnsize + offsetof(EMRFRAMERGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
......@@ -559,7 +559,7 @@ static BOOL EMFDRV_PaintInvertRgn( PHYSDEV dev, HRGN hrgn, DWORD iType )
rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRINVERTRGN) - 1;
size = rgnsize + offsetof(EMRINVERTRGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
......
......@@ -237,7 +237,7 @@ static INT16 MFDRV_CreateRegion(PHYSDEV dev, HRGN hrgn)
WORD *Param, *StartBand;
BOOL ret;
len = GetRegionData( hrgn, 0, NULL );
if (!(len = GetRegionData( hrgn, 0, NULL ))) return -1;
if( !(rgndata = HeapAlloc( GetProcessHeap(), 0, len )) ) {
WARN("Can't alloc rgndata buffer\n");
return -1;
......@@ -376,16 +376,15 @@ MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y )
INT MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
{
INT16 iRgn;
INT ret;
if (mode != RGN_COPY)
{
FIXME( "mode %d not supported\n", mode );
return ERROR;
}
if (mode != RGN_COPY) return ERROR;
if (!hrgn) return NULLREGION;
iRgn = MFDRV_CreateRegion( dev, hrgn );
if(iRgn == -1)
return ERROR;
return MFDRV_MetaParam1( dev, META_SELECTCLIPREGION, iRgn ) ? SIMPLEREGION : ERROR;
if(iRgn == -1) return ERROR;
ret = MFDRV_MetaParam1( dev, META_SELECTCLIPREGION, iRgn ) ? NULLREGION : ERROR;
MFDRV_MetaParam1( dev, META_DELETEOBJECT, iRgn );
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment