diff options
Diffstat (limited to 'libreofficekit/source')
-rw-r--r-- | libreofficekit/source/gtk/tilebuffer.cxx | 7 | ||||
-rw-r--r-- | libreofficekit/source/gtk/tilebuffer.hxx | 2 |
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; |