[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Oct 9 07:25:14 UTC 2018
sw/source/core/docnode/ndtbl.cxx | 2 ++
sw/source/core/inc/fntcache.hxx | 3 +++
sw/source/core/txtnode/fntcache.cxx | 6 ++++++
3 files changed, 11 insertions(+)
New commits:
commit 5da57ff00b23fd9969a2bfcf4e6e1e8245dfc1a3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Mon Oct 8 21:46:46 2018 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Tue Oct 9 09:24:52 2018 +0200
tdf#119993 sw: clear the font cache text glyphs on table col change
This helps not storing pre-computed vcl text layouts which are most
probably never re-used anymore.
Approximate numbers for memory usage with 10 column resizes for the
bugdoc:
- old: 310MB -> 454MB
- new: 309MB -> 310MB
Change-Id: Ifb88b88e1bffe2c2670089930fc2d22ff19576ce
Reviewed-on: https://gerrit.libreoffice.org/61562
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 2fb87340dad7..1fc5606eaff3 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -92,6 +92,7 @@
#include <rootfrm.hxx>
#include <fldupde.hxx>
#include <calbck.hxx>
+#include <fntcache.hxx>
#include <o3tl/numeric.hxx>
#include <tools/datetimeutils.hxx>
#include <sal/log.hxx>
@@ -2877,6 +2878,7 @@ void SwDoc::SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rO
}
rTab.SetTabCols( rNew, rOld, pStart, bCurRowOnly );
::ClearFEShellTabCols(*this, nullptr);
+ SwClearFntCacheTextGlyphs();
getIDocumentState().SetModified();
}
diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx
index 1fb81bde56e8..04cfc4abc219 100644
--- a/sw/source/core/inc/fntcache.hxx
+++ b/sw/source/core/inc/fntcache.hxx
@@ -52,6 +52,9 @@ public:
void Flush();
};
+/// Clears the pre-calculated text glyphs in all SwFntObj instances.
+void SwClearFntCacheTextGlyphs();
+
// Font cache, global variable, created/destroyed in txtinit.cxx
extern SwFntCache *pFntCache;
extern SwFntObj *pLastFont;
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index dd377d0c1090..740710c6c27e 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2682,4 +2682,10 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
return false;
}
+void SwClearFntCacheTextGlyphs()
+{
+ for (SwFntObj* pFntObj = pFntCache->First(); pFntObj; pFntObj = SwFntCache::Next(pFntObj))
+ pFntObj->GetTextGlyphs().clear();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list