Fraction->double in conversionFract

Change-Id: I3a4cf3f85699543f528604a4a50e7a390c75c392
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202310
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2026-03-22 12:52:42 +01:00
parent 22df9df691
commit b4a1f8ebf8
6 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ public:
auto popIt = rDevice.ScopedPush(vcl::PushFlags::MAPMODE);
MapMode aDeviceMapMode(rDevice.GetMapMode());
const Fraction scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
const double scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
Fraction scaleX = Fraction(aOutputSize.Width(), rTileRect.GetWidth()) * scale;
Fraction scaleY = Fraction(aOutputSize.Height(), rTileRect.GetHeight()) * scale;
aDeviceMapMode.SetScaleX(scaleX);
+2 -2
View File
@@ -14,10 +14,10 @@
#include <sal/types.h>
#include <tools/fract.hxx>
inline Fraction conversionFract(o3tl::Length from, o3tl::Length to)
inline double conversionFract(o3tl::Length from, o3tl::Length to)
{
const auto[mul, div] = o3tl::getConversionMulDiv(from, to);
return { mul, div };
return double(mul) / div;
}
template <typename N> constexpr auto convertTwipToMm100(N n)
+1 -1
View File
@@ -3880,7 +3880,7 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
// that VirtualDevices use a DPI of 96.
// We specifically calculate these scales first as we're still
// in TWIPs, and might as well minimize the number of conversions.
const Fraction scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
const double scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
Fraction scaleX = Fraction(nOutputWidth, nTileWidth) * scale;
Fraction scaleY = Fraction(nOutputHeight, nTileHeight) * scale;
+1 -1
View File
@@ -236,7 +236,7 @@ void LokChartHelper::PaintAllChartsOnTile(VirtualDevice& rDevice,
// Scaling. Must convert from pixels to twips. We know
// that VirtualDevices use a DPI of 96.
const Fraction scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
const double scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
Fraction scaleX = Fraction(nOutputWidth, nTileWidth) * scale;
Fraction scaleY = Fraction(nOutputHeight, nTileHeight) * scale;
aMapMode.SetScaleX(scaleX);
+1 -1
View File
@@ -227,7 +227,7 @@ void LokStarMathHelper::PaintAllInPlaceOnTile(VirtualDevice& rDevice, int nOutpu
MapMode aMapMode(rDevice.GetMapMode());
// Scaling. Must convert from pixels to twips. We know that VirtualDevices use a DPI of 96.
const Fraction scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
const double scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
const Fraction scaleX = Fraction(nOutputWidth, nTileWidth) * scale;
const Fraction scaleY = Fraction(nOutputHeight, nTileHeight) * scale;
aMapMode.SetScaleX(scaleX);
+1 -1
View File
@@ -2176,7 +2176,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
// Scaling. Must convert from pixels to twips. We know
// that VirtualDevices use a DPI of 96.
const Fraction scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
const double scale = conversionFract(o3tl::Length::px, o3tl::Length::twip);
Fraction scaleX = Fraction(contextWidth, tileWidth) * scale;
Fraction scaleY = Fraction(contextHeight, tileHeight) * scale;
aMapMode.SetScaleX(scaleX);