[Libreoffice-commits] core.git: sc/source sfx2/source svtools/source svx/source sw/source vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sat Oct 29 21:49:01 UTC 2016


 sc/source/ui/cctrl/checklistmenu.cxx           |   41 ++++++++++++-------------
 sc/source/ui/cctrl/dpcontrol.cxx               |   12 +++----
 sc/source/ui/view/gridwin.cxx                  |   16 ++++-----
 sc/source/ui/view/tabview.cxx                  |    6 +--
 sfx2/source/dialog/infobar.cxx                 |   18 +++++-----
 svtools/source/control/tabbar.cxx              |    3 -
 svx/source/svdraw/svdcrtv.cxx                  |    4 +-
 svx/source/svdraw/svdhdl.cxx                   |   10 +-----
 svx/source/table/tablehandles.cxx              |    4 +-
 svx/source/tbxctrls/layctrl.cxx                |    6 ++-
 sw/source/uibase/sidebar/StylePresetsPanel.cxx |   18 +++++-----
 sw/source/uibase/sidebar/ThemePanel.cxx        |    6 +--
 vcl/source/window/status.cxx                   |    2 -
 vcl/source/window/toolbox.cxx                  |   28 +++++++++--------
 14 files changed, 87 insertions(+), 87 deletions(-)

New commits:
commit b7c2764145be2c3fc50397f241dbdb0c53f9befd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Oct 28 23:55:53 2016 +0200

    convert usages of DPIScalingFactor from int to float
    
    Change-Id: I049b3d2cde4dcb8c8c0690d75a015a43cb71b0c0
    Reviewed-on: https://gerrit.libreoffice.org/30381
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 374914b..9327e00 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -86,8 +86,7 @@ ScMenuFloatingWindow::ScMenuFloatingWindow(vcl::Window* pParent, ScDocument* pDo
 
     const StyleSettings& rStyle = GetSettings().GetStyleSettings();
 
-    sal_Int32 nScaleFactor = GetDPIScaleFactor();
-    const sal_uInt16 nPopupFontHeight = 12 * nScaleFactor;
+    const sal_uInt16 nPopupFontHeight = 12 * GetDPIScaleFactor();
     maLabelFont = rStyle.GetLabelFont();
     maLabelFont.SetFontHeight(nPopupFontHeight);
 }
@@ -890,9 +889,9 @@ ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* p
     mePrevToggleAllState(TRISTATE_INDET),
     maTabStops(this)
 {
-    sal_Int32 nScaleFactor = GetDPIScaleFactor();
+    float fScaleFactor = GetDPIScaleFactor();
 
-    maWndSize = Size(200 * nScaleFactor, 330 * nScaleFactor);
+    maWndSize = Size(200 * fScaleFactor, 330 * fScaleFactor);
 
     maTabStops.AddTabStop( this );
     maTabStops.AddTabStop( maEdSearch.get() );
@@ -928,21 +927,21 @@ void ScCheckListMenuWindow::dispose()
 void ScCheckListMenuWindow::getSectionPosSize(
     Point& rPos, Size& rSize, SectionType eType) const
 {
-    sal_Int32 nScaleFactor = GetDPIScaleFactor();
+    float fScaleFactor = GetDPIScaleFactor();
 
     // constant parameters.
-    const long nSearchBoxMargin = 10 *nScaleFactor;
-    const long nListBoxMargin = 5 * nScaleFactor;            // horizontal distance from the side of the dialog to the listbox border.
-    const long nListBoxInnerPadding = 5 * nScaleFactor;
-    const long nTopMargin = 5 * nScaleFactor;
+    const long nSearchBoxMargin = 10 *fScaleFactor;
+    const long nListBoxMargin = 5 * fScaleFactor;            // horizontal distance from the side of the dialog to the listbox border.
+    const long nListBoxInnerPadding = 5 * fScaleFactor;
+    const long nTopMargin = 5 * fScaleFactor;
     const long nMenuHeight = maMenuSize.getHeight();
-    const long nSingleItemBtnAreaHeight = 32 * nScaleFactor; // height of the middle area below the list box where the single-action buttons are.
-    const long nBottomBtnAreaHeight = 50 * nScaleFactor;     // height of the bottom area where the OK and Cancel buttons are.
-    const long nBtnWidth = 90 * nScaleFactor;
+    const long nSingleItemBtnAreaHeight = 32 * fScaleFactor; // height of the middle area below the list box where the single-action buttons are.
+    const long nBottomBtnAreaHeight = 50 * fScaleFactor;     // height of the bottom area where the OK and Cancel buttons are.
+    const long nBtnWidth = 90 * fScaleFactor;
     const long nLabelHeight = getLabelFont().GetFontHeight();
     const long nBtnHeight = nLabelHeight * 2;
-    const long nBottomMargin = 10 * nScaleFactor;
-    const long nMenuListMargin = 5 * nScaleFactor;
+    const long nBottomMargin = 10 * fScaleFactor;
+    const long nMenuListMargin = 5 * fScaleFactor;
     const long nSearchBoxHeight = nLabelHeight * 2;
 
     // parameters calculated from constants.
@@ -1000,7 +999,7 @@ void ScCheckListMenuWindow::getSectionPosSize(
         break;
         case BTN_SINGLE_SELECT:
         {
-            long h = 26 * nScaleFactor;
+            long h = 26 * fScaleFactor;
             rPos = Point(nListBoxMargin, nSingleBtnAreaY);
             rPos.X() += nListBoxWidth - h - 10 - h - 10;
             rPos.Y() += (nSingleItemBtnAreaHeight - h)/2;
@@ -1009,7 +1008,7 @@ void ScCheckListMenuWindow::getSectionPosSize(
         break;
         case BTN_SINGLE_UNSELECT:
         {
-            long h = 26 * nScaleFactor;
+            long h = 26 * fScaleFactor;
             rPos = Point(nListBoxMargin, nSingleBtnAreaY);
             rPos.X() += nListBoxWidth - h - 10;
             rPos.Y() += (nSingleItemBtnAreaHeight - h)/2;
@@ -1095,13 +1094,13 @@ void ScCheckListMenuWindow::packWindow()
     maChkToggleAll->SetClickHdl( LINK(this, ScCheckListMenuWindow, TriStateHdl) );
     maChkToggleAll->Show();
 
-    sal_Int32 nScaleFactor = GetDPIScaleFactor();
+    float fScaleFactor = GetDPIScaleFactor();
 
     Image aSingleSelect(ScResId(RID_IMG_SELECT_CURRENT));
-    if (nScaleFactor != 1)
+    if (fScaleFactor > 1)
     {
         BitmapEx aBitmap = aSingleSelect.GetBitmapEx();
-        aBitmap.Scale(nScaleFactor, nScaleFactor, BmpScaleFlag::Fast);
+        aBitmap.Scale(fScaleFactor, fScaleFactor, BmpScaleFlag::Fast);
         aSingleSelect = Image(aBitmap);
     }
 
@@ -1113,10 +1112,10 @@ void ScCheckListMenuWindow::packWindow()
     maBtnSelectSingle->Show();
 
     Image aSingleUnselect(ScResId(RID_IMG_UNSELECT_CURRENT));
-    if (nScaleFactor != 1)
+    if (fScaleFactor > 1)
     {
         BitmapEx aBitmap = aSingleUnselect.GetBitmapEx();
-        aBitmap.Scale(nScaleFactor, nScaleFactor, BmpScaleFlag::Fast);
+        aBitmap.Scale(fScaleFactor, fScaleFactor, BmpScaleFlag::Fast);
         aSingleUnselect = Image(aBitmap);
     }
 
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 65d9a54..cc0aaf9 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -145,9 +145,9 @@ void ScDPFieldButton::draw()
 
 void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const
 {
-    sal_Int32 nScaleFactor = mpOutDev->GetDPIScaleFactor();
+    float fScaleFactor = mpOutDev->GetDPIScaleFactor();
 
-    long nMaxSize = 18L * nScaleFactor; // Button max size in either dimension
+    long nMaxSize = 18L * fScaleFactor; // Button max size in either dimension
 
     long nW = std::min(maSize.getWidth() / 2, nMaxSize);
     long nH = std::min(maSize.getHeight(),    nMaxSize);
@@ -170,7 +170,7 @@ void ScDPFieldButton::drawPopupButton()
     Size aSize;
     getPopupBoundingBox(aPos, aSize);
 
-    sal_Int32 nScaleFactor = mpOutDev->GetDPIScaleFactor();
+    float fScaleFactor = mpOutDev->GetDPIScaleFactor();
 
     // Background & outer black border
     mpOutDev->SetLineColor(COL_BLACK);
@@ -185,7 +185,7 @@ void ScDPFieldButton::drawPopupButton()
 
     Point aCenter(aPos.X() + (aSize.Width() / 2), aPos.Y() + (aSize.Height() / 2));
 
-    Size aArrowSize(4 * nScaleFactor, 2 * nScaleFactor);
+    Size aArrowSize(4 * fScaleFactor, 2 * fScaleFactor);
 
     tools::Polygon aPoly(3);
     aPoly.SetPoint(Point(aCenter.X() - aArrowSize.Width(), aCenter.Y() - aArrowSize.Height()), 0);
@@ -196,8 +196,8 @@ void ScDPFieldButton::drawPopupButton()
     if (mbHasHiddenMember)
     {
         // tiny little box to display in presence of hidden member(s).
-        Point aBoxPos(aPos.X() + aSize.Width() - 5 * nScaleFactor, aPos.Y() + aSize.Height() - 5 * nScaleFactor);
-        Size aBoxSize(3 * nScaleFactor, 3 * nScaleFactor);
+        Point aBoxPos(aPos.X() + aSize.Width() - 5 * fScaleFactor, aPos.Y() + aSize.Height() - 5 * fScaleFactor);
+        Size aBoxSize(3 * fScaleFactor, 3 * fScaleFactor);
         mpOutDev->DrawRect(Rectangle(aBoxPos, aBoxSize));
     }
 }
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b57737e..48506a8 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5999,9 +5999,9 @@ void ScGridWindow::UpdateCursorOverlay()
             // show the cursor as 4 (thin) rectangles
             Rectangle aRect(aScrPos, Size(nSizeXPix - 1, nSizeYPix - 1));
 
-            sal_Int32 nScale = GetDPIScaleFactor();
+            float fScaleFactor = GetDPIScaleFactor();
 
-            long aCursorWidth = 1 * nScale;
+            long aCursorWidth = 1 * fScaleFactor;
 
             Rectangle aLeft = Rectangle(aRect);
             aLeft.Top()    -= aCursorWidth;
@@ -6190,9 +6190,9 @@ void ScGridWindow::UpdateAutoFillOverlay()
         ScDocument* pDoc = pViewData->GetDocument();
         bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
 
-        sal_Int32 nScale = GetDPIScaleFactor();
+        float fScaleFactor = GetDPIScaleFactor();
         // Size should be even
-        Size aFillHandleSize(6 * nScale, 6 * nScale);
+        Size aFillHandleSize(6 * fScaleFactor, 6 * fScaleFactor);
 
         Point aFillPos = pViewData->GetScrPos( nX, nY, eWhich, true );
         long nSizeXPix;
@@ -6210,10 +6210,10 @@ void ScGridWindow::UpdateAutoFillOverlay()
         Rectangle aFillRect(aFillPos, aFillHandleSize);
 
         // expand rect to increase hit area
-        mpAutoFillRect.reset(new Rectangle(aFillRect.Left()   - nScale,
-                                           aFillRect.Top()    - nScale,
-                                           aFillRect.Right()  + nScale,
-                                           aFillRect.Bottom() + nScale));
+        mpAutoFillRect.reset(new Rectangle(aFillRect.Left()   - fScaleFactor,
+                                           aFillRect.Top()    - fScaleFactor,
+                                           aFillRect.Right()  + fScaleFactor,
+                                           aFillRect.Bottom() + fScaleFactor));
 
         // #i70788# get the OverlayManager safely
         rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager();
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index dc5c221c..81ae3c7 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -332,12 +332,12 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
     if ( bMinimized )
         return;
 
-    sal_Int32 aScaleFactor = pFrameWin->GetDPIScaleFactor();
+    float fScaleFactor = pFrameWin->GetDPIScaleFactor();
 
-    long nSplitSizeX = SPLIT_HANDLE_SIZE * aScaleFactor;
+    long nSplitSizeX = SPLIT_HANDLE_SIZE * fScaleFactor;
     if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
         nSplitSizeX = 1;
-    long nSplitSizeY = SPLIT_HANDLE_SIZE * aScaleFactor;
+    long nSplitSizeY = SPLIT_HANDLE_SIZE * fScaleFactor;
     if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
         nSplitSizeY = 1;
 
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index 331952e..672d819 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -154,9 +154,9 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId,
     if (pMessageColor)
         m_pMessage->SetControlForeground(Color(*pMessageColor));
 
-    sal_Int32 nScaleFactor = GetDPIScaleFactor();
+    float fScaleFactor = GetDPIScaleFactor();
     long nWidth = pParent->GetSizePixel().getWidth();
-    SetPosSizePixel(Point(0, 0), Size(nWidth, INFO_BAR_BASE_HEIGHT * nScaleFactor));
+    SetPosSizePixel(Point(0, 0), Size(nWidth, INFO_BAR_BASE_HEIGHT * fScaleFactor));
 
     m_pMessage->SetText(sMessage);
     m_pMessage->Show();
@@ -233,25 +233,25 @@ void SfxInfoBarWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle
 
 void SfxInfoBarWindow::Resize()
 {
-    sal_Int32 nScaleFactor = GetDPIScaleFactor();
+    float fScaleFactor = GetDPIScaleFactor();
 
     long nWidth = GetSizePixel().getWidth();
-    m_pCloseBtn->SetPosSizePixel(Point(nWidth - 25 * nScaleFactor, 15 * nScaleFactor), Size(10 * nScaleFactor, 10 * nScaleFactor));
+    m_pCloseBtn->SetPosSizePixel(Point(nWidth - 25 * fScaleFactor, 15 * fScaleFactor), Size(10 * fScaleFactor, 10 * fScaleFactor));
 
     // Reparent the buttons and place them on the right of the bar
-    long nX = m_pCloseBtn->GetPosPixel().getX() - 15 * nScaleFactor;
-    long nButtonGap = 5 * nScaleFactor;
+    long nX = m_pCloseBtn->GetPosPixel().getX() - 15 * fScaleFactor;
+    long nButtonGap = 5 * fScaleFactor;
 
     for (auto it = m_aActionBtns.begin(); it != m_aActionBtns.end(); ++it)
     {
         long nButtonWidth = (*it)->GetSizePixel().getWidth();
         nX -= nButtonWidth;
-        (*it)->SetPosSizePixel(Point(nX, 5 * nScaleFactor), Size(nButtonWidth, 30 * nScaleFactor));
+        (*it)->SetPosSizePixel(Point(nX, 5 * fScaleFactor), Size(nButtonWidth, 30 * fScaleFactor));
         nX -= nButtonGap;
     }
 
-    Point aMessagePosition(10 * nScaleFactor, 10 * nScaleFactor);
-    Size aMessageSize(nX - 20 * nScaleFactor, 20 * nScaleFactor);
+    Point aMessagePosition(10 * fScaleFactor, 10 * fScaleFactor);
+    Size aMessageSize(nX - 20 * fScaleFactor, 20 * fScaleFactor);
 
     m_pMessage->SetPosSizePixel(aMessagePosition, aMessageSize);
 }
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 446bb6a..47cecc3 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -330,9 +330,8 @@ ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle )
     : Window( pParent, nWinStyle & WB_3DLOOK )
     , mnStartWidth(0)
 {
-    sal_Int32 nScaleFactor = GetDPIScaleFactor();
     SetPointer(Pointer(PointerStyle::HSizeBar));
-    SetSizePixel(Size(7 * nScaleFactor, 0));
+    SetSizePixel(Size(7 * GetDPIScaleFactor(), 0));
 }
 
 void ImplTabSizer::ImplTrack( const Point& rScreenPos )
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index b6a7d56..c2311ed 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -70,8 +70,8 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S
 
         if(xTargetOverlay.is())
         {
-            sal_Int32 nScalingFactor = xTargetOverlay->getOutputDevice().GetDPIScaleFactor();
-            Size aHalfLogicSize(xTargetOverlay->getOutputDevice().PixelToLogic(Size(4 * nScalingFactor, 4 * nScalingFactor)));
+            float fScalingFactor = xTargetOverlay->getOutputDevice().GetDPIScaleFactor();
+            Size aHalfLogicSize(xTargetOverlay->getOutputDevice().PixelToLogic(Size(4 * fScalingFactor, 4 * fScalingFactor)));
 
             // object
             sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new sdr::overlay::OverlayPolyPolygonStripedAndFilled(
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 642337d..7115bba 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -591,8 +591,8 @@ void SdrHdl::CreateB2dIAObject()
                                 default:
                                     break;
                             }
-                            sal_Int32 nScaleFactor = rOutDev.GetDPIScaleFactor();
-                            basegfx::B2DSize aB2DSize(fSize * nScaleFactor, fSize * nScaleFactor);
+                            float fScalingFactor = rOutDev.GetDPIScaleFactor();
+                            basegfx::B2DSize aB2DSize(fSize * fScalingFactor, fSize * fScalingFactor);
 
                             Color aHandleStrokeColor(COL_BLACK);
                             Color aHandleFillColor(COL_LIGHTGREEN);
@@ -681,7 +681,7 @@ BitmapEx SdrHdl::ImpGetBitmapEx( BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd
 
 sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
     const basegfx::B2DPoint& rPos,
-    BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, OutputDevice& rOutDev, Point aMoveOutsideOffset)
+    BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, OutputDevice& /*rOutDev*/, Point aMoveOutsideOffset)
 {
     sdr::overlay::OverlayObject* pRetval = nullptr;
 
@@ -799,10 +799,6 @@ sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
             aBmpEx.Erase(COL_BLACK);
         }
 
-        // Scale the handle with the DPI scale factor
-        sal_Int32 nScaleFactor = rOutDev.GetDPIScaleFactor();
-        aBmpEx.Scale(nScaleFactor, nScaleFactor);
-
         if(eKindOfMarker == BitmapMarkerKind::Anchor || eKindOfMarker == BitmapMarkerKind::AnchorPressed)
         {
             // upper left as reference point inside the handle for AnchorPressed, too
diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx
index cae87f7..53647e9 100644
--- a/svx/source/table/tablehandles.cxx
+++ b/svx/source/table/tablehandles.cxx
@@ -290,8 +290,8 @@ void TableBorderHdl::CreateB2dIAObject()
                     const bool bAnimate = getAnimate();
 
                     OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
-                    sal_Int32 nScaleFactor = rOutDev.GetDPIScaleFactor();
-                    double fWidth = nScaleFactor * 6.0;
+                    float fScaleFactor = rOutDev.GetDPIScaleFactor();
+                    double fWidth = fScaleFactor * 6.0;
 
                     sdr::overlay::OverlayObject* pOverlayObject =
                         new sdr::overlay::OverlayRectangle(aRange.getMinimum(), aRange.getMaximum(),
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 868f834..b0e707f 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -112,8 +112,10 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUStri
     , mnTablePosX(2)
     , mnTablePosY(2)
 {
-    mnTableCellWidth  = 15 * GetDPIScaleFactor();
-    mnTableCellHeight = 15 * GetDPIScaleFactor();
+    float fScaleFactor = GetDPIScaleFactor();
+
+    mnTableCellWidth  = 15 * fScaleFactor;
+    mnTableCellHeight = 15 * fScaleFactor;
 
     mnTableWidth  = mnTablePosX + TABLE_CELLS_HORIZ*mnTableCellWidth;
     mnTableHeight = mnTablePosY + TABLE_CELLS_VERT*mnTableCellHeight;
diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx
index e8caaca..31efd8e 100644
--- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx
+++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx
@@ -66,19 +66,19 @@ BitmapEx GenerateStylePreview(SfxObjectShell& rSource, OUString& aName)
 
     ScopedVclPtrInstance<VirtualDevice> pVirtualDev(*Application::GetDefaultDevice());
 
-    sal_Int32 nScalingFactor = pVirtualDev->GetDPIScaleFactor();
+    float fScalingFactor = pVirtualDev->GetDPIScaleFactor();
 
-    sal_Int32 nMargin = 6 * nScalingFactor;
+    sal_Int32 nMargin = 6 * fScalingFactor;
 
-    sal_Int32 nPreviewWidth = 144 * nScalingFactor;
+    sal_Int32 nPreviewWidth = 144 * fScalingFactor;
 
-    sal_Int32 nNameHeight = 16 * nScalingFactor;
-    sal_Int32 nTitleHeight = 32 * nScalingFactor;
-    sal_Int32 nHeadingHeight = 24 * nScalingFactor;
-    sal_Int32 nTextBodyHeight = 16 * nScalingFactor;
-    sal_Int32 nBottomMargin = 2 * nScalingFactor;
+    sal_Int32 nNameHeight = 16 * fScalingFactor;
+    sal_Int32 nTitleHeight = 32 * fScalingFactor;
+    sal_Int32 nHeadingHeight = 24 * fScalingFactor;
+    sal_Int32 nTextBodyHeight = 16 * fScalingFactor;
+    sal_Int32 nBottomMargin = 2 * fScalingFactor;
 
-    sal_Int32 nNameFontSize = 12 * nScalingFactor;
+    sal_Int32 nNameFontSize = 12 * fScalingFactor;
 
     sal_Int32 nPreviewHeight = nNameHeight + nTitleHeight + nHeadingHeight + nTextBodyHeight + nBottomMargin;
 
diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx
index 20d418c..7fd1fd5 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -394,9 +394,9 @@ void applyTheme(SfxStyleSheetBasePool* pPool, const OUString& sFontSetName, cons
 BitmapEx GenerateColorPreview(const svx::ColorSet& rColorSet)
 {
     ScopedVclPtrInstance<VirtualDevice> pVirtualDev(*Application::GetDefaultDevice());
-    sal_Int32 nScaleFactor = pVirtualDev->GetDPIScaleFactor();
-    long BORDER = 2 * nScaleFactor;
-    long SIZE = 12 * nScaleFactor;
+    float fScaleFactor = pVirtualDev->GetDPIScaleFactor();
+    long BORDER = 2 * fScaleFactor;
+    long SIZE = 12 * fScaleFactor;
 
     Size aSize(BORDER * 7 + SIZE * 6, BORDER * 3 + SIZE * 2);
     pVirtualDev->SetOutputSizePixel(aSize);
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 70778b0..0c727b3 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -906,7 +906,7 @@ void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth,
         nBits |= StatusBarItemBits::Center;
 
     // create item
-    if (mbAdjustHiDPI && GetDPIScaleFactor() != 1)
+    if (mbAdjustHiDPI)
     {
         nWidth *= GetDPIScaleFactor();
     }
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 4378e01..e46d0da 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1671,8 +1671,9 @@ bool ToolBox::ImplCalcItem()
     long            nDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
 
     // set defaults if image or text is needed but empty
-    nDefWidth       = GetDefaultImageSize().Width() * GetDPIScaleFactor();
-    nDefHeight      = GetDefaultImageSize().Height() * GetDPIScaleFactor();
+    float fDPIScaleFactor = GetDPIScaleFactor();
+    nDefWidth  = GetDefaultImageSize().Width()  * fDPIScaleFactor;
+    nDefHeight = GetDefaultImageSize().Height() * fDPIScaleFactor;
 
     mnWinHeight = 0;
     // determine minimum size necessary in NWF
@@ -2711,14 +2712,15 @@ static void ImplDrawMoreIndicator(vcl::RenderContext& rRenderContext, const Rect
         else
             rRenderContext.SetFillColor(Color(COL_BLACK));
     }
+    float fScaleFactor = rRenderContext.GetDPIScaleFactor();
 
-    int linewidth = 1 * rRenderContext.GetDPIScaleFactor();
-    int space = 4 * rRenderContext.GetDPIScaleFactor();
+    int linewidth = 1 * fScaleFactor;
+    int space = 4 * fScaleFactor;
 
     if( !bRotate )
     {
-        long width = 8 * rRenderContext.GetDPIScaleFactor();
-        long height = 5 * rRenderContext.GetDPIScaleFactor();
+        long width = 8 * fScaleFactor;
+        long height = 5 * fScaleFactor;
 
         //Keep odd b/c drawing code works better
         if ( height % 2 == 0 )
@@ -2742,8 +2744,8 @@ static void ImplDrawMoreIndicator(vcl::RenderContext& rRenderContext, const Rect
     }
     else
     {
-        long width = 5 * rRenderContext.GetDPIScaleFactor();
-        long height = 8 * rRenderContext.GetDPIScaleFactor();
+        long width = 5 * fScaleFactor;
+        long height = 8 * fScaleFactor;
 
         //Keep odd b/c drawing code works better
         if (width % 2 == 0)
@@ -2785,10 +2787,12 @@ static void ImplDrawDropdownArrow(vcl::RenderContext& rRenderContext, const Rect
             rRenderContext.SetFillColor(Color(COL_BLACK));
     }
 
+    float fScaleFactor = rRenderContext.GetDPIScaleFactor();
+
     if( !bRotate )
     {
-        long width = 5 * rRenderContext.GetDPIScaleFactor();
-        long height = 3 * rRenderContext.GetDPIScaleFactor();
+        long width = 5 * fScaleFactor;
+        long height = 3 * fScaleFactor;
 
         long x = rDropDownRect.Left() + (rDropDownRect.getWidth() - width)/2;
         long y = rDropDownRect.Top() + (rDropDownRect.getHeight() - height)/2;
@@ -2802,8 +2806,8 @@ static void ImplDrawDropdownArrow(vcl::RenderContext& rRenderContext, const Rect
     }
     else
     {
-        long width = 3 * rRenderContext.GetDPIScaleFactor();
-        long height = 5 * rRenderContext.GetDPIScaleFactor();
+        long width = 3 * fScaleFactor;
+        long height = 5 * fScaleFactor;
 
         long x = rDropDownRect.Left() + (rDropDownRect.getWidth() - width)/2;
         long y = rDropDownRect.Top() + (rDropDownRect.getHeight() - height)/2;


More information about the Libreoffice-commits mailing list