diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-08-19 13:28:55 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-01-14 12:56:33 (GMT) |
commit | 5247001c8d1a012b5895223dd7f09a9a0fd9286e (patch) | |
tree | e7e611a2249b5dd798496e2218042bbd8c7de004 /src/gui/text | |
parent | f7476c80f61de0e7a0a1454d80e7d6808cb89593 (diff) | |
download | Qt-5247001c8d1a012b5895223dd7f09a9a0fd9286e.zip Qt-5247001c8d1a012b5895223dd7f09a9a0fd9286e.tar.gz Qt-5247001c8d1a012b5895223dd7f09a9a0fd9286e.tar.bz2 |
Speed up QStaticText initialization
Instead of translating each position manually afterwards, just have
the matrix do it when calculating the positions inside
getGlyphPositions().
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qstatictext.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 5b0b471..30935f9 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -311,7 +311,7 @@ namespace { { } - virtual void drawTextItem(const QPointF &p, const QTextItem &textItem) + virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) { const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); @@ -331,10 +331,12 @@ namespace { currentItem->glyphs = m_glyphPool; currentItem->glyphPositions = m_positionPool; + QTransform matrix = state->transform(); + matrix.translate(position.x(), position.y()); + QVarLengthArray<glyph_t> glyphs; QVarLengthArray<QFixedPoint> positions; - ti.fontEngine->getGlyphPositions(ti.glyphs, state->transform(), ti.flags, - glyphs, positions); + ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); int size = glyphs.size(); Q_ASSERT(size == ti.glyphs.numGlyphs); @@ -343,13 +345,6 @@ namespace { memmove(currentItem->glyphs, glyphs.constData(), sizeof(glyph_t) * size); memmove(currentItem->glyphPositions, positions.constData(), sizeof(QFixedPoint) * size); - QFixed fx = QFixed::fromReal(p.x()); - QFixed fy = QFixed::fromReal(p.y()); - for (int i=0; i<size; ++i) { - currentItem->glyphPositions[i].x += fx; - currentItem->glyphPositions[i].y += fy; - } - m_glyphPool += size; m_positionPool += size; } |