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 <vmiklos@collabora.com>
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index b26176c..a07ceeb 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -5290,10 +5290,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 64dfc80..8d4082b 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9125,6 +9125,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)