QPainter: Skip drawing text if target rect is invalid
If drawText() is passed an empty/invalid target rectangle, we would still go though the motions of laying out and painting the text. Output would normally be empty, as expected, since the clipping would take of it. But for paint devices with limited clipping support, like QSvgGenerator in 1.2 Tiny mode, the text would wrongly show up. Add a shortcut to skip painting text in this case. Fixes: QTBUG-127114 Pick-to: 6.8 Change-Id: Ia7de3e7d2493218fc2a0f6cb0e815285ddceeb1d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
6899008daa
commit
c7df8dda8b
@ -7104,6 +7104,13 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
|
||||
|
||||
Q_ASSERT( !((tf & ~Qt::TextDontPrint)!=0 && option!=nullptr) ); // we either have an option or flags
|
||||
|
||||
if (_r.isEmpty()) {
|
||||
if (!brect)
|
||||
return;
|
||||
else
|
||||
tf |= Qt::TextDontPrint;
|
||||
}
|
||||
|
||||
if (option) {
|
||||
tf |= option->alignment();
|
||||
if (option->wrapMode() != QTextOption::NoWrap)
|
||||
|
Loading…
x
Reference in New Issue
Block a user