[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 9 12:03:16 UTC 2018


 sc/source/core/data/global.cxx |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 60011cefbccd91065dadf66896a688b807e76964
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Mon Oct 1 21:27:49 2018 +0200
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Tue Oct 9 14:02:55 2018 +0200

    tdf#115262 sc: fix cumulative placement error of images
    
    Commit 708d1c5ab242b545ced598879233fc662d7e6cc0 (sc lok: emit
    RowColumnHeader info in twips, 2015-11-02) improved precision of the
    twip -> pixel conversion ratio, but ignored the detail that limited
    precision used to silence cumulative errors that appear with larger
    precision.
    
    The original use-case was better precision of row/column headers for the
    LOK API, so keep that as-is, but go back to the original behavior on the
    desktop.
    
    (cherry picked from commit 616fd241838069e18c59064e33c4b24f5ae112c6)
    
    Change-Id: Ide169ab1745a9a9299caf3334559884ff7223cbe
    Reviewed-on: https://gerrit.libreoffice.org/61312
    Tested-by: Jenkins
    Tested-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 7c05743572a2..f3819735f6dc 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -487,8 +487,19 @@ void ScGlobal::InitPPT()
 {
     OutputDevice* pDev = Application::GetDefaultDevice();
 
-    nScreenPPTX = double(pDev->GetDPIX()) / double(TWIPS_PER_INCH);
-    nScreenPPTY = double(pDev->GetDPIY()) / double(TWIPS_PER_INCH);
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        nScreenPPTX = double(pDev->GetDPIX()) / double(TWIPS_PER_INCH);
+        nScreenPPTY = double(pDev->GetDPIY()) / double(TWIPS_PER_INCH);
+    }
+    else
+    {
+        // Avoid cumulative placement errors by intentionally limiting
+        // precision.
+        Point aPix1000 = pDev->LogicToPixel(Point(1000, 1000), MapMode(MapUnit::MapTwip));
+        nScreenPPTX = aPix1000.X() / 1000.0;
+        nScreenPPTY = aPix1000.Y() / 1000.0;
+    }
 }
 
 const OUString& ScGlobal::GetClipDocName()


More information about the Libreoffice-commits mailing list