diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2019-05-17 18:36:45 +0300 |
---|---|---|
committer | Alexander Volkov <avolkov@astralinux.ru> | 2020-09-23 18:34:02 +0300 |
commit | 7c483a251b446f8cc6df35e7ce370225cc2c6e49 (patch) | |
tree | 4b33181b117a8ba947ebf2d404f04ed7940da653 | |
parent | bf548091daf59972d91db5b6ff407c9c9afe8c36 (diff) |
Simplify QHighDpi::fromNativeLocalExposedRegion()
... by using QRectF::toAlignedRect().
Change-Id: I310b2f0ad87c541aa0d63d6a8061783aff791abb
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r-- | src/gui/kernel/qhighdpiscaling_p.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index bbf970ae25..422f76134a 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -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; } |