[Libreoffice-commits] core.git: drawinglayer/source

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Sat Dec 14 20:10:01 UTC 2019


 drawinglayer/source/tools/emfphelperdata.cxx |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

New commits:
commit 64e8c521d105c34d41a70e7a9437deb71af6becc
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Tue Dec 10 02:26:09 2019 +1100
Commit:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
CommitDate: Sat Dec 14 21:09:05 2019 +0100

    drawinglayer: fix getUnitToPixelMultiplier() function
    
    Change-Id: If3e7d87e804a69b8c9511e2b5ac3e0af2f1a57a0
    Reviewed-on: https://gerrit.libreoffice.org/84832
    Tested-by: Jenkins
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 1c6950d01404..f0c84dc34ec2 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -44,6 +44,7 @@
 #include <basegfx/polygon/b2dpolygontools.hxx>
 #include <basegfx/polygon/b2dpolypolygoncutter.hxx>
 #include <sal/log.hxx>
+#include <vcl/outdev.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <i18nlangtag/languagetag.hxx>
@@ -175,31 +176,35 @@ namespace emfplushelper
             case UnitTypePoint:
             {
                 SAL_INFO("drawinglayer", "EMF+\t Converting Points to Pixels.");
-                return 1.333333f;
+                return Application::GetDefaultDevice()->GetDPIX() / 72;
             }
             case UnitTypeInch:
             {
-                SAL_INFO("drawinglayer", "EMF+\t TODO Test Converting Inches to Pixels, if it is working correctly.");
-                return 96.0f;
+                SAL_INFO("drawinglayer", "EMF+\t Converting Inches to Pixels.");
+                return Application::GetDefaultDevice()->GetDPIX();
             }
             case UnitTypeMillimeter:
             {
-                SAL_INFO("drawinglayer", "EMF+\t TODO Test Converting Millimeters to Pixels, if it is working correctly.");
-                return 3.779528f;
+                SAL_INFO("drawinglayer", "EMF+\t Converting Millimeters to Pixels");
+                return Application::GetDefaultDevice()->GetDPIX() / 25.4;
             }
             case UnitTypeDocument:
             {
-                SAL_INFO("drawinglayer", "EMF+\t TODO Test Converting Documents to Pixels, if it is working correctly.");
-                return 0.32f;
+                SAL_INFO("drawinglayer", "EMF+\t Converting Documents to Pixels.");
+                return Application::GetDefaultDevice()->GetDPIX() / 300;
             }
             case UnitTypeWorld:
             case UnitTypeDisplay:
+            {
+                SAL_WARN("drawinglayer", "EMF+\t Converting to World/Display.");
+                return 1.0f;
+            }
             default:
             {
                 SAL_WARN("drawinglayer", "EMF+\tTODO Unimplemented support of Unit Type: 0x" << std::hex << aUnitType);
+                return 1.0f;
             }
         }
-        return 1.0f;
     }
 
     void EmfPlusHelperData::processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, bool bUseWholeStream)


More information about the Libreoffice-commits mailing list