diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-13 10:16:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-13 15:47:04 +0200 |
commit | 158434ee87cfff8870f7c411f435ad46782ab818 (patch) | |
tree | 8e3b6fb6d6986318454760b3f8224763d8cad648 /svtools | |
parent | 1b1afc10f4d90e37c5e81961b8b8902133e65b00 (diff) |
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@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/brwbox/datwin.cxx | 5 | ||||
-rw-r--r-- | svtools/source/misc/imap.cxx | 6 |
2 files changed, 4 insertions, 7 deletions
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 ) |