summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-04-04 07:30:20 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-04 19:32:21 +0200
commit47056e78d3d963272e449e8f917ae3208b7aa940 (patch)
tree17fbde1538e56a6116446d94e57d785ce489f639 /src
parent0b5911f37619acc20463f01df5588764e22a35b0 (diff)
Optimize QTextEngine::insertionPointsForLine() a bit
Reserve the insertionPoints vector capacity prior to multiple append()-s. Change-Id: I97ab5b2a1add9f2e87c04ad0707bf516c13ff4d7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index a95adc75de..53fd37abba 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -3181,6 +3181,9 @@ int QTextEngine::lineNumberForTextPosition(int pos)
void QTextEngine::insertionPointsForLine(int lineNum, QVector<int> &insertionPoints)
{
QTextLineItemIterator iterator(this, lineNum);
+
+ insertionPoints.reserve(iterator.line.length);
+
bool lastLine = lineNum >= lines.size() - 1;
while (!iterator.atEnd()) {