styles: port away from QRegion::rects()

Use begin()/end() instead.

Drop the special handling of rectCount() == 1, since with begin()/end(),
we no longer take the hit of creating a QVector just to be able to return
it from rects().

Change-Id: I19ebc38267951c80bc71aa9d2b5df7403d710064
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
bb10
Marc Mutz 2017-11-30 21:36:31 +01:00
parent 634344411e
commit 6fd1895900
1 changed files with 1 additions and 3 deletions

View File

@ -760,10 +760,8 @@ static QRegion scaleRegion(const QRegion &region, qreal factor)
{
if (region.isEmpty() || qFuzzyCompare(factor, qreal(1)))
return region;
if (region.rectCount() == 1)
return QRegion(scaleRect(QRectF(region.boundingRect()), factor).toRect());
QRegion result;
foreach (const QRect &rect, region.rects())
for (const QRect &rect : region)
result += QRectF(QPointF(rect.topLeft()) * factor, QSizeF(rect.size() * factor)).toRect();
return result;
}