Optimize text rendering for long lines
QTextLayout::draw does not take into account QPainter's viewport, so it will try to render lines outside visible bounds. This causes a significant slowdown when a very long line is dynamically broken into multiple lines. To avoid this, an explicit text clip rect is set. To avoid making assumptions on the world transform of the painter (it could be sheared or rotated, after all), an explicit clip rect is used instead of guessing whether the resulting line would end up outside the screen or not.
Please register or sign in to comment