diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-03-28 09:07:13 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-03-28 09:07:13 +0100 |
commit | bb4f5258a221dd6c429d94686f1641377d61b951 (patch) | |
tree | 0554255f8ebb945aacf92b074410070dee4a6138 | |
parent | a0ac37b9bc45c6016336447ab2ff5a5a251d5bdc (diff) |
Revert "vcl: share GfxLink"
This reverts commit c8f81dbb30e89a19bb7a82f8b52cc02b9049e717.
-rw-r--r-- | sd/source/filter/pdf/sdpdffilter.cxx | 3 | ||||
-rw-r--r-- | vcl/inc/impgraph.hxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 19 | ||||
-rw-r--r-- | vcl/source/gdi/pdfextoutdevdata.cxx | 2 |
5 files changed, 17 insertions, 13 deletions
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index a4747456123b..26d7c70bdd54 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -111,8 +111,7 @@ bool SdPdfFilter::Import() const size_t nGraphicContentSize = aPdfData.getLength(); std::unique_ptr<sal_uInt8[]> pGraphicContent(new sal_uInt8[nGraphicContentSize]); memcpy(pGraphicContent.get(), aPdfData.get(), nGraphicContentSize); - std::shared_ptr<GfxLink> pGfxLink(std::make_shared<GfxLink>( - std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf)); + GfxLink aGfxLink(std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf); auto pPdfData = std::make_shared<uno::Sequence<sal_Int8>>(aPdfData); mrDocument.CreateFirstPages(); diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index c462dc2c67ac..1a8563e95db0 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -45,7 +45,7 @@ private: std::unique_ptr<Animation> mpAnimation; std::shared_ptr<GraphicReader> mpContext; std::shared_ptr<ImpSwapFile> mpSwapFile; - std::shared_ptr<GfxLink> mpGfxLink; + std::unique_ptr<GfxLink> mpGfxLink; GraphicType meType; mutable sal_uLong mnSizeBytes; bool mbSwapOut; @@ -160,7 +160,7 @@ private: bool ImplIsSwapOut() const { return mbSwapOut;} bool ImplIsDummyContext() const { return mbDummyContext; } - void ImplSetLink( const std::shared_ptr<GfxLink>& ); + void ImplSetLink( const GfxLink& ); GfxLink ImplGetLink(); bool ImplIsLink() const; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 7a869a7aee4b..e7f86486d792 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1854,7 +1854,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, } if( nStatus == ERRCODE_NONE ) { - rGraphic.SetLink(GfxLink(std::move(pGraphicContent), nGraphicContentSize, eLinkType)); + rGraphic.SetLink( GfxLink( std::move(pGraphicContent), nGraphicContentSize, eLinkType ) ); } } diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 2d73357ec43d..8027d0d85b1d 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -115,7 +115,6 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic) , maSwapInfo(rImpGraphic.maSwapInfo) , mpContext(rImpGraphic.mpContext) , mpSwapFile(rImpGraphic.mpSwapFile) - , mpGfxLink(rImpGraphic.mpGfxLink) , meType(rImpGraphic.meType) , mnSizeBytes(rImpGraphic.mnSizeBytes) , mbSwapOut(rImpGraphic.mbSwapOut) @@ -125,6 +124,9 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic) , maGraphicExternalLink(rImpGraphic.maGraphicExternalLink) , mnPageNumber(rImpGraphic.mnPageNumber) { + if( rImpGraphic.mpGfxLink ) + mpGfxLink = o3tl::make_unique<GfxLink>( *rImpGraphic.mpGfxLink ); + if( rImpGraphic.mpAnimation ) { mpAnimation = o3tl::make_unique<Animation>( *rImpGraphic.mpAnimation ); @@ -237,7 +239,10 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic ) mbSwapOut = rImpGraphic.mbSwapOut; mpSwapFile = rImpGraphic.mpSwapFile; - mpGfxLink = rImpGraphic.mpGfxLink; + mpGfxLink.reset(); + + if( rImpGraphic.mpGfxLink ) + mpGfxLink = o3tl::make_unique<GfxLink>( *rImpGraphic.mpGfxLink ); maVectorGraphicData = rImpGraphic.maVectorGraphicData; mpPdfData = rImpGraphic.mpPdfData; @@ -1365,11 +1370,11 @@ bool ImpGraphic::ImplSwapIn( SvStream* xIStm ) return bRet; } -void ImpGraphic::ImplSetLink(const GfxLink& rGfxLink) +void ImpGraphic::ImplSetLink( const GfxLink& rGfxLink ) { - mpGfxLink = rGfxLink; + mpGfxLink = o3tl::make_unique<GfxLink>( rGfxLink ); - if (mpGfxLink && mpGfxLink->IsNative()) + if( mpGfxLink->IsNative() ) mpGfxLink->SwapOut(); } @@ -1484,7 +1489,7 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) // set dummy link to avoid creation of additional link after filtering; // we set a default link to avoid unnecessary swapping of native data - aGraphic.SetLink(GfxLink()); + aGraphic.SetLink( GfxLink() ); if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) ) { @@ -1501,7 +1506,7 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() ); if( bSetLink ) - rImpGraphic.ImplSetLink(aLink); + rImpGraphic.ImplSetLink( aLink ); } else { diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 73581f04ca3f..d74996ce2403 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -846,7 +846,7 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic, // 4 means CMYK, which is not handled. return false; - const Size aSize = rGraphic.GetSizePixel(); + Size aSize = rGraphic.GetSizePixel(); // small items better off as PNG anyway if ( aSize.Width() < 32 && |