diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-04-04 17:13:45 +0900 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-01 08:59:09 +0200 |
commit | 499f472bd1b3e7f557b743a4f57d3ea0412922fb (patch) | |
tree | 4c5bb5b109aedbb5423ee59f79d97004663686b1 /svtools | |
parent | 22adcad267653c8996b733119dfcb35c6391bdf9 (diff) |
pdf: share pdf data in Graphic
(cherry picked from commit e3b59350ddceb158d01dedfe368bb600a9b37ea8)
Also includes...
graphic: move access to cxx for PDFData and VectorGraphicData
We need strict control when PDFData and VectorGraphicData is
accessed and changed, so create access methods for PDFData and
move the access methods to cxx (for VectorGraphicData).
Reviewed-on: https://gerrit.libreoffice.org/52395
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 18caee072ccbd2be7b947ef2659204d3c18a05f1)
Change-Id: I39324a807a4db559bad5501b5913e62a0aeabf01
8146aa4e206788afff71142e1877fd7a885f4652
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/qa/unit/GraphicObjectTest.cxx | 4 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.cxx | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/svtools/qa/unit/GraphicObjectTest.cxx b/svtools/qa/unit/GraphicObjectTest.cxx index 44a677617091..e304f8e79996 100644 --- a/svtools/qa/unit/GraphicObjectTest.cxx +++ b/svtools/qa/unit/GraphicObjectTest.cxx @@ -333,11 +333,11 @@ void GraphicObjectTest::testPdf() } CPPUNIT_ASSERT_MESSAGE("Missing image", pGraphicObject); - CPPUNIT_ASSERT(pGraphicObject->GetGraphic().getPdfData().hasElements()); + CPPUNIT_ASSERT(pGraphicObject->GetGraphic().getPdfData()->hasElements()); CPPUNIT_ASSERT(pGraphicObject->SwapOut()); CPPUNIT_ASSERT(pGraphicObject->SwapIn()); // This failed, swap out + swap in lost the PDF data. - CPPUNIT_ASSERT(pGraphicObject->GetGraphic().getPdfData().hasElements()); + CPPUNIT_ASSERT(pGraphicObject->GetGraphic().getPdfData()->hasElements()); xComponent->dispose(); #endif diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index da41b631fc93..443cfa91aa90 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -154,7 +154,7 @@ private: // VectorGraphicData support VectorGraphicDataPtr maVectorGraphicData; - uno::Sequence<sal_Int8> maPdfData; + std::shared_ptr<uno::Sequence<sal_Int8>> mpPdfData; bool ImplInit( const GraphicObject& rObj ); void ImplFillSubstitute( Graphic& rSubstitute ); @@ -240,8 +240,8 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) else { mpBmpEx = new BitmapEx( rGraphic.GetBitmapEx() ); - if (rGraphic.getPdfData().hasElements()) - maPdfData = rGraphic.getPdfData(); + if (rGraphic.hasPdfData() && rGraphic.getPdfData()->hasElements()) + mpPdfData = rGraphic.getPdfData(); } } break; @@ -287,8 +287,8 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) else if( mpBmpEx ) { rSubstitute = *mpBmpEx; - if (maPdfData.hasElements()) - rSubstitute.setPdfData(maPdfData); + if (mpPdfData && mpPdfData->hasElements()) + rSubstitute.setPdfData(mpPdfData); } else if( mpAnimation ) { @@ -384,7 +384,7 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut() // #119176# also reset VectorGraphicData maVectorGraphicData.reset(); - maPdfData = uno::Sequence<sal_Int8>(); + mpPdfData.reset(); } void GraphicCacheEntry::GraphicObjectWasSwappedIn( const GraphicObject& rObj ) |