[Libreoffice-commits] core.git: vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 10 14:37:23 UTC 2018
vcl/source/window/status.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit e14ce86a8cf5d161b36890d03abd6aa6ed5bf490
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Fri Aug 10 14:42:48 2018 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Aug 10 16:37:00 2018 +0200
vcl statusbar: store calculated layout in StatusBar::SetItemText()
Otherwise we calculate the layout of the text multiple times, which is a
waste of resources. This effectively reverts commit
a4ed3d9a1ffa1b51ba4352a955c950235f099fdc (tdf#115353 Status bar: no
cache in settext, 2018-03-01).
That seems to be safe, given that I can't reproduce tdf#115353 after
this change, and reading through the comments the bug was reported fixed
after both the mentioned commit and
commit 8d42909cd326cb26d8ba1fb383b5578f820c72ed (tdf#115353 layout fix,
2018-02-23). So either the first one was not necessary, or it just
worked around an underlying problem that has been fixed in the meantime.
Change-Id: I79c014e9ce41be0c06dae65b5195a23d0d88c2aa
Reviewed-on: https://gerrit.libreoffice.org/58830
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 769e43e7b0c9..2d58e68d9752 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1192,8 +1192,8 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText )
std::unique_ptr<SalLayout> pSalLayout = ImplLayout(pItem->maText,0,-1);
long nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pSalLayout.get() ) + nFudge;
- // Invalidate cache.
- pItem->mxLayoutCache.reset();
+ // Store the calculated layout.
+ pItem->mxLayoutCache = std::move(pSalLayout);
if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) ||
((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth ))
More information about the Libreoffice-commits
mailing list