[Libreoffice-commits] core.git: vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 8 07:03:10 UTC 2020


 vcl/source/filter/ipdf/pdfread.cxx |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 9b69b624bf7a35e99b15da1709b4050cfbe46829
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Apr 7 21:08:20 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Apr 8 09:02:35 2020 +0200

    vcl pdf import: use convertTwipToMm100()
    
    Change-Id: Iad407c85f83cde84f713bffca735868b3e2a7307
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91852
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 386ede2d0f42..022fa502f986 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -278,13 +278,12 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si
         if (FPDF_GetPageSizeByIndex(pPdfDocument, nPageIndex, &fPageWidth, &fPageHeight) == 0)
             continue;
 
-        // Returned unit is points, convert that to 100th mm (hmm).
-        // 1 pt = 20 twips, 1 twip = 1.7638888888888889 hmm
-        // TODO: use some conversion class for that
-        constexpr double pointToHMMconversionRatio = 20.0 * 1.7638888888888889;
+        // Returned unit is points, convert that to twip
+        // 1 pt = 20 twips
+        constexpr double pointToTwipconversionRatio = 20;
 
-        long nPageWidth = fPageWidth * pointToHMMconversionRatio;
-        long nPageHeight = fPageHeight * pointToHMMconversionRatio;
+        long nPageWidth = convertTwipToMm100(fPageWidth * pointToTwipconversionRatio);
+        long nPageHeight = convertTwipToMm100(fPageHeight * pointToTwipconversionRatio);
 
         auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(
             aPdfDataArray, OUString(), VectorGraphicDataType::Pdf, nPageIndex);


More information about the Libreoffice-commits mailing list