summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-17 09:53:34 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-17 12:37:12 (GMT)
commite1915815bc5ef86b3844608bba46769da5173363 (patch)
tree60c57d7f0cd0ff48b788f9d9e31dbc5f17bb28a6 /tests
parent0ee7b05373d6d7097f3f8c9479c80f936921625e (diff)
downloadQt-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 'tests')
0 files changed, 0 insertions, 0 deletions