diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2020-11-12 21:48:44 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-11-14 18:10:09 +0100 |
commit | b0b78838e795fcd7f3c53e7f74fb32b2921a5ccb (patch) | |
tree | ed63a09c5f52a11805b1bc1783b110f71654202f /emfio/source/reader | |
parent | fc351e37d6513be91c03d9a81e977a817d65206d (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>
Diffstat (limited to 'emfio/source/reader')
-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 4b12f38675ce..cd3110ba9cbc 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); } @@ -2131,6 +2137,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 ); } @@ -2180,6 +2192,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(); } |