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 ) ...@@ -134,11 +134,16 @@ INT EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
DWORD size, rgnsize; DWORD size, rgnsize;
BOOL ret; BOOL ret;
rgnsize = GetRegionData( hrgn, 0, NULL ); if (!hrgn)
size = rgnsize + sizeof(*emr) - 1; {
if (mode != RGN_COPY) return ERROR;
rgnsize = 0;
}
else rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
if (rgnsize) GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
emr->emr.iType = EMR_EXTSELECTCLIPRGN; emr->emr.iType = EMR_EXTSELECTCLIPRGN;
emr->emr.nSize = size; emr->emr.nSize = size;
......
...@@ -490,7 +490,7 @@ BOOL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) ...@@ -490,7 +490,7 @@ BOOL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
if(!index) return FALSE; if(!index) return FALSE;
rgnsize = GetRegionData( hrgn, 0, NULL ); rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRFILLRGN) - 1; size = rgnsize + offsetof(EMRFILLRGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData ); GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
...@@ -523,7 +523,7 @@ BOOL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT heig ...@@ -523,7 +523,7 @@ BOOL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT heig
if(!index) return FALSE; if(!index) return FALSE;
rgnsize = GetRegionData( hrgn, 0, NULL ); rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRFRAMERGN) - 1; size = rgnsize + offsetof(EMRFRAMERGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData ); GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
...@@ -559,7 +559,7 @@ static BOOL EMFDRV_PaintInvertRgn( PHYSDEV dev, HRGN hrgn, DWORD iType ) ...@@ -559,7 +559,7 @@ static BOOL EMFDRV_PaintInvertRgn( PHYSDEV dev, HRGN hrgn, DWORD iType )
rgnsize = GetRegionData( hrgn, 0, NULL ); rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRINVERTRGN) - 1; size = rgnsize + offsetof(EMRINVERTRGN,RgnData);
emr = HeapAlloc( GetProcessHeap(), 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData ); GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
......
...@@ -237,7 +237,7 @@ static INT16 MFDRV_CreateRegion(PHYSDEV dev, HRGN hrgn) ...@@ -237,7 +237,7 @@ static INT16 MFDRV_CreateRegion(PHYSDEV dev, HRGN hrgn)
WORD *Param, *StartBand; WORD *Param, *StartBand;
BOOL ret; BOOL ret;
len = GetRegionData( hrgn, 0, NULL ); if (!(len = GetRegionData( hrgn, 0, NULL ))) return -1;
if( !(rgndata = HeapAlloc( GetProcessHeap(), 0, len )) ) { if( !(rgndata = HeapAlloc( GetProcessHeap(), 0, len )) ) {
WARN("Can't alloc rgndata buffer\n"); WARN("Can't alloc rgndata buffer\n");
return -1; return -1;
...@@ -376,16 +376,15 @@ MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) ...@@ -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 ) INT MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
{ {
INT16 iRgn; INT16 iRgn;
INT ret;
if (mode != RGN_COPY) if (mode != RGN_COPY) return ERROR;
{ if (!hrgn) return NULLREGION;
FIXME( "mode %d not supported\n", mode );
return ERROR;
}
iRgn = MFDRV_CreateRegion( dev, hrgn ); iRgn = MFDRV_CreateRegion( dev, hrgn );
if(iRgn == -1) if(iRgn == -1) return ERROR;
return ERROR; ret = MFDRV_MetaParam1( dev, META_SELECTCLIPREGION, iRgn ) ? NULLREGION : ERROR;
return MFDRV_MetaParam1( dev, META_SELECTCLIPREGION, iRgn ) ? SIMPLEREGION : 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