libreoffice/impress-table-performance.patch

135 lines
4.6 KiB
Diff
Raw Normal View History

From 894594c1ff0323f537270d1ca2dec33cdbb9b19c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= <matus.kukan@collabora.com>
Date: Tue, 27 May 2014 10:39:45 +0200
Subject: [PATCH] Related bnc#822625: Cache minimum height for table cells.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Change-Id: I35e295347a046376289f5d4fd5468860d0b8f0ae
(cherry picked from commit 5792e76cb5beb630c135f57b74f57d74dd2dc2b0)
Reviewed-on: https://gerrit.libreoffice.org/9519
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
---
svx/source/table/cell.cxx | 14 +++++++++-----
svx/source/table/cell.hxx | 1 +
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index d4f199b..7e04db7 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -358,6 +358,7 @@ Cell::Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) th
, mbMerged( sal_False )
, mnRowSpan( 1 )
, mnColSpan( 1 )
+, mnCachedMinHeight( -1 )
, mxTable( rTableObj.getTable() )
{
if( rTableObj.GetModel() )
@@ -524,6 +525,7 @@ void Cell::setMerged()
void Cell::notifyModified()
{
+ mnCachedMinHeight = -1;
if( mxTable.is() )
mxTable->setModified( sal_True );
}
@@ -680,8 +682,10 @@ sal_Int32 Cell::getMinimumHeight()
if( !mpProperties )
return 0;
+ if( mnCachedMinHeight != -1 )
+ return mnCachedMinHeight;
+
SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
- sal_Int32 nMinimumHeight = 0;
Rectangle aTextRect;
TakeTextAnchorRect( aTextRect );
@@ -692,7 +696,7 @@ sal_Int32 Cell::getMinimumHeight()
if(pEditOutliner)
{
pEditOutliner->SetMaxAutoPaperSize(aSize);
- nMinimumHeight = pEditOutliner->GetTextHeight()+1;
+ mnCachedMinHeight = pEditOutliner->GetTextHeight()+1;
}
else /*if ( hasText() )*/
{
@@ -705,12 +709,12 @@ sal_Int32 Cell::getMinimumHeight()
{
rOutliner.SetText(*GetOutlinerParaObject());
}
- nMinimumHeight=rOutliner.GetTextHeight()+1;
+ mnCachedMinHeight=rOutliner.GetTextHeight()+1;
rOutliner.Clear();
}
- nMinimumHeight += GetTextUpperDistance() + GetTextLowerDistance();
- return nMinimumHeight;
+ mnCachedMinHeight += GetTextUpperDistance() + GetTextLowerDistance();
+ return mnCachedMinHeight;
}
// -----------------------------------------------------------------------------
diff --git a/svx/source/table/cell.hxx b/svx/source/table/cell.hxx
index 1b26b1c..ba2c6f6 100644
--- a/svx/source/table/cell.hxx
+++ b/svx/source/table/cell.hxx
@@ -222,6 +222,7 @@ private:
::sal_Bool mbMerged;
::sal_Int32 mnRowSpan;
::sal_Int32 mnColSpan;
+ ::sal_Int32 mnCachedMinHeight;
Rectangle maCellRect;
--
1.8.4.5
From 20fc8dfadada521bed3cb9db672edcdf35db3c39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= <matus.kukan@collabora.com>
Date: Tue, 27 May 2014 16:37:30 +0200
Subject: [PATCH] Related bnc#822625: Cache FontEntry with the original
FontSelectPattern.
Otherwise we do not hit cache directly, only after expensive call to
ImplFindByFont.
(cherry picked from commits a6b00d16eb27a5e7e31c721671001a909ecef960
and 16a62079018aea0e72636bdb00576487b4e830b9)
Change-Id: If15b368feeba94c8fff8ee7cbe049fc4a2069768
---
vcl/source/gdi/outdev3.cxx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 537f8aa..a36fc85 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -2214,6 +2214,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList,
ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList,
FontSelectPattern& aFontSelData, ImplDirectFontSubstitution* pDevSpecific )
{
+ FontSelectPattern aFontSelDataOrig(aFontSelData);
// check if a directly matching logical font instance is already cached,
// the most recently used font usually has a hit rate of >50%
ImplFontEntry *pEntry = NULL;
@@ -2300,8 +2301,9 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList,
}
#endif
- // add the new entry to the cache
- maFontInstanceList[ aFontSelData ] = pEntry;
+ // Add the new entry to the cache with the original FontSelectPattern,
+ // so that we can find it next time as a direct cache hit.
+ maFontInstanceList[ aFontSelDataOrig ] = pEntry;
}
mpFirstEntry = pEntry;
--
1.8.4.5