diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2020-11-12 21:48:44 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-11-16 15:31:41 +0100 |
commit | 1c399bb1dc9af8d591258e936508200d38d3bb5a (patch) | |
tree | 3296affefc0732af08d7ffd715d1d4b3ffcca13a /emfio/source | |
parent | b4f50e78e9cd391964128bd0d1446d4dca110cef (diff) |
To properly import some EMF files, the proper implementation of MapMode Text
needs to be done according to MS documentation.
I have also added regression tests.
Change-Id: Id788294a498b93bebb62118d13ea545f80a60f01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105771
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit b0b78838e795fcd7f3c53e7f74fb32b2921a5ccb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105849
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'emfio/source')
-rw-r--r-- | emfio/source/reader/mtftools.cxx | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index 06b0f813588d..e90ced506823 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -374,10 +374,13 @@ namespace emfio { fX2 -= mnWinOrgX; fY2 -= mnWinOrgY; - fX2 /= mnWinExtX; - fY2 /= mnWinExtY; - fX2 *= mnDevWidth; - fY2 *= mnDevHeight; + if ( mnMapMode != MM_TEXT ) + { + fX2 /= mnWinExtX; + fY2 /= mnWinExtY; + fX2 *= mnDevWidth; + fY2 *= mnDevHeight; + } fX2 += mnDevOrgX; fY2 += mnDevOrgY; // fX2, fY2 now in device units fX2 *= static_cast<double>(mnMillX) * 100.0 / static_cast<double>(mnPixX); @@ -464,10 +467,13 @@ namespace emfio } else { - fWidth /= mnWinExtX; - fHeight /= mnWinExtY; - fWidth *= mnDevWidth; - fHeight *= mnDevHeight; + if ( mnMapMode != MM_TEXT ) + { + fWidth /= mnWinExtX; + fHeight /= mnWinExtY; + fWidth *= mnDevWidth; + fHeight *= mnDevHeight; + } fWidth *= static_cast<double>(mnMillX) * 100.0 / static_cast<double>(mnPixX); fHeight *= static_cast<double>(mnMillY) * 100.0 / static_cast<double>(mnPixY); } @@ -2125,6 +2131,12 @@ namespace emfio pSave->maPathObj = maPathObj; pSave->maClipPath = maClipPath; + SAL_INFO("emfio", "\t\t GfxMode: " << mnGfxMode); + SAL_INFO("emfio", "\t\t MapMode: " << mnMapMode); + SAL_INFO("emfio", "\t\t WinOrg: " << mnWinOrgX << ", " << mnWinOrgY); + SAL_INFO("emfio", "\t\t WinExt: " << mnWinExtX << " x " << mnWinExtY); + SAL_INFO("emfio", "\t\t DevOrg: " << mnDevOrgX << ", " << mnDevOrgY); + SAL_INFO("emfio", "\t\t DevWidth/Height: " << mnDevWidth << " x " << mnDevHeight); mvSaveStack.push_back( pSave ); } @@ -2174,6 +2186,13 @@ namespace emfio mpGDIMetaFile->AddAction( new MetaRasterOpAction( meRasterOp ) ); meLatestRasterOp = meRasterOp; } + + SAL_INFO("emfio", "\t\t GfxMode: " << mnGfxMode); + SAL_INFO("emfio", "\t\t MapMode: " << mnMapMode); + SAL_INFO("emfio", "\t\t WinOrg: " << mnWinOrgX << ", " << mnWinOrgY); + SAL_INFO("emfio", "\t\t WinExt: " << mnWinExtX << " x " << mnWinExtY); + SAL_INFO("emfio", "\t\t DevOrg: " << mnDevOrgX << ", " << mnDevOrgY); + SAL_INFO("emfio", "\t\t DevWidth/Height: " << mnDevWidth << " x " << mnDevHeight); mvSaveStack.pop_back(); } |