vcl/inc/pdf/pdfcompat.hxx | 2 +- vcl/source/filter/ipdf/pdfread.cxx | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-)
New commits: commit 0d8a5f89bff51480d721395729a67e7b4260aea5 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Aug 10 10:32:21 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Aug 10 12:58:54 2023 +0200 Simplify conversion, and fix a comment Change-Id: I0a952b26e486dcfdedf586e33afa6771b480ac65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155540 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/inc/pdf/pdfcompat.hxx b/vcl/inc/pdf/pdfcompat.hxx index 8f629b3bc8ee..5d6d623a107e 100644 --- a/vcl/inc/pdf/pdfcompat.hxx +++ b/vcl/inc/pdf/pdfcompat.hxx @@ -17,7 +17,7 @@ namespace vcl::pdf { -/// Convert to inch, then assume 96 DPI. +/// Convert to inch, then apply custom resolution. inline double pointToPixel(const double fPoint, const double fResolutionDPI) { return o3tl::convert(fPoint, o3tl::Length::pt, o3tl::Length::in) * fResolutionDPI; diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 18f8c4dee95e..8dc4c967a616 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -368,14 +368,10 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<PDFGraphicResult>& rG if (aPageSize.getWidth() <= 0.0 || aPageSize.getHeight() <= 0.0) continue; - // Returned unit is points, convert that to twip - // 1 pt = 20 twips - constexpr double pointToTwipconversionRatio = 20; - - tools::Long nPageWidth - = convertTwipToMm100(aPageSize.getWidth() * pointToTwipconversionRatio); - tools::Long nPageHeight - = convertTwipToMm100(aPageSize.getHeight() * pointToTwipconversionRatio); + // Returned unit is points + + tools::Long nPageWidth = std::round(convertPointToMm100(aPageSize.getWidth())); + tools::Long nPageHeight = std::round(convertPointToMm100(aPageSize.getHeight())); // Create the Graphic with the VectorGraphicDataPtr and link the original PDF stream. // We swap out this Graphic as soon as possible, and a later swap in