Fix big metafiles

This commit is contained in:
Oleg Korshul
2022-08-25 15:53:33 +03:00
parent bd32484a1e
commit 5c202eece6

View File

@ -612,7 +612,20 @@ namespace MetaFile
double dWidth = 25.4 * nWidth / 96;
double dHeight = 25.4 * nHeight / 96;
BYTE* pBgraData = new BYTE[nWidth * nHeight * 4];
BYTE* pBgraData = (BYTE*)malloc(nWidth * nHeight * 4);
if (!pBgraData)
{
double dKoef = 2000.0 / (nWidth > nHeight ? nWidth : nHeight);
nWidth = (int)(dKoef * nWidth);
nHeight = (int)(dKoef * nHeight);
dWidth = 25.4 * nWidth / 96;
dHeight = 25.4 * nHeight / 96;
pBgraData = (BYTE*)malloc(nWidth * nHeight * 4);
}
if (!pBgraData)
return;
@ -637,8 +650,11 @@ namespace MetaFile
DrawOnRenderer(pGrRenderer, 0, 0, dWidth, dHeight);
oFrame.SaveFile(wsOutFilePath, unFileType);
oFrame.put_Data(NULL);
RELEASEINTERFACE(pFontManager);
RELEASEINTERFACE(pGrRenderer);
if (pBgraData)
free(pBgraData);
}
}