From d1fa4b2d73cc6a28e4d02ca0afb8a538f8e83128 Mon Sep 17 00:00:00 2001 From: Dave Belanger Date: Tue, 7 Oct 2003 03:32:28 +0000 Subject: [PATCH] Spit out EMR_RESTOREDC metarecords with -1 as argument as long as we don't get to the saved state we want. --- dlls/gdi/enhmfdrv/dc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/gdi/enhmfdrv/dc.c b/dlls/gdi/enhmfdrv/dc.c index 840fab0dc72..4049ecae7fa 100644 --- a/dlls/gdi/enhmfdrv/dc.c +++ b/dlls/gdi/enhmfdrv/dc.c @@ -33,11 +33,24 @@ INT EMFDRV_SaveDC( PHYSDEV dev ) BOOL EMFDRV_RestoreDC( PHYSDEV dev, INT level ) { + EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev; EMRRESTOREDC emr; + emr.emr.iType = EMR_RESTOREDC; emr.emr.nSize = sizeof(emr); - emr.iRelative = level; - return EMFDRV_WriteRecord( dev, &emr.emr ); + emr.iRelative = -1; + if (level == -1) + return EMFDRV_WriteRecord( dev, &emr.emr ); + else if (level > 0 && level <= physDev->dc->saveLevel) + { + while (level >= physDev->dc->saveLevel) + { + EMFDRV_WriteRecord( dev, &emr.emr ); + level--; + } + return TRUE; + } + return FALSE; } UINT EMFDRV_SetTextAlign( PHYSDEV dev, UINT align )