summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-06-04 16:41:16 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-06-04 16:41:16 +0200
commit02c2de54446824b80e3cee8c610fc3e3fc11419a (patch)
tree0a2f95c2e010cd5926054121a90abb5ab3f7531e /src
parenta050769359f2adeba74ad0c7f4b406353953e883 (diff)
Properly reference count used glyphs in distance field cache
A crucial part of the reference counting was missing, so we would never actually dereference any glyphs. This can have an impact when the caches grow too large and we need to recycle parts of it. Change-Id: I5cc85c5128f2f7c33e74b22b6ec1387cb892e69f Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Jari Karppinen <jari.karppinen@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/q3dsscenemanager.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/q3dsscenemanager.cpp b/src/runtime/q3dsscenemanager.cpp
index 051dd94..71cb74e 100644
--- a/src/runtime/q3dsscenemanager.cpp
+++ b/src/runtime/q3dsscenemanager.cpp
@@ -5234,6 +5234,8 @@ Qt3DCore::QEntity *Q3DSSceneManager::buildText(Q3DSTextNode *text3DS, Q3DSLayerN
glyphInfo.fontScale = float(fontScale);
glyphInfo.shadowOffsetX = shadowOffsetX;
glyphInfo.shadowOffsetY = shadowOffsetY;
+ glyphInfo.cache = cache;
+ glyphInfo.glyphIndexes.append(glyphIndex);
QVector<float> &vertexes = glyphInfo.vertexes;
vertexes.reserve(vertexes.size() + 20 + (text3DS->shadow() ? 16 : 0));
@@ -5361,9 +5363,7 @@ Qt3DCore::QEntity *Q3DSSceneManager::buildText(Q3DSTextNode *text3DS, Q3DSLayerN
const QVector<float> &vertexes = glyphInfo.vertexes;
Q_ASSERT(!vertexes.isEmpty());
- QPair<Q3DSDistanceFieldGlyphCache *, QVector<quint32> > &glyphsReferenced = data->glyphsReferencedInSubentity[subentityIndex];
- if (glyphsReferenced.first != nullptr && !glyphsReferenced.second.isEmpty())
- glyphsReferenced.first->release(glyphsReferenced.second);
+ data->glyphsReferencedInSubentity[subentityIndex] = qMakePair(glyphInfo.cache, glyphInfo.glyphIndexes);
Qt3DCore::QEntity *subentity = subentities.at(subentityIndex++);
Q_ASSERT(subentity != nullptr);