aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextnodeengine.cpp
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2016-03-02 10:52:04 +0100
committerAndy Nichols <andy.nichols@theqtcompany.com>2016-03-03 10:22:37 +0000
commitbf3de80424edf2b22c5f88a99c0bb18bffadfcf8 (patch)
tree6bd47b067a82a6a21002dfc2308fb4c25ef6c231 /src/quick/items/qquicktextnodeengine.cpp
parent3f20c26f194a947d223d18ac20e23b94666490fe (diff)
QQuickTextNodeEngine: Update boundingRects when merging nodes
QGlyphRun has the behavior that it will calculate it's boundingRect based on the united rects of its contained glyphs unless a boundingRect has been previously set. In the case of QQuickTextNodeEngine the QGlphyRuns are coming from lines in a QTextDocument which would have already had setBoundingRect called. For the QGlyphRun that results from the merging of text nodes to have the correct boundingRect we would need set the united boundingRects of the nodes merged. This could go overlooked with the default renderer because it doesn't need to know the boundingRect of the QGlyphRun to render accurately. However this detail is important for partial update support with Qt Quick 2D Renderer. Change-Id: I4a5bd20afcfadf6cb0ad0659f9a797a980b47a81 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquicktextnodeengine.cpp')
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index 2872c3e230..7b600adf53 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -731,10 +731,13 @@ void QQuickTextNodeEngine::mergeProcessedNodes(QList<BinaryTreeNode *> *regularN
QVector<QPointF> glyphPositions = glyphRun.positions();
glyphPositions.reserve(count);
+ QRectF glyphBoundingRect = glyphRun.boundingRect();
+
for (int j = 1; j < nodes.size(); ++j) {
BinaryTreeNode *otherNode = nodes.at(j);
glyphIndexes += otherNode->glyphRun.glyphIndexes();
primaryNode->ranges += otherNode->ranges;
+ glyphBoundingRect = glyphBoundingRect.united(otherNode->glyphRun.boundingRect());
QVector<QPointF> otherPositions = otherNode->glyphRun.positions();
for (int k = 0; k < otherPositions.size(); ++k)
@@ -746,6 +749,7 @@ void QQuickTextNodeEngine::mergeProcessedNodes(QList<BinaryTreeNode *> *regularN
glyphRun.setGlyphIndexes(glyphIndexes);
glyphRun.setPositions(glyphPositions);
+ glyphRun.setBoundingRect(glyphBoundingRect);
}
}
}