A few fixes in ExtSelectClipRgn metafile functions.

This commit is contained in:
Alexandre Julliard 2002-05-28 22:47:49 +00:00
parent 284bcfcff4
commit e8a1a232b6
3 changed files with 20 additions and 16 deletions

View File

@ -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;
emr = HeapAlloc( GetProcessHeap(), 0, size );
if (!hrgn)
{
if (mode != RGN_COPY) return ERROR;
rgnsize = 0;
}
else rgnsize = GetRegionData( hrgn, 0, NULL );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size );
if (rgnsize) GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
emr->emr.iType = EMR_EXTSELECTCLIPRGN;
emr->emr.nSize = size;

View File

@ -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 );

View File

@ -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;
}