summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-10-29 14:59:47 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-29 20:25:53 +0100
commit9278577e8f3a3d8a65a3a02c2d4c59b5fa4c26ec (patch)
tree5877e750387e652ba90b8c6ca1212b8675a83d77 /starmath
parent7605de7303f57c1320d96d5ff833f492d002cfb7 (diff)
Drop some intermediate conversions to pixel
Should improve independence of results from resolution. Some output devices are not even pixel-based (e.g., PDF output). Change-Id: Id4359bfa0d7ba76ac4e4694c3ae4f042a780cd53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158620 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/document.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 29dd3f2ef411..59b23522ffa5 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -1544,11 +1544,9 @@ void SmDocShell::Impl_Print(OutputDevice& rOutDev, const SmPrintUIOptions& rPrin
case PRINT_SIZE_SCALED:
if (!aSize.IsEmpty())
{
- Size OutputSize(rOutDev.LogicToPixel(aOutRect.GetSize(), MapMode(SmMapUnit())));
- Size GraphicSize(rOutDev.LogicToPixel(aSize, MapMode(SmMapUnit())));
sal_uInt16 nZ
- = std::min(o3tl::convert(OutputSize.Width(), 100, GraphicSize.Width()),
- o3tl::convert(OutputSize.Height(), 100, GraphicSize.Height()));
+ = std::min(o3tl::convert(aOutRect.GetWidth(), 100, aSize.Width()),
+ o3tl::convert(aOutRect.GetHeight(), 100, aSize.Height()));
if (nZ > MINZOOM)
nZ -= 10;
Fraction aFraction(std::clamp(nZ, MINZOOM, MAXZOOM), 100);
@@ -1568,14 +1566,13 @@ void SmDocShell::Impl_Print(OutputDevice& rOutDev, const SmPrintUIOptions& rPrin
}
}
- aSize = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aSize, OutputMapMode), MapMode(SmMapUnit()));
+ aSize = OutputDevice::LogicToLogic(aSize, OutputMapMode, MapMode(SmMapUnit()));
Point aPos(aOutRect.Left() + (aOutRect.GetWidth() - aSize.Width()) / 2,
aOutRect.Top() + (aOutRect.GetHeight() - aSize.Height()) / 2);
- aPos = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aPos, MapMode(SmMapUnit())), OutputMapMode);
- aOutRect
- = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aOutRect, MapMode(SmMapUnit())), OutputMapMode);
+ aPos = OutputDevice::LogicToLogic(aPos, MapMode(SmMapUnit()), OutputMapMode);
+ aOutRect = OutputDevice::LogicToLogic(aOutRect, MapMode(SmMapUnit()), OutputMapMode);
rOutDev.SetMapMode(OutputMapMode);
rOutDev.SetClipRegion(vcl::Region(aOutRect));