diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-03-17 09:53:34 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-03-17 12:37:12 (GMT) |
commit | e1915815bc5ef86b3844608bba46769da5173363 (patch) | |
tree | 60c57d7f0cd0ff48b788f9d9e31dbc5f17bb28a6 /src/gui/image/qpixmap_s60.cpp | |
parent | 0ee7b05373d6d7097f3f8c9479c80f936921625e (diff) | |
download | Qt-e1915815bc5ef86b3844608bba46769da5173363.zip Qt-e1915815bc5ef86b3844608bba46769da5173363.tar.gz Qt-e1915815bc5ef86b3844608bba46769da5173363.tar.bz2 |
Optimize speed of QTextLayout and QPainter::drawText
QFontEngine::boundingBox() is potentially an expensive function, because
the font engines have to consult the underlying font system for the
values and usually do not cache the results. To account for negative
right bearing in the case of text layouts, we would call the
boundingBox() function at every potential break point in the text,
causing a great performance hit on text drawing. To minimize the impact
of this, we only calculate the right bearing when we have to:
1. If subtracting the minimum right bearing from the width would cause
the line to expand beyond its maximum line width, then we have to
get the actual metrics of the last glyph to check if we need to break.
2. The line's final textWidth should include the negative right bearing,
so unless it has already been calculated, we calculate it when the
correct line width has been found.
This gives us a potentially huge speed-up, since boundingBox() will in
the common case only be called once for the last glyph in each text
line.
Task-number: QTBUG-9074
Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/gui/image/qpixmap_s60.cpp')
0 files changed, 0 insertions, 0 deletions