Simplify QHighDpi::fromNativeLocalExposedRegion()

... by using QRectF::toAlignedRect().

Change-Id: I310b2f0ad87c541aa0d63d6a8061783aff791abb
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Alexander Volkov 2019-05-17 18:36:45 +03:00 committed by Alexander Volkov
parent bf548091da
commit 7c483a251b

View File

@ -279,13 +279,9 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
const qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pointRegion;
for (const QRectF rect: pixelRegion) {
const QPointF topLeftP = rect.topLeft() / scaleFactor;
const QSizeF sizeP = rect.size() / scaleFactor;
pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),
QPoint(qCeil(topLeftP.x() + sizeP.width() - 1.0),
qCeil(topLeftP.y() + sizeP.height() - 1.0)));
}
for (const QRectF rect: pixelRegion)
pointRegion += QRectF(rect.topLeft() / scaleFactor, rect.size() / scaleFactor).toAlignedRect();
return pointRegion;
}