vcl/qa/cppunit/pdfexport/pdfexport.cxx |    3 ---
 vcl/source/gdi/pdfwriter_impl.cxx      |   10 ++++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 36cd5e909b7454b1b79c69d2f0db7a76ee2bb47d
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Tue Sep 19 16:43:46 2023 -0400
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Wed Sep 20 19:11:00 2023 +0200

    tdf#156842 increase scale for external PDF data
    
    For some unknown reason, the scale is 8 times larger than for
    non-external PDF XObjects.
    
    This fix also allows the CppunitTest_vcl_pdfexport to run
    successfully on macOS.
    
    Change-Id: I166914e6ac575c50985efba3fb7a38ec758dea1a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157090
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit c2d7c8e5c616980d5fa77ac48babbf27342b2f0a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157113
    Reviewed-by: Patrick Luby <plub...@neooffice.org>

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index af246efd8b39..d299f6d544ce 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -4768,10 +4768,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, 
testPdfImageHyperlink)
     // - Expected: 0.0012626264
     // - Actual  : 0.00126
     // i.e. the rounded reciprocal was 794 points, not the original 792.
-    // FIXME macOS actual value is 0.0001578282, for unknown reasons.
-#if !defined MACOSX
     CPPUNIT_ASSERT_EQUAL(0.0012626264, rtl::math::round(aScale.getY(), 10));
-#endif
 }
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs)
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index c3db7ff872ce..8176f3f86378 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9072,6 +9072,16 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
     sal_Int32 nWrappedFormObject = 0;
     if (!m_aContext.UseReferenceXObject)
     {
+#ifdef MACOSX
+        // tdf#156842 increase scale for external PDF data
+        // For some unknown reason, the scale is 8 times larger than for
+        // non-external PDF XObjects.
+        // This fix also allows the CppunitTest_vcl_pdfexport to run
+        // successfully on macOS.
+        fScaleX = 8.0 / aSize.Width();
+        fScaleY = 8.0 / aSize.Height();
+#endif
+
         // Parse the PDF data, we need that to write the PDF dictionary of our
         // object.
         if (rEmit.m_nExternalPDFDataIndex < 0)

Reply via email to