From 7c483a251b446f8cc6df35e7ce370225cc2c6e49 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 17 May 2019 18:36:45 +0300 Subject: [PATCH] Simplify QHighDpi::fromNativeLocalExposedRegion() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... by using QRectF::toAlignedRect(). Change-Id: I310b2f0ad87c541aa0d63d6a8061783aff791abb Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qhighdpiscaling_p.h | 10 +++------- 1 file 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; }