diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-06-02 16:30:17 +0300 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2015-06-06 11:33:27 +0000 |
commit | 180ad9f05e873551d28e25b4840bf1c02b1ef7ee (patch) | |
tree | 13ba55d7b94f64acef237c02e55b596e2ea733d3 /src/quick | |
parent | 339e2ac49eb9a3eaf1bd1aa32b996b1688ccb3cf (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')
-rw-r--r-- | src/quick/scenegraph/qsgdistancefieldglyphnode.cpp | 6 |
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(); |