summaryrefslogtreecommitdiff
path: root/libreofficekit/source/gtk/tilebuffer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libreofficekit/source/gtk/tilebuffer.cxx')
-rw-r--r--libreofficekit/source/gtk/tilebuffer.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx
index 6836031661bc..3c73c9dddf83 100644
--- a/libreofficekit/source/gtk/tilebuffer.cxx
+++ b/libreofficekit/source/gtk/tilebuffer.cxx
@@ -9,19 +9,22 @@
#include "tilebuffer.hxx"
+#include <o3tl/unit_conversion.hxx>
+
/* ------------------
Utility functions
------------------
*/
+// We know that VirtualDevices use a DPI of 96.
float pixelToTwip(float fInput, float zoom)
{
- return (fInput / DPI / zoom) * 1440.0f;
+ return o3tl::toTwips(fInput / zoom, o3tl::Length::px);
}
float twipToPixel(float fInput, float zoom)
{
- return fInput / 1440.0f * DPI * zoom;
+ return o3tl::convert(fInput * zoom, o3tl::Length::twip, o3tl::Length::px);
}
/* ----------------------------