[Libreoffice-commits] core.git: starmath/source vcl/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sat Apr 27 22:50:57 UTC 2019


 starmath/source/ElementsDockingWindow.cxx |   15 ++++++++-------
 vcl/source/outdev/text.cxx                |    5 +++--
 2 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit ee57d5253a2ee054b06a4158204bda1a8fc3b5dc
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat Apr 27 20:43:37 2019 +0000
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sun Apr 28 00:49:02 2019 +0200

    Minimize scope of variables
    
    Change-Id: I6602c84b9bd7143e5e7b224c17559b083c9b7f9c
    Reviewed-on: https://gerrit.libreoffice.org/71439
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index bb15c28d11a4..f093723daf2a 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -334,8 +334,6 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
         }
         else
         {
-            Size aSizePixel = LogicToPixel(Size(element->getNode()->GetWidth(),
-                                                element->getNode()->GetHeight()));
             if (mbVerticalMode)
             {
                 if (y + boxY > nControlHeight)
@@ -363,14 +361,17 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
                 pContext->Pop();
             }
 
-            Point location(x + ((boxX - aSizePixel.Width()) / 2),
-                           y + ((boxY - aSizePixel.Height()) / 2));
+            element->mBoxLocation = Point(x,y);
+            element->mBoxSize = Size(boxX, boxY);
 
             if (pContext)
+            {
+                Size aSizePixel = LogicToPixel(Size(element->getNode()->GetWidth(),
+                                                    element->getNode()->GetHeight()));
+                Point location(x + ((boxX - aSizePixel.Width()) / 2),
+                               y + ((boxY - aSizePixel.Height()) / 2));
                 SmDrawingVisitor(*pContext, PixelToLogic(location), element->getNode().get());
-
-            element->mBoxLocation = Point(x,y);
-            element->mBoxSize = Size(boxX, boxY);
+            }
 
             if (mbVerticalMode)
                 y += boxY;
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 68b7a4ffc250..fb3092739ffc 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1264,14 +1264,15 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr,
         pLayoutCache = nullptr; // don't use cache with modified string!
         pGlyphs = nullptr;
     }
+
     DeviceCoordinate nPixelWidth = static_cast<DeviceCoordinate>(nLogicalWidth);
-    std::unique_ptr<DeviceCoordinate[]> xDXPixelArray;
-    DeviceCoordinate* pDXPixelArray(nullptr);
     if( nLogicalWidth && mbMap )
     {
         nPixelWidth = LogicWidthToDeviceCoordinate( nLogicalWidth );
     }
 
+    std::unique_ptr<DeviceCoordinate[]> xDXPixelArray;
+    DeviceCoordinate* pDXPixelArray(nullptr);
     if( pDXArray)
     {
         if(mbMap)


More information about the Libreoffice-commits mailing list