diff options
-rw-r--r-- | extensions/source/scanner/twain32shim.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/extensions/source/scanner/twain32shim.cxx b/extensions/source/scanner/twain32shim.cxx index eab704fcb8db..254ed747281d 100644 --- a/extensions/source/scanner/twain32shim.cxx +++ b/extensions/source/scanner/twain32shim.cxx @@ -30,6 +30,7 @@ #include "twain32shim.hxx" #include <tools/helpers.hxx> #include <twain/twain.h> +#include <o3tl/unit_conversion.hxx> #define WM_TWAIN_FALLBACK (WM_SHIM_INTERNAL + 0) @@ -416,10 +417,11 @@ void ImpTwain::ImplXfer() { // set resolution of bitmap BITMAPINFOHEADER* pBIH = static_cast<BITMAPINFOHEADER*>(pBmpMem); - static const double fFactor = 100.0 / 2.54; - pBIH->biXPelsPerMeter = FRound(fFactor * nXRes); - pBIH->biYPelsPerMeter = FRound(fFactor * nYRes); + static const auto[m, d] + = getConversionMulDiv(o3tl::Length::in, o3tl::Length::m); + pBIH->biXPelsPerMeter = o3tl::convert(nXRes, d, m); + pBIH->biYPelsPerMeter = o3tl::convert(nYRes, d, m); } HANDLE hMap = CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, |