QTextLayout: Reserve space ahead of time.

We know the size, so use it instead of allowing QVector to reallocate.

Change-Id: I2d18c30ef0d050326bb03c54da61459c40eb7af6
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Robin Burchell 2015-02-13 22:25:45 +01:00 committed by Konstantin Ritt
parent ce86d73850
commit dbd21d0879

View File

@ -2091,7 +2091,9 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
qreal minY = 0; qreal minY = 0;
qreal maxY = 0; qreal maxY = 0;
QVector<quint32> glyphs; QVector<quint32> glyphs;
glyphs.reserve(glyphsArray.size());
QVector<QPointF> positions; QVector<QPointF> positions;
positions.reserve(glyphsArray.size());
for (int i=0; i<glyphsArray.size(); ++i) { for (int i=0; i<glyphsArray.size(); ++i) {
glyphs.append(glyphsArray.at(i) & 0xffffff); glyphs.append(glyphsArray.at(i) & 0xffffff);