[Libreoffice-commits] core.git: Branch 'feature/cib_contract57c' - vcl/qa vcl/source
Thorsten Behrens (via logerrit)
logerrit at kemper.freedesktop.org
Tue Feb 4 15:06:19 UTC 2020
dev/null |binary
vcl/qa/cppunit/pdfexport/pdfexport.cxx | 82 ---------------------------------
vcl/source/gdi/pdfwriter_impl.cxx | 11 ++--
3 files changed, 5 insertions(+), 88 deletions(-)
New commits:
commit 08f84adae740cc29c0c15b717c884c8403cf3f94
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Tue Feb 4 16:04:16 2020 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Feb 4 16:05:13 2020 +0100
Revert "tdf#99680 modified clipping for PDF export"
This reverts commit f6726209329fefe9decca8fda8e136b8472a95a2.
Conflicts:
vcl/qa/cppunit/pdfexport/pdfexport.cxx
Change-Id: I2a40ff6fba37e838350e319d8e15a2ca7f042371
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf99680-2.odt b/vcl/qa/cppunit/pdfexport/data/tdf99680-2.odt
deleted file mode 100644
index 47c370004d86..000000000000
Binary files a/vcl/qa/cppunit/pdfexport/data/tdf99680-2.odt and /dev/null differ
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf99680.odt b/vcl/qa/cppunit/pdfexport/data/tdf99680.odt
deleted file mode 100644
index de12f9baa180..000000000000
Binary files a/vcl/qa/cppunit/pdfexport/data/tdf99680.odt and /dev/null differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 5c4b4a8c7141..3265aa28da3d 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -77,8 +77,6 @@ public:
void testTdf107013();
void testTdf107018();
void testTdf107089();
- void testTdf99680();
- void testTdf99680_2();
void testTdf108963();
#if HAVE_MORE_FONTS
/// Test writing ToUnicode CMAP for LTR ligatures.
@@ -115,8 +113,6 @@ public:
CPPUNIT_TEST(testTdf107013);
CPPUNIT_TEST(testTdf107018);
CPPUNIT_TEST(testTdf107089);
- CPPUNIT_TEST(testTdf99680);
- CPPUNIT_TEST(testTdf99680_2);
CPPUNIT_TEST(testTdf108963);
#if HAVE_MORE_FONTS
CPPUNIT_TEST(testTdf115117_1);
@@ -690,84 +686,6 @@ void PdfExportTest::testTdf107089()
CPPUNIT_ASSERT(it != pEnd);
}
-void PdfExportTest::testTdf99680()
-{
- vcl::filter::PDFDocument aDocument;
- load("tdf99680.odt", aDocument);
-
- // The document has one page.
- std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size());
-
- // The page 1 has a stream.
- vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents");
- CPPUNIT_ASSERT(pContents);
- vcl::filter::PDFStreamElement* pStream = pContents->GetStream();
- CPPUNIT_ASSERT(pStream);
- SvMemoryStream& rObjectStream = pStream->GetMemory();
-
- // Uncompress it.
- SvMemoryStream aUncompressed;
- ZCodec aZCodec;
- aZCodec.BeginCompression();
- rObjectStream.Seek(0);
- aZCodec.Decompress(rObjectStream, aUncompressed);
- CPPUNIT_ASSERT(aZCodec.EndCompression());
-
- // Make sure there are no empty clipping regions.
- OString aEmptyRegion("0 0 m h W* n");
- auto pStart = static_cast<const char*>(aUncompressed.GetData());
- const char* pEnd = pStart + aUncompressed.GetSize();
- auto it = std::search(pStart, pEnd, aEmptyRegion.getStr(), aEmptyRegion.getStr() + aEmptyRegion.getLength());
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Empty clipping region detected!", it, pEnd);
-
- // Count save graphic state (q) and restore (Q) operators
- // and ensure their amount is equal
- size_t nSaveCount = std::count(pStart, pEnd, 'q');
- size_t nRestoreCount = std::count(pStart, pEnd, 'Q');
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Save/restore graphic state operators count mismatch!", nSaveCount, nRestoreCount);
-}
-
-void PdfExportTest::testTdf99680_2()
-{
- vcl::filter::PDFDocument aDocument;
- load("tdf99680-2.odt", aDocument);
-
- // For each document page
- std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aPages.size());
- for (size_t nPageNr = 0; nPageNr < aPages.size(); nPageNr++)
- {
- // Get page contents and stream.
- vcl::filter::PDFObjectElement* pContents = aPages[nPageNr]->LookupObject("Contents");
- CPPUNIT_ASSERT(pContents);
- vcl::filter::PDFStreamElement* pStream = pContents->GetStream();
- CPPUNIT_ASSERT(pStream);
- SvMemoryStream& rObjectStream = pStream->GetMemory();
-
- // Uncompress the stream.
- SvMemoryStream aUncompressed;
- ZCodec aZCodec;
- aZCodec.BeginCompression();
- rObjectStream.Seek(0);
- aZCodec.Decompress(rObjectStream, aUncompressed);
- CPPUNIT_ASSERT(aZCodec.EndCompression());
-
- // Make sure there are no empty clipping regions.
- OString aEmptyRegion("0 0 m h W* n");
- auto pStart = static_cast<const char*>(aUncompressed.GetData());
- const char* pEnd = pStart + aUncompressed.GetSize();
- auto it = std::search(pStart, pEnd, aEmptyRegion.getStr(), aEmptyRegion.getStr() + aEmptyRegion.getLength());
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Empty clipping region detected!", it, pEnd);
-
- // Count save graphic state (q) and restore (Q) operators
- // and ensure their amount is equal
- size_t nSaveCount = std::count(pStart, pEnd, 'q');
- size_t nRestoreCount = std::count(pStart, pEnd, 'Q');
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Save/restore graphic state operators count mismatch!", nSaveCount, nRestoreCount);
- }
-}
-
void PdfExportTest::testTdf108963()
{
// Import the bugdoc and export as PDF.
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index a14f64d54ed5..e2dc9dcf409f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10314,13 +10314,12 @@ void PDFWriterImpl::updateGraphicsState(Mode const mode)
getReferenceDevice()->SetMapMode( rNewState.m_aMapMode );
m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode;
- aLine.append("q ");
- if ( rNewState.m_aClipRegion.count() )
- {
+ aLine.append( "q " );
+ if( rNewState.m_aClipRegion.count() )
m_aPages.back().appendPolyPolygon( rNewState.m_aClipRegion, aLine );
- aLine.append( "W* n\n" );
- }
-
+ else
+ aLine.append( "0 0 m h " ); // NULL clip, i.e. nothing visible
+ aLine.append( "W* n\n" );
rNewState.m_aMapMode = aNewMapMode;
getReferenceDevice()->SetMapMode( rNewState.m_aMapMode );
m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode;
More information about the Libreoffice-commits
mailing list