aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-06-01 09:45:55 +0200
committerQt by Nokia <qt-info@nokia.com>2011-08-19 15:15:56 +0200
commit1cc58fdf174656a52603af00cb40478066c5abd4 (patch)
tree432054d60316a981b17655dc888805e4e5434966 /src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
parent7059861a8b8d48b5187eb46a2678f306ba288320 (diff)
Make QSGTextNode back-end for QML's TextInput and TextEdit
Use the general QSGTextNode class as back-end for all text elements in QML to make all text elements look the same and use the same text rasterization back-end. This requires a few rewrites in the text node to support e.g. selections. Crashes seen with threaded renderer in TextEdit and TextInput on Mac are also fixed by this. Reviewed-by: Jiang Jiang Task-number: QTBUG-18019, QTBUG-20017 Change-Id: I4207faf180c83422e5f8b726741321af395bd724 Reviewed-on: http://codereview.qt.nokia.com/2865 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp')
-rw-r--r--src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp b/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
index beeda1e476..cb3dab959c 100644
--- a/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -167,6 +167,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
QPointF margins(2, 2);
QPointF texMargins = margins / m_glyph_cache->fontScale();
+ QVector<QPointF> glyphPositions = m_glyphs.positions();
for (int i = 0; i < glyphIndexes.size(); ++i) {
quint32 glyphIndex = glyphIndexes.at(i);
QSGDistanceFieldGlyphCache::Metrics metrics = m_glyph_cache->glyphMetrics(glyphIndex);
@@ -183,9 +184,9 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
c.height += texMargins.y() * 2;
}
- QPointF glyphPosition = m_glyphs.positions().at(i) + m_position;
- qreal x = glyphPosition.x() + metrics.baselineX;
- qreal y = glyphPosition.y() - metrics.baselineY;
+ const QPointF &glyphPosition = glyphPositions.at(i);
+ qreal x = glyphPosition.x() + metrics.baselineX + m_position.x();
+ qreal y = glyphPosition.y() - metrics.baselineY + m_position.y();
boundingRect |= QRectF(x, y, metrics.width, metrics.height);