diff options
author | Patrick Luby <plubius@neooffice.org> | 2023-09-19 16:43:46 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-09-27 21:11:33 +0200 |
commit | 1846fedc2360a783f93ff90f4cf95bbda24d63af (patch) | |
tree | 3b1a36b39b4448f5ad9a1df7d98bb3fc0f8c0d40 | |
parent | 6a6d72658b6070a2a07ae7a21a2d92e305f6bebe (diff) |
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>
(cherry picked from commit c2d7c8e5c616980d5fa77ac48babbf27342b2f0a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157114
Reviewed-by: Patrick Luby <plubius@neooffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | vcl/qa/cppunit/pdfexport/pdfexport.cxx | 3 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index d5d8408630aa..0f16c35038ee 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -4174,10 +4174,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 d9e94863e3c5..3551e4808640 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9008,6 +9008,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) |