summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-10-08 21:46:46 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-10-09 09:24:52 +0200
commit5da57ff00b23fd9969a2bfcf4e6e1e8245dfc1a3 (patch)
tree3b6e15cd0ac2551af68d5a7796ad470e79df1840
parent98cc91efd7862d39b3c33b85b744721bec935938 (diff)
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@collabora.co.uk>
-rw-r--r--sw/source/core/docnode/ndtbl.cxx2
-rw-r--r--sw/source/core/inc/fntcache.hxx3
-rw-r--r--sw/source/core/txtnode/fntcache.cxx6
3 files changed, 11 insertions, 0 deletions
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: */