[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - vcl/qa vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 26 09:34:50 UTC 2020


 vcl/qa/cppunit/GraphicTest.cxx |   10 ++++++----
 vcl/source/gdi/impgraph.cxx    |    7 +++++++
 vcl/source/graphic/Manager.cxx |    9 +++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit e2dfc4e3d1c5913c8686f2c80f78514b0eb37a03
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Nov 26 12:38:47 2020 +0900
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Nov 26 10:33:59 2020 +0100

    pdf: workaround to disable swapping of PDF graphic files
    
    This is needed so that swapping doesn't create excesive amount
    of swap files, where each includes the original PDF file, which
    would take a lot of temp disk space. This happens because each
    graphic object swaps out the original PDF and we create one
    graphic object per page.
    
    In a problematic PDF this means it took 20MB (PDF file) * 700
    (pages) ~ 14 GB ob disk space.
    
    Change-Id: Id5f720946ce6b3f5aca92bc6d1af388fe8dbcc64
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106651
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index a2629902241f..98533c972f15 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -438,12 +438,14 @@ void GraphicTest::testSwappingPageNumber()
     CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->ImplIsSwapOut());
 
     // Swapping out
-    CPPUNIT_ASSERT_EQUAL(true, aGraphic.ImplGetImpGraphic()->ImplSwapOut());
-    CPPUNIT_ASSERT_EQUAL(true, aGraphic.ImplGetImpGraphic()->ImplIsSwapOut());
-    CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+    // Following checks were commented out because of the PDF swap issues
+    // with PDF graphic where a lot of swap files were created.
+    //CPPUNIT_ASSERT_EQUAL(true, aGraphic.ImplGetImpGraphic()->ImplSwapOut());
+    //CPPUNIT_ASSERT_EQUAL(true, aGraphic.ImplGetImpGraphic()->ImplIsSwapOut());
+    //CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
 
     // Let's swap in
-    CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+    //CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
     CPPUNIT_ASSERT_EQUAL(true, aGraphic.makeAvailable());
     CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
     CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->ImplIsSwapOut());
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index dc0122de050d..de3cbefc4d79 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1349,6 +1349,13 @@ bool ImpGraphic::ImplSwapOut()
 {
     bool bRet = false;
 
+    // Hack / Workaround - ignore swap out PDF files
+    if (maVectorGraphicData &&
+        maVectorGraphicData->getVectorGraphicDataType() == VectorGraphicDataType::Pdf)
+    {
+        return false;
+    }
+
     if( !ImplIsSwapOut() )
     {
         ::utl::TempFile     aTempFile;
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index 5942b5cb8784..1be52a7e987c 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -109,6 +109,15 @@ sal_Int64 Manager::getGraphicSizeBytes(const ImpGraphic* pImpGraphic)
 {
     if (!pImpGraphic->isAvailable())
         return 0;
+
+    // Hack / Workaround - don't count PDF vector graphic to preven swapping
+    if (pImpGraphic->getVectorGraphicData()
+        && pImpGraphic->getVectorGraphicData()->getVectorGraphicDataType()
+               == VectorGraphicDataType::Pdf)
+    {
+        return 0;
+    }
+
     return pImpGraphic->ImplGetSizeBytes();
 }
 


More information about the Libreoffice-commits mailing list