summaryrefslogtreecommitdiff
path: root/libreofficekit/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-14 00:09:43 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-13 23:38:37 +0100
commit7b8f630db30ee0066a9f4b6e540368d2fcad7fa8 (patch)
treee40626d45db8a228defeca6e66aba9055974d0a6 /libreofficekit/source
parent44f20abf66ce3f9806ad95522d7d9ae698350499 (diff)
Use o3tl::convert
Change-Id: I78db3001d602ec1a0847785b3c127b9d345f5af7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125173 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'libreofficekit/source')
-rw-r--r--libreofficekit/source/gtk/tilebuffer.cxx7
-rw-r--r--libreofficekit/source/gtk/tilebuffer.hxx2
2 files changed, 5 insertions, 4 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);
}
/* ----------------------------
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx
index 79fa48c555db..239482e34625 100644
--- a/libreofficekit/source/gtk/tilebuffer.hxx
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
@@ -18,8 +18,6 @@
#define LOK_TILEBUFFER_ERROR (LOKTileBufferErrorQuark())
-// We know that VirtualDevices use a DPI of 96.
-const int DPI = 96;
// Lets use a square of side 256 pixels for each tile.
const int nTileSizePixels = 256;