[Libreoffice-commits] core.git: sc/source sd/source svtools/source svx/source sw/source vcl/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Sep 13 13:47:30 UTC 2017
sc/source/core/data/column2.cxx | 4 ++--
sc/source/ui/unoobj/viewuno.cxx | 2 +-
sc/source/ui/view/gridwin4.cxx | 3 +--
sc/source/ui/view/tabview.cxx | 4 ++--
sc/source/ui/view/tabvwsh3.cxx | 3 +--
sc/source/ui/view/tabvwsha.cxx | 5 ++---
sc/source/ui/view/viewdata.cxx | 12 ++++++------
sd/source/ui/annotations/annotationwindow.cxx | 3 +--
sd/source/ui/view/sdwindow.cxx | 3 +--
svtools/source/brwbox/datwin.cxx | 5 +----
svtools/source/misc/imap.cxx | 6 +++---
svx/source/customshapes/EnhancedCustomShape3d.cxx | 7 +++----
svx/source/svdraw/svdxcgv.cxx | 16 ++++------------
sw/source/core/txtnode/fntcache.cxx | 3 +--
sw/source/uibase/docvw/AnnotationWin2.cxx | 20 +++++++++-----------
sw/source/uibase/docvw/PostItMgr.cxx | 10 +++++-----
sw/source/uibase/uiview/viewport.cxx | 2 +-
vcl/source/window/window2.cxx | 14 +++-----------
18 files changed, 47 insertions(+), 75 deletions(-)
New commits:
commit 158434ee87cfff8870f7c411f435ad46782ab818
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Sep 13 10:16:23 2017 +0200
no need to call GetNumerator() / GetDenominator() for Fraction
simplify the calculations - why have a Fraction and then just split
it up for the calculation?
Change-Id: I81af95e1ee1633f77e088c0990f308b1c169a6a2
Reviewed-on: https://gerrit.libreoffice.org/42242
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 5591f570e462..b6432a735132 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -426,7 +426,7 @@ long ScColumn::GetNeededSize(
// space for AutoFilter button: 20 * nZoom/100
if ( pFlag->HasAutoFilter() && !bTextWysiwyg )
- nDocWidth -= (rZoomX.GetNumerator()*20)/rZoomX.GetDenominator();
+ nDocWidth -= long(rZoomX*20);
aPaper.Width() = nDocWidth;
@@ -564,7 +564,7 @@ long ScColumn::GetNeededSize(
ScMF nFlags = static_cast<const ScMergeFlagAttr&>(pPattern->GetItem(ATTR_MERGE_FLAG)).GetValue();
if (nFlags & ScMF::Auto)
- nValue += (rZoomX.GetNumerator()*20)/rZoomX.GetDenominator();
+ nValue += long(rZoomX*20);
}
return nValue;
}
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index d0708935c440..3ddf6dd0af62 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1406,7 +1406,7 @@ sal_Int16 ScTabViewObj::GetZoom() const
if (pViewSh)
{
const Fraction& rZoomY = pViewSh->GetViewData().GetZoomY(); // Y will be shown
- return (sal_Int16)(( rZoomY.GetNumerator() * 100 ) / rZoomY.GetDenominator());
+ return (sal_Int16)long( rZoomY * 100 );
}
return 0;
}
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index eb059ddd024a..e631bbaed818 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -135,8 +135,7 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle&
ScDDComboBoxButton aComboButton(pDev);
aComboButton.SetOptSizePixel();
- long nBWidth = ( aComboButton.GetSizePixel().Width() * rZoomY.GetNumerator() )
- / rZoomY.GetDenominator();
+ long nBWidth = long(aComboButton.GetSizePixel().Width() * rZoomY);
long nBHeight = nVer + aTextSize.Height() + 1;
Size aButSize( nBWidth, nBHeight );
long nButtonPos = bLayoutRTL ? aOuter.Left() : aOuter.Right()-nBWidth+1;
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 576c564ec2b3..ee238ffa9dac 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -756,7 +756,7 @@ void ScTabView::UpdateVarZoom()
bInZoomUpdate = true;
const Fraction& rOldX = GetViewData().GetZoomX();
const Fraction& rOldY = GetViewData().GetZoomY();
- long nOldPercent = ( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator();
+ long nOldPercent = long(rOldY * 100);
sal_uInt16 nNewZoom = CalcZoom( eZoomType, (sal_uInt16)nOldPercent );
Fraction aNew( nNewZoom, 100 );
@@ -977,7 +977,7 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
// and can't be changed directly
const Fraction& rOldY = aViewData.GetZoomY();
- long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
+ long nOld = (long)( rOldY * 100 );
long nNew;
if ( pData->GetDelta() < 0 )
nNew = std::max( (long) MINZOOM, basegfx::zoomtools::zoomOut( nOld ));
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 37af6223b9e0..a3c9efdf4259 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -692,8 +692,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
SvxZoomType eOldZoomType = GetZoomType();
SvxZoomType eNewZoomType = eOldZoomType;
const Fraction& rOldY = GetViewData().GetZoomY(); // Y is shown
- sal_uInt16 nOldZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 )
- / rOldY.GetDenominator());
+ sal_uInt16 nOldZoom = (sal_uInt16)long( rOldY * 100 );
sal_uInt16 nZoom = nOldZoom;
bool bCancel = false;
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index be117bfbae5e..916eb4828a69 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -300,8 +300,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
else
{
const Fraction& rOldY = GetViewData().GetZoomY();
- sal_uInt16 nZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 )
- / rOldY.GetDenominator());
+ sal_uInt16 nZoom = (sal_uInt16)long( rOldY * 100 );
rSet.Put( SvxZoomItem( SvxZoomType::PERCENT, nZoom, nWhich ) );
}
break;
@@ -313,7 +312,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
else
{
const Fraction& rOldY = GetViewData().GetZoomY();
- sal_uInt16 nCurrentZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
+ sal_uInt16 nCurrentZoom = (sal_uInt16)long( rOldY * 100 );
if( nCurrentZoom )
{
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index e1d4efcef589..2f3a8f19e052 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -161,8 +161,8 @@ void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>
pSettings[SC_POSITION_BOTTOM].Name = SC_POSITIONBOTTOM;
pSettings[SC_POSITION_BOTTOM].Value <<= sal_Int32(nPosY[SC_SPLIT_BOTTOM]);
- sal_Int32 nZoomValue ((aZoomY.GetNumerator() * 100) / aZoomY.GetDenominator());
- sal_Int32 nPageZoomValue ((aPageZoomY.GetNumerator() * 100) / aPageZoomY.GetDenominator());
+ sal_Int32 nZoomValue = long(aZoomY * 100);
+ sal_Int32 nPageZoomValue = long(aPageZoomY * 100);
pSettings[SC_TABLE_ZOOM_TYPE].Name = SC_ZOOMTYPE;
pSettings[SC_TABLE_ZOOM_TYPE].Value <<= sal_Int16(eZoomType);
pSettings[SC_TABLE_ZOOM_VALUE].Name = SC_ZOOMVALUE;
@@ -2318,9 +2318,9 @@ void ScViewData::WriteUserData(OUString& rData)
// PosX[left]/PosX[right]/PosY[top]/PosY[bottom]
// when rows bigger than 8192, "+" instead of "/"
- sal_uInt16 nZoom = (sal_uInt16)((pThisTab->aZoomY.GetNumerator() * 100) / pThisTab->aZoomY.GetDenominator());
+ sal_uInt16 nZoom = (sal_uInt16)long(pThisTab->aZoomY * 100);
rData = OUString::number( nZoom ) + "/";
- nZoom = (sal_uInt16)((pThisTab->aPageZoomY.GetNumerator() * 100) / pThisTab->aPageZoomY.GetDenominator());
+ nZoom = (sal_uInt16)long(pThisTab->aPageZoomY * 100);
rData += OUString::number( nZoom ) + "/";
if (bPagebreak)
rData += "1";
@@ -2790,8 +2790,8 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
pSettings[SC_ACTIVE_TABLE].Value <<= sName;
pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Name = SC_HORIZONTALSCROLLBARWIDTH;
pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Value <<= sal_Int32(pView->GetTabBarWidth());
- sal_Int32 nZoomValue ((pThisTab->aZoomY.GetNumerator() * 100) / pThisTab->aZoomY.GetDenominator());
- sal_Int32 nPageZoomValue ((pThisTab->aPageZoomY.GetNumerator() * 100) / pThisTab->aPageZoomY.GetDenominator());
+ sal_Int32 nZoomValue = long(pThisTab->aZoomY * 100);
+ sal_Int32 nPageZoomValue = long(pThisTab->aPageZoomY * 100);
pSettings[SC_ZOOM_TYPE].Name = SC_ZOOMTYPE;
pSettings[SC_ZOOM_TYPE].Value <<= sal_Int16(pThisTab->eZoomType);
pSettings[SC_ZOOM_VALUE].Name = SC_ZOOMVALUE;
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 6d96fc1d26af..9a73e71c41c2 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -376,8 +376,7 @@ void AnnotationWindow::Rescale()
if ( mpMeta )
{
vcl::Font aFont( mpMeta->GetSettings().GetStyleSettings().GetFieldFont() );
- sal_Int32 nHeight = aFont.GetFontHeight();
- nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ sal_Int32 nHeight = long(aFont.GetFontHeight() * aMode.GetScaleY());
aFont.SetFontHeight( nHeight );
mpMeta->SetControlFont( aFont );
}
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index e5cfc408c57a..c2972fa03db4 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -190,8 +190,7 @@ long Window::GetZoom() const
{
if( GetMapMode().GetScaleX().GetDenominator() )
{
- return GetMapMode().GetScaleX().GetNumerator() * 100L
- / GetMapMode().GetScaleX().GetDenominator();
+ return long(GetMapMode().GetScaleX() * 100);
}
else
{
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index c47e69729ffe..1fa89d1ca296 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -167,10 +167,7 @@ void BrowserColumn::Draw( BrowseBox const & rBox, OutputDevice& rDev, const Poin
void BrowserColumn::ZoomChanged(const Fraction& rNewZoom)
{
- double n = (double)_nOriginalWidth;
- n *= (double)rNewZoom.GetNumerator();
- n /= (double)rNewZoom.GetDenominator();
-
+ double n(_nOriginalWidth * rNewZoom);
_nWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5);
}
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index c0c1bdfa1cc4..4e7e2b4ab0ed 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -36,8 +36,8 @@
#include <memory>
-#define SCALEPOINT(aPT,aFracX,aFracY) (aPT).X()=((aPT).X()*(aFracX).GetNumerator())/(aFracX).GetDenominator(); \
- (aPT).Y()=((aPT).Y()*(aFracY).GetNumerator())/(aFracY).GetDenominator();
+#define SCALEPOINT(aPT,aFracX,aFracY) (aPT).X()=long((aPT).X()*aFracX); \
+ (aPT).Y()=long((aPT).Y()*aFracY);
/******************************************************************************/
@@ -368,7 +368,7 @@ void IMapCircleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
if (!aAverage.GetDenominator())
throw o3tl::divide_by_zero();
- nRadius = ( nRadius * aAverage.GetNumerator() ) / aAverage.GetDenominator();
+ nRadius = double(nRadius * aAverage);
}
bool IMapCircleObject::IsEqual( const IMapCircleObject& rEqObj )
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index f669338274b2..2f5f8abd2d46 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -263,10 +263,9 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
{
fMap = 1.0;
Fraction aFraction( pModel->GetScaleFraction() );
- if ( ( aFraction.GetNumerator() ) != 1 || ( aFraction.GetDenominator() != 1 ) )
- {
- fMap *= aFraction.GetNumerator();
- fMap /= aFraction.GetDenominator();
+ if ( aFraction.GetNumerator() != 1 || aFraction.GetDenominator() != 1 )
+ {
+ fMap *= double(aFraction);
pMap = &fMap;
}
if ( pModel->GetScaleUnit() != MapUnit::Map100thMM )
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 0debc4ab8e31..38db94a5aa37 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -402,18 +402,10 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po
MapUnit eDstMU=mpModel->GetScaleUnit();
FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU));
Fraction aDstFr(mpModel->GetScaleFraction());
- nSizX*=aMapFact.X().GetNumerator();
- nSizX*=rMap.GetScaleX().GetNumerator();
- nSizX*=aDstFr.GetDenominator();
- nSizX/=aMapFact.X().GetDenominator();
- nSizX/=rMap.GetScaleX().GetDenominator();
- nSizX/=aDstFr.GetNumerator();
- nSizY*=aMapFact.Y().GetNumerator();
- nSizY*=rMap.GetScaleY().GetNumerator();
- nSizX*=aDstFr.GetDenominator();
- nSizY/=aMapFact.Y().GetDenominator();
- nSizY/=rMap.GetScaleY().GetDenominator();
- nSizY/=aDstFr.GetNumerator();
+ nSizX *= double(aMapFact.X() * rMap.GetScaleX() * aDstFr);
+ nSizX *= aDstFr.GetDenominator();
+ nSizY *= double(aMapFact.Y() * rMap.GetScaleY());
+ nSizY /= aDstFr.GetNumerator();
long xs=nSizX;
long ys=nSizY;
Point aPos(rCenter.X()-xs/2,rCenter.Y()-ys/2);
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 3925c2ca4939..decd7a709ea9 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -476,8 +476,7 @@ void SwFntObj::CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut )
pOut->GetMapMode().GetScaleY().IsValid() &&
pOut->GetMapMode().GetScaleX() == pOut->GetMapMode().GetScaleY() )
{
- nTmp = ( 100 * pOut->GetMapMode().GetScaleX().GetNumerator() ) /
- pOut->GetMapMode().GetScaleX().GetDenominator();
+ nTmp = long(100 * pOut->GetMapMode().GetScaleX());
}
else
nTmp = 0;
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 5e94b175579e..82ac1ea8c676 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -593,16 +593,14 @@ void SwAnnotationWin::Rescale()
if ( mpMetadataAuthor )
{
vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() );
- sal_Int32 nHeight = aFont.GetFontHeight();
- nHeight = nHeight * rFraction.GetNumerator() / rFraction.GetDenominator();
+ sal_Int32 nHeight = long(aFont.GetFontHeight() * rFraction);
aFont.SetFontHeight( nHeight );
mpMetadataAuthor->SetControlFont( aFont );
}
if ( mpMetadataDate )
{
vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
- sal_Int32 nHeight = aFont.GetFontHeight();
- nHeight = nHeight * rFraction.GetNumerator() / rFraction.GetDenominator();
+ sal_Int32 nHeight = long(aFont.GetFontHeight() * rFraction);
aFont.SetFontHeight( nHeight );
mpMetadataDate->SetControlFont( aFont );
}
@@ -906,10 +904,10 @@ void SwAnnotationWin::DoResize()
const Fraction& fy( GetMapMode().GetScaleY() );
const Point aPos( mpMetadataAuthor->GetPosPixel());
- mpMenuButton->setPosSizePixel( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(),
- aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator(),
- METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(),
- METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() );
+ mpMenuButton->setPosSizePixel( long(aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx),
+ long(aPos.Y()+5*fy),
+ long(METABUTTON_WIDTH*fx),
+ long(METABUTTON_HEIGHT*fy) );
}
void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
@@ -1293,13 +1291,13 @@ sal_Int32 SwAnnotationWin::GetScrollbarWidth()
sal_Int32 SwAnnotationWin::GetMetaButtonAreaWidth()
{
const Fraction& f( GetMapMode().GetScaleX() );
- return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+ return long(METABUTTON_AREA_WIDTH * f);
}
sal_Int32 SwAnnotationWin::GetMetaHeight()
{
const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
- return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
+ return long(POSTIT_META_HEIGHT * f);
}
sal_Int32 SwAnnotationWin::GetMinimumSizeWithMeta()
@@ -1310,7 +1308,7 @@ sal_Int32 SwAnnotationWin::GetMinimumSizeWithMeta()
sal_Int32 SwAnnotationWin::GetMinimumSizeWithoutMeta()
{
const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
- return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
+ return long(POSTIT_MINIMUMSIZE_WITHOUT_META * f);
}
void SwAnnotationWin::SetSpellChecking()
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index a9dc8b89a920..0fbff0b9522b 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -2138,31 +2138,31 @@ void SwPostItMgr::Rescale()
sal_Int32 SwPostItMgr::GetInitialAnchorDistance() const
{
const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_INITIAL_ANCHOR_DISTANCE * f.GetNumerator() / f.GetDenominator();
+ return long(POSTIT_INITIAL_ANCHOR_DISTANCE * f);
}
sal_Int32 SwPostItMgr::GetSpaceBetween() const
{
const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return ( POSTIT_SPACE_BETWEEN ) * f.GetNumerator() / f.GetDenominator();
+ return long(POSTIT_SPACE_BETWEEN * f);
}
sal_Int32 SwPostItMgr::GetScrollSize() const
{
const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return ( POSTIT_SPACE_BETWEEN + POSTIT_MINIMUMSIZE_WITH_META ) * f.GetNumerator() / f.GetDenominator();
+ return long(POSTIT_SPACE_BETWEEN + POSTIT_MINIMUMSIZE_WITH_META * f);
}
sal_Int32 SwPostItMgr::GetMinimumSizeWithMeta() const
{
const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_MINIMUMSIZE_WITH_META * f.GetNumerator() / f.GetDenominator();
+ return long(POSTIT_MINIMUMSIZE_WITH_META * f);
}
sal_Int32 SwPostItMgr::GetSidebarScrollerHeight() const
{
const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_SCROLL_SIDEBAR_HEIGHT * f.GetNumerator() / f.GetDenominator();
+ return long(POSTIT_SCROLL_SIDEBAR_HEIGHT * f);
}
void SwPostItMgr::SetSpellChecking()
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 610f8d39f4ed..4ff6c6edb754 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -995,7 +995,7 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize, bool )
const Fraction& rFrac = GetEditWin().GetMapMode().GetScaleX();
long nZoom = 100;
if (rFrac.IsValid())
- nZoom = rFrac.GetNumerator() * 100L / rFrac.GetDenominator();
+ nZoom = long(rFrac * 100);
const Fraction aFrac( nZoom, 100 );
m_pVRuler->SetZoom( aFrac );
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index c58b2d61d1e0..94d14441e22c 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -448,14 +448,8 @@ void Window::SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::F
{
vcl::Font aFont(rFont);
Size aSize = aFont.GetFontSize();
- double n = double(aSize.Width());
- n *= double(rZoom.GetNumerator());
- n /= double(rZoom.GetDenominator());
- aSize.Width() = WinFloatRound(n);
- n = double(aSize.Height());
- n *= double(rZoom.GetNumerator());
- n /= double(rZoom.GetDenominator());
- aSize.Height() = WinFloatRound(n);
+ aSize.Width() = WinFloatRound(double(aSize.Width() * rZoom));
+ aSize.Height() = WinFloatRound(double(aSize.Height() * rZoom));
aFont.SetFontSize(aSize);
SetPointFont(rRenderContext, aFont);
}
@@ -471,9 +465,7 @@ long Window::CalcZoom( long nCalc ) const
const Fraction& rZoom = GetZoom();
if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
{
- double n = (double)nCalc;
- n *= (double)rZoom.GetNumerator();
- n /= (double)rZoom.GetDenominator();
+ double n = double(nCalc * rZoom);
nCalc = WinFloatRound( n );
}
return nCalc;
More information about the Libreoffice-commits
mailing list