From 7b8f630db30ee0066a9f4b6e540368d2fcad7fa8 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 14 Nov 2021 00:09:43 +0300 Subject: Use o3tl::convert Change-Id: I78db3001d602ec1a0847785b3c127b9d345f5af7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125173 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- libreofficekit/source/gtk/tilebuffer.cxx | 7 +++++-- libreofficekit/source/gtk/tilebuffer.hxx | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'libreofficekit/source') 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 + /* ------------------ 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; -- cgit