aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2015-06-02 16:30:17 +0300
committerRobin Burchell <robin.burchell@viroteck.net>2015-06-06 11:33:27 +0000
commit180ad9f05e873551d28e25b4840bf1c02b1ef7ee (patch)
tree13ba55d7b94f64acef237c02e55b596e2ea733d3 /src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
parent339e2ac49eb9a3eaf1bd1aa32b996b1688ccb3cf (diff)
QSGDistanceFieldGlyphNode: Use QVarLengthArray to avoid frequent allocation.
This adds a few more text items/frame on my macbook, and more or less halves the amount of transient 608 byte allocations (42mb -> 25mb). Change-Id: Ib1a67c8203f777a2f3b790ff3597d1af34eed2dd Done-with: Gunnar Sletta Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/scenegraph/qsgdistancefieldglyphnode.cpp')
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
index 7e602fc0bd..4630e45ecf 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -200,9 +200,11 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
const QVector<QPointF> positions = m_glyphs.positions();
qreal fontPixelSize = m_glyphs.rawFont().pixelSize();
- QVector<QSGGeometry::TexturedPoint2D> vp;
+ // The template parameters here are assuming that most strings are short, 64
+ // characters or less.
+ QVarLengthArray<QSGGeometry::TexturedPoint2D, 256> vp;
vp.reserve(indexes.size() * 4);
- QVector<ushort> ip;
+ QVarLengthArray<ushort, 384> ip;
ip.reserve(indexes.size() * 6);
qreal maxTexMargin = m_glyph_cache->distanceFieldRadius();