summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_p.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-08-19 18:34:15 +0200
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-08-24 20:56:14 +0000
commitd856d0e14663978f62c5e9c93396e25b0d466a97 (patch)
tree1dd765c7a5162fe38e6b5aef110d75e8f28cee08 /src/gui/text/qfontengine_p.h
parent59ee2584e203d2ea7f4051e97d9d86fae05861cc (diff)
Limit glyph caches per QFontEngine to four per context, not four in total
The limitation of four glyph caches per font engine was to prevent memory spikes during rotation of text. But in an application with multiple top level OpenGL windows, each with their own context, we'd end up trashing the list of glyph caches during rendering, even if each window just drew the same static text. Having a shared context between the windows helped a bit, but had other performance issues due to the globally shared state, so the better approach is to limit the caches to four per context. This brings the multiwindow manual test from a grinding 4fps on macOS to a smooth 60fps for 20 concurrent windows. Task-number: QTBUG-52372 Change-Id: I26edd5f6edb5c7818e14b2203af062df19ae7127 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/text/qfontengine_p.h')
-rw-r--r--src/gui/text/qfontengine_p.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 7ddc5c0c32..39cf826ee2 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -316,12 +316,11 @@ private:
GlyphCacheEntry &operator=(const GlyphCacheEntry &);
- const void *context;
QExplicitlySharedDataPointer<QFontEngineGlyphCache> cache;
- bool operator==(const GlyphCacheEntry &other) const { return context == other.context && cache == other.cache; }
+ bool operator==(const GlyphCacheEntry &other) const { return cache == other.cache; }
};
-
- mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;
+ typedef QLinkedList<GlyphCacheEntry> GlyphCaches;
+ mutable QHash<const void *, GlyphCaches> m_glyphCaches;
private:
QVariant m_userData;