[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - vcl/qa vcl/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 6 12:00:44 UTC 2020
vcl/qa/cppunit/pdfexport/pdfexport.cxx | 5 +++--
vcl/source/gdi/pdfwriter_impl.cxx | 10 ++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
New commits:
commit c1a79354e6ae96a287095abcfc53f41aa2d43358
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Feb 3 20:23:23 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Feb 6 13:00:12 2020 +0100
tdf#129976 PDF export of PDF images: adapt transparency to rendering
The bugdoc has a transparent PDF image, and we currently put a white
background behind that in Impress, given that vcl::RenderPDFBitmaps()
works with Bitmap instances, not BitmapEx ones.
This means that in case we preserve transparency during PDF export, the
content that was rendered OK now becomes unreadable.
Adapt the PDF export to do the same as rendering by putting a white
background behind the PDF image.
(cherry picked from commit 7088140dbf1d5e0391c2662f0213018a45620ff9)
Change-Id: I4edcb12fab71bb305d97a50d20fbfbf86d9aab85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87956
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 02e597c76dd5..1603cc83a8e5 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1906,8 +1906,9 @@ void PdfExportTest::testPdfImageResourceInlineXObjectRef()
CPPUNIT_ASSERT_EQUAL(1, FPDFPage_CountObjects(pPdfPage.get()));
FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), 0);
CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(pPageObject));
- CPPUNIT_ASSERT_EQUAL(1, FPDFFormObj_CountObjects(pPageObject));
- FPDF_PAGEOBJECT pFormObject = FPDFFormObj_GetObject(pPageObject, 0);
+ // 2: white background and the actual object.
+ CPPUNIT_ASSERT_EQUAL(2, FPDFFormObj_CountObjects(pPageObject));
+ FPDF_PAGEOBJECT pFormObject = FPDFFormObj_GetObject(pPageObject, 1);
CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(pFormObject));
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 83d5c75bc912..72919042f0a2 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9001,6 +9001,16 @@ void PDFWriterImpl::writeReferenceXObject(ReferenceXObjectEmit& rEmit)
// Reset line width to the default.
aStream.append(" 1 w\n");
+ // vcl::RenderPDFBitmaps() effectively renders a white background for transparent input, be
+ // consistent with that.
+ aStream.append("1 1 1 rg\n");
+ aStream.append("0 0 ");
+ aStream.append(aSize.Width());
+ aStream.append(" ");
+ aStream.append(aSize.Height());
+ aStream.append(" re\n");
+ aStream.append("f*\n");
+
// No reference XObject, draw the form XObject containing the original
// page streams.
aStream.append("/Im");
More information about the Libreoffice-commits
mailing list