summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Luby <plubius@neooffice.org>2023-09-19 16:43:46 -0400
committerXisco Fauli <xiscofauli@libreoffice.org>2023-09-21 08:29:19 +0200
commit58b35faee869383974da0acfdf24577603634b7b (patch)
tree0ca60f612a9cb045a92fc8ccb4644034b76c2fd1
parent5bb81b11352b2a5118ce390f449d926a48f9766e (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.cxx3
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx10
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 d9abb0885c22..28935f59a5a5 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8984,6 +8984,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)