summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-07-12 15:14:48 +0200
committerMichael Stahl <mstahl@redhat.com>2017-07-14 16:20:33 +0200
commitc96e3e226fe4eb8f25c54cce4d653d12eda63ce2 (patch)
treeb17f825f5b359c81e7344404e187d6fbfd9ad5e4 /svx
parentb3992ddcd13082a934246b717ae22f57394e6533 (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). Change-Id: If52e176c790b94ffef9984be53376a34345b06e3
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdograf.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 59c5a57e9125..d0f042ca0b71 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -439,8 +439,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;
@@ -1279,6 +1286,29 @@ void SdrGrafObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrink
}
}
+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;