diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-07-12 15:14:48 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-07-31 12:03:53 +0200 |
commit | 8e11dd0fd9d1d994028e80270750415e187da49b (patch) | |
tree | b38906774a0475b0e4a6a50440cf8d9e38a3f5f9 /svx | |
parent | 4ef56ce6539c267f11cc30e4a4f46d51c8bf2b30 (diff) |
svx: make SdrGrafObj::mpReplacementGraphic swappable
These GraphicObjects clog up the GraphicManager cache so it's
effectively useless.
Round-tripping the ML bugdoc, this doesn't provide much of a
speed-up by itself, but together with the previous fix it goes from
3:00 to 1:30 (in an optimized build).
(cherry picked from commit c96e3e226fe4eb8f25c54cce4d653d12eda63ce2)
Reviewed-on: https://gerrit.libreoffice.org/39967
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit c60344481a60f77ff86e7e5f1f1e952f7ba76d90)
Reviewed-on: https://gerrit.libreoffice.org/40178
(cherry picked from commit 142ab1c3e452109d2e5143d26abc6f13e904d7a7)
Change-Id: If52e176c790b94ffef9984be53376a34345b06e3
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index cc14814fc7dc..e0e349442da5 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -444,8 +444,15 @@ const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement()); } else if (pGraphic->GetGraphic().getPdfData().hasElements()) + { // Replacement graphic for bitmap + PDF is just the bitmap. const_cast<SdrGrafObj*>(this)->mpReplacementGraphic = new GraphicObject(pGraphic->GetGraphic().GetBitmapEx()); + } + if (mpReplacementGraphic) + { + mpReplacementGraphic->SetSwapStreamHdl( + LINK(const_cast<SdrGrafObj*>(this), SdrGrafObj, ReplacementSwapHdl)); + } } return mpReplacementGraphic; @@ -1282,6 +1289,29 @@ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly ) } } +IMPL_LINK(SdrGrafObj, ReplacementSwapHdl, const GraphicObject*, pO, SvStream*) +{ + // replacement image is always swapped + if (pO->IsInSwapOut()) + { + SdrSwapGraphicsMode const nSwapMode(pModel->GetSwapGraphicsMode()); + if (nSwapMode & SdrSwapGraphicsMode::TEMP) + { + return GRFMGR_AUTOSWAPSTREAM_TEMP; + } + } + else if (pO->IsInSwapIn()) + { + return GRFMGR_AUTOSWAPSTREAM_TEMP; + } + else + { + assert(!"why is swap handler being called?"); + } + + return GRFMGR_AUTOSWAPSTREAM_NONE; +} + IMPL_LINK( SdrGrafObj, ImpSwapHdl, const GraphicObject*, pO, SvStream* ) { SvStream* pRet = GRFMGR_AUTOSWAPSTREAM_NONE; |