diff options
-rw-r--r-- | vcl/qa/cppunit/GraphicTest.cxx | 10 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 7 | ||||
-rw-r--r-- | vcl/source/graphic/Manager.cxx | 9 |
3 files changed, 22 insertions, 4 deletions
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(); } |