summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-09 09:22:43 +0300
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2021-11-18 12:33:58 +0100
commit0c0a1f201b51509f888a31b16f6449cc9fc6ea73 (patch)
tree3037902ce058a48206cab7803135697f517ef596
parentb9a3b141d09450a94d601d60f139d17b2ae07040 (diff)
tdf#145158: pre-multiply the value by factor before conversion
Otherwise it is rounded before multiplying. Prior to the regressing commit cfff893b9c82843a90aac4ecdb3a3936721b74a0, it was calculating in twips, and was only converted to points by dividing by 20 in the end, which allowed to keep some precision. Change-Id: I142371dc630584f3fe64b5bfd5b592d46226ce32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124895 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit d55b2631342bc7babf3709f2f83e0e502ebe4014) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124856 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit fc8e53e48e1c690de4aa4dce0fee385b1f7adf73) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124859 Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--svtools/source/misc/unitconv.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx
index bdff583182b5..5e316c5adf46 100644
--- a/svtools/source/misc/unitconv.cxx
+++ b/svtools/source/misc/unitconv.cxx
@@ -186,8 +186,8 @@ tools::Long CalcToPoint( tools::Long nIn, MapUnit eUnit, sal_uInt16 nFactor )
eUnit == MapUnit::MapMM ||
eUnit == MapUnit::MapCM, "this unit is not implemented" );
- if (const auto eTo = MapToO3tlLength(eUnit); eTo != o3tl::Length::invalid)
- return o3tl::convert(nIn, eTo, o3tl::Length::pt) * nFactor;
+ if (const auto eFrom = MapToO3tlLength(eUnit); eFrom != o3tl::Length::invalid)
+ return o3tl::convert(nIn * static_cast<sal_Int64>(nFactor), eFrom, o3tl::Length::pt);
return 0;
}