From fa339b3adb53300ae68913bed87e18caf9f2e262 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 10 Aug 2021 08:10:19 +0900 Subject: convert some LogicToLogic calls to use o3tl::convert instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a LogicToLogic uses fixed units, we can use o3tl::convert instead. We can also do the same for all other cases where LogicToLogic is used, but that needs additional investigation to determine if it is safe to do so. Note: MapUnit::Pixel is converted to o3tl::Length::pt because it assumed 72 PPI for a logical pixel, which corresponds with the conversion rate of a point (72 PPI). Today, 96 PPI is standard, which is also used for o3tl::Length:px. Change-Id: I29126df38bfcfda74b5d83d4cb880a378aecd18b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120230 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- o3tl/qa/test-unit_conversion.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'o3tl') diff --git a/o3tl/qa/test-unit_conversion.cxx b/o3tl/qa/test-unit_conversion.cxx index 80b01ea2bf2b..8b2c05c54549 100644 --- a/o3tl/qa/test-unit_conversion.cxx +++ b/o3tl/qa/test-unit_conversion.cxx @@ -875,5 +875,7 @@ static_assert(o3tl::toTwips(25, o3tl::Length::in100) == 1440 / 4); static_assert(o3tl::toTwips(15, o3tl::Length::in100) == 216); // the following twip value used to the constant for 20mm static_assert(o3tl::toTwips(20, o3tl::Length::mm) == 1134); +// 847 100thmm used to represent 24pt +static_assert(o3tl::convert(24, o3tl::Length::pt, o3tl::Length::mm100) == 847); /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ -- cgit v1.2.3