diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-05-23 11:54:01 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-06-01 18:46:13 +0200 |
commit | 5f8f8889a47a7079fc1beaa179e29cc32aa10e0e (patch) | |
tree | 145293b06eb5b51f33e779d66d5d92691c47edca /include | |
parent | b1c007cd06c01078df481e020d9d81afd4de6a91 (diff) |
vcl: add conversion point to twip int64 & double values
Change-Id: Id54d28b57c055269259317521f59d37dcdf9a456
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95274
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/tools/UnitConversion.hxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/tools/UnitConversion.hxx b/include/tools/UnitConversion.hxx index 2093db6181d9..2585fecbb590 100644 --- a/include/tools/UnitConversion.hxx +++ b/include/tools/UnitConversion.hxx @@ -20,11 +20,15 @@ constexpr sal_Int64 convertMm100ToTwip(sal_Int64 n) return (n >= 0) ? (n * 72 + 63) / 127 : (n * 72 - 63) / 127; } +constexpr sal_Int64 convertPointToTwip(sal_Int64 nNumber) { return nNumber * 20; } + constexpr sal_Int64 convertPointToMm100(sal_Int64 nNumber) { - return convertTwipToMm100(nNumber * 20); + return convertTwipToMm100(convertPointToTwip(nNumber)); } +constexpr double convertPointToTwip(double fNumber) { return fNumber * 20.0; } + constexpr double convertPointToMm100(double fNumber) { return fNumber * 35.27777777778; } // Convert PPT's "master unit" (1/576 inch) to twips |