From b7c2764145be2c3fc50397f241dbdb0c53f9befd Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Fri, 28 Oct 2016 23:55:53 +0200 Subject: convert usages of DPIScalingFactor from int to float MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I049b3d2cde4dcb8c8c0690d75a015a43cb71b0c0 Reviewed-on: https://gerrit.libreoffice.org/30381 Reviewed-by: Tomaž Vajngerl Tested-by: Tomaž Vajngerl --- vcl/source/window/status.cxx | 2 +- vcl/source/window/toolbox.cxx | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'vcl') diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 70778b09e7c2..0c727b32b9e9 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 4378e01c6aee..e46d0da88dff 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; -- cgit