diff --git a/graphics/enhmetafiledrv/graphics.c b/graphics/enhmetafiledrv/graphics.c index 0aba29b3a77..f7459d4c9ae 100644 --- a/graphics/enhmetafiledrv/graphics.c +++ b/graphics/enhmetafiledrv/graphics.c @@ -77,8 +77,10 @@ EMFDRV_ArcChordPie( DC *dc, INT left, INT top, INT right, INT bottom, if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - right--; - bottom--; + if(dc->w.GraphicsMode == GM_COMPATIBLE) { + right--; + bottom--; + } emr.emr.iType = iType; emr.emr.nSize = sizeof(emr); @@ -210,8 +212,10 @@ EMFDRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom ) if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - right--; - bottom--; + if(dc->w.GraphicsMode == GM_COMPATIBLE) { + right--; + bottom--; + } emr.emr.iType = EMR_ELLIPSE; emr.emr.nSize = sizeof(emr); @@ -240,8 +244,10 @@ EMFDRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom) if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - right--; - bottom--; + if(dc->w.GraphicsMode == GM_COMPATIBLE) { + right--; + bottom--; + } emr.emr.iType = EMR_RECTANGLE; emr.emr.nSize = sizeof(emr); @@ -269,8 +275,10 @@ EMFDRV_RoundRect( DC *dc, INT left, INT top, INT right, if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - right--; - bottom--; + if(dc->w.GraphicsMode == GM_COMPATIBLE) { + right--; + bottom--; + } emr.emr.iType = EMR_ROUNDRECT; emr.emr.nSize = sizeof(emr); diff --git a/graphics/enhmetafiledrv/init.c b/graphics/enhmetafiledrv/init.c index bdedaed9a40..7133c1f180a 100644 --- a/graphics/enhmetafiledrv/init.c +++ b/graphics/enhmetafiledrv/init.c @@ -283,6 +283,16 @@ HDC WINAPI CreateEnhMetaFileW( physDev->emh->rclBounds.left = physDev->emh->rclBounds.top = 0; physDev->emh->rclBounds.right = physDev->emh->rclBounds.bottom = -1; + if(rect) { + physDev->emh->rclFrame.left = rect->left; + physDev->emh->rclFrame.top = rect->top; + physDev->emh->rclFrame.right = rect->right; + physDev->emh->rclFrame.bottom = rect->bottom; + } else { /* Set this to {0,0 - -1,-1} and update it at the end */ + physDev->emh->rclFrame.left = physDev->emh->rclFrame.top = 0; + physDev->emh->rclFrame.right = physDev->emh->rclFrame.bottom = -1; + } + physDev->emh->dSignature = ENHMETA_SIGNATURE; physDev->emh->nVersion = 0x10000; physDev->emh->nBytes = physDev->emh->nSize; @@ -351,6 +361,18 @@ HENHMETAFILE WINAPI CloseEnhMetaFile( HDC hdc /* metafile DC */ ) emr.nSizeLast = emr.emr.nSize; EMFDRV_WriteRecord( dc, &emr.emr ); + /* Update rclFrame if not initialized in CreateEnhMetaFile */ + if(physDev->emh->rclFrame.left > physDev->emh->rclFrame.right) { + physDev->emh->rclFrame.left = physDev->emh->rclBounds.left * + physDev->emh->szlMillimeters.cx * 100 / physDev->emh->szlDevice.cx; + physDev->emh->rclFrame.top = physDev->emh->rclBounds.top * + physDev->emh->szlMillimeters.cy * 100 / physDev->emh->szlDevice.cy; + physDev->emh->rclFrame.right = physDev->emh->rclBounds.right * + physDev->emh->szlMillimeters.cx * 100 / physDev->emh->szlDevice.cx; + physDev->emh->rclFrame.bottom = physDev->emh->rclBounds.bottom * + physDev->emh->szlMillimeters.cy * 100 / physDev->emh->szlDevice.cy; + } + if (physDev->hFile) /* disk based metafile */ { if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0) {