Commit 5e507b3e authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

gdi32: Fix METADC handling in PlayMetaFile.

parent 043cc241
......@@ -360,6 +360,7 @@ HMETAFILE WINAPI CopyMetaFileA( HMETAFILE hSrcMetaFile, LPCSTR lpFilename )
*/
BOOL WINAPI PlayMetaFile( HDC hdc, HMETAFILE hmf )
{
BOOL metadc = GetObjectType(hdc) == OBJ_METADC;
METAHEADER *mh = get_metafile_bits( hmf );
METARECORD *mr;
HANDLETABLE *ht;
......@@ -372,6 +373,8 @@ BOOL WINAPI PlayMetaFile( HDC hdc, HMETAFILE hmf )
if (!mh) return FALSE;
if (!metadc)
{
/* save DC */
hPen = GetCurrentObject(hdc, OBJ_PEN);
hBrush = GetCurrentObject(hdc, OBJ_BRUSH);
......@@ -383,6 +386,7 @@ BOOL WINAPI PlayMetaFile( HDC hdc, HMETAFILE hmf )
DeleteObject(hRgn);
hRgn = 0;
}
}
/* create the handle table */
ht = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
......@@ -414,12 +418,15 @@ BOOL WINAPI PlayMetaFile( HDC hdc, HMETAFILE hmf )
PlayMetaFileRecord( hdc, ht, mr, mh->mtNoObjects );
}
if (!metadc)
{
/* restore DC */
SelectObject(hdc, hPen);
SelectObject(hdc, hBrush);
SelectPalette(hdc, hPal, FALSE);
ExtSelectClipRgn(hdc, hRgn, RGN_COPY);
DeleteObject(hRgn);
}
/* free objects in handle table */
for(i = 0; i < mh->mtNoObjects; i++)
......
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