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

New commits:
commit 7088140dbf1d5e0391c2662f0213018a45620ff9
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Feb 3 20:23:23 2020 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Feb 4 09:14:49 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.
    
    Change-Id: I4edcb12fab71bb305d97a50d20fbfbf86d9aab85
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87910
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index c13b2ab80c09..c760fc7e1cf4 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -2009,8 +2009,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 ec148b2159d8..6726b02b7173 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8757,6 +8757,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");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to