[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/tools
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 8 11:44:51 UTC 2020
include/tools/UnitConversion.hxx | 12 ++++++++++++
include/tools/mapunit.hxx | 11 +----------
2 files changed, 13 insertions(+), 10 deletions(-)
New commits:
commit fab4420f23ae77f8c7266d4b4d44313f2e3129d8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 1 17:20:26 2020 +0200
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jun 8 13:44:20 2020 +0200
move unit conversions to UnitConversion, add convertPointToMm100
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93332
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 09e28008376e2f2a187067409d3076e81eba022e)
Change-Id: I3e5a4632e9809562885c1e0ec5c5262acec145d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95783
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/tools/UnitConversion.hxx b/include/tools/UnitConversion.hxx
index 3f2a5d870aee..e59077d8a5fa 100644
--- a/include/tools/UnitConversion.hxx
+++ b/include/tools/UnitConversion.hxx
@@ -10,6 +10,18 @@
#pragma once
+constexpr sal_Int64 convertTwipToMm100(sal_Int64 n)
+{
+ return (n >= 0) ? (n * 127 + 36) / 72 : (n * 127 - 36) / 72;
+}
+
+constexpr sal_Int64 convertPointToMm100(sal_Int64 n) { return convertTwipToMm100(n * 20); }
+
+constexpr sal_Int64 convertMm100ToTwip(sal_Int64 n)
+{
+ return (n >= 0) ? (n * 72 + 63) / 127 : (n * 72 - 63) / 127;
+}
+
// Convert PPT's "master unit" (1/576 inch) to twips
constexpr sal_Int64 convertMasterUnitToTwip(sal_Int64 n) { return n * 2540.0 / 576.0; }
diff --git a/include/tools/mapunit.hxx b/include/tools/mapunit.hxx
index 2209f4d35261..6112bc7ef461 100644
--- a/include/tools/mapunit.hxx
+++ b/include/tools/mapunit.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_TOOLS_MAPUNIT_HXX
#include <sal/types.h>
+#include <tools/UnitConversion.hxx>
enum class MapUnit
{
@@ -34,16 +35,6 @@ enum class MapUnit
LASTENUMDUMMY // used as an error return
};
-constexpr sal_Int64 convertTwipToMm100(sal_Int64 n)
-{
- return (n >= 0)? (n*127+36)/72: (n*127-36)/72;
-}
-
-constexpr sal_Int64 convertMm100ToTwip(sal_Int64 n)
-{
- return (n >= 0)? (n*72+63)/127: (n*72-63)/127;
-}
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list