From 531036fa296b6bfca5ec93c4d7ef1264dc6e7b65 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 15 Mar 2018 09:45:52 +0900 Subject: change EscherBlipCache to cache Graphic and not GObject uniqueID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In addition change from map to unordered_map. Change-Id: Ief33d6ebd7e42606ab20fcf9fc91020b1ef9aab6 Reviewed-on: https://gerrit.libreoffice.org/51306 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- filter/source/msfilter/msdffimp.cxx | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'filter') diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 794aa8a4a59b..960fa7f1ed2d 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -6294,10 +6294,9 @@ bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape, } -/* access to a BLIP at runtime (if the Blip-Number is already known) - --------------------------- -******************************************************************************/ -bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle* pVisArea ) +/** Access to a BLIP at runtime (if the Blip-Number is already known) + */ +bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rGraphic, tools::Rectangle* pVisArea ) { if (!pStData) return false; @@ -6305,24 +6304,22 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle bool bOk = false; // initialize result variable // check if a graphic for this blipId is already imported - if ( nIdx_) + if (nIdx_) { - std::map::iterator iter = aEscherBlipCache.find(nIdx_); + auto iter = aEscherBlipCache.find(nIdx_); if (iter != aEscherBlipCache.end()) { - /* if this entry is available, then it should be possible - to get the Graphic via GraphicObject */ - GraphicObject aGraphicObject( iter->second ); - rData = aGraphicObject.GetGraphic(); - if ( rData.GetType() != GraphicType::NONE ) + /* if this entry is available */ + rGraphic = Graphic(iter->second); + if (rGraphic.GetType() != GraphicType::NONE) bOk = true; else aEscherBlipCache.erase(iter); } } - if ( !bOk ) + if (!bOk) { sal_uInt16 nIdx = sal_uInt16( nIdx_ ); if (!nIdx || (m_pBLIPInfos->size() < nIdx)) @@ -6347,7 +6344,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle if (!bOk || pStData->GetError()) pStData->ResetError(); else - bOk = GetBLIPDirect( *pStData, rData, pVisArea ); + bOk = GetBLIPDirect( *pStData, rGraphic, pVisArea ); if( pStData2 && !bOk ) { // Error, but the is a second chance: There is a second @@ -6361,7 +6358,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle if (!bOk || pStData2->GetError()) pStData2->ResetError(); else - bOk = GetBLIPDirect( *pStData2, rData, pVisArea ); + bOk = GetBLIPDirect( *pStData2, rGraphic, pVisArea ); // restore of FilePos of the second data stream pStData2->Seek( nOldPosData2 ); } @@ -6370,11 +6367,10 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle if( &rStCtrl != pStData ) pStData->Seek( nOldPosData ); - if ( bOk ) + if (bOk) { // create new BlipCacheEntry for this graphic - GraphicObject aGraphicObject( rData ); - aEscherBlipCache.insert(std::make_pair(nIdx_,aGraphicObject.GetUniqueID())); + aEscherBlipCache.insert(std::make_pair(nIdx_, rGraphic)); } } -- cgit