From b93264a6f1b41db2c8f865e452b687390c6897a8 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 1 Jul 2015 13:58:27 +0200 Subject: Clean up comments and dead code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iadaca71328404bd6c526af5095b32e5e35548182 Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qhighdpiscaling.cpp | 22 ++-------------------- src/gui/kernel/qhighdpiscaling_p.h | 32 ++------------------------------ src/gui/kernel/qwindow.cpp | 8 ++++++-- src/gui/painting/qpaintdevice.cpp | 1 - 4 files changed, 10 insertions(+), 53 deletions(-) diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 46c9f671df..62f28bd53e 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -242,29 +242,11 @@ void QHighDpiScaling::setScreenFactor(QScreen *screen, qreal factor) m_active = true; screen->setProperty(scaleFactorProperty, QVariant(factor)); - //### dirty hack to force re-evaluation of screen geometry + // hack to force re-evaluation of screen geometry if (screen->handle()) - screen->d_func()->setPlatformScreen(screen->handle()); // update geometries based on scale factor + screen->d_func()->setPlatformScreen(screen->handle()); // updates geometries based on scale factor } -/* - -QPoint QXcbScreen::mapToNative(const QPoint &pos) const -{ - const int dpr = int(devicePixelRatio()); - return (pos - m_geometry.topLeft()) * dpr + m_nativeGeometry.topLeft(); -} - -QPoint QXcbScreen::mapFromNative(const QPoint &pos) const -{ - const int dpr = int(devicePixelRatio()); - return (pos - m_nativeGeometry.topLeft()) / dpr + m_geometry.topLeft(); -} - - - */ - - QPoint QHighDpiScaling::mapPositionToNative(const QPoint &pos, const QPlatformScreen *platformScreen) { if (!platformScreen) diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 5dd9db68c4..d2d8262b1d 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -93,16 +93,6 @@ private: namespace QHighDpi { -// inline QRect fromNativeGeometry(const QRect &pixelRect, const QPlatformScreen *platformScreen) -// { -// return QRect(pixelRect.topLeft(), pixelRect.size() / QHighDpiScaling::factor(platformScreen)); -// } - -// inline QRect toNativeGeometry(const QRect &pointRect, const QPlatformScreen *platformScreen) -// { -// return QRect(pointRect.topLeft(), pointRect.size() * QHighDpiScaling::factor(platformScreen)); -// } - inline QPoint fromNative(const QPoint &pos, qreal scaleFactor, const QPoint &origin) { return (pos - origin) / scaleFactor + origin; @@ -347,8 +337,7 @@ inline QMargins toNativePixels(const QMargins &pointMargins, const QWindow *wind return QMargins(pointMargins.left() * scaleFactor, pointMargins.top() * scaleFactor, pointMargins.right() * scaleFactor, pointMargins.bottom() * scaleFactor); } -#if 1 - //############## expose regions need special handling + inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow *window) { if (!QHighDpiScaling::isActive()) @@ -374,7 +363,7 @@ inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *wi toNative(rect.size(), scaleFactor)); return pixelRegon; } -#endif + // Any T that has operator/() template T fromNativePixels(const T &pixelValue, const QWindow *window) @@ -443,23 +432,6 @@ QVector toNativePixels(const QVector &pointValues, const QWindow *window) return pixelValues; } -#if 0 -// Any QPair where T and U has operator/() -template -QPair fromNativePixels(const QPair &pixelPair, const QWindow *window) -{ - return qMakePair(fromNativePixels(pixelPair.first, window), - fromNativePixels(pixelPair.second, window)); -} - -// Any QPair where T and U has operator*() -template -QPair toNativePixels(const QPair &pointPair, const QWindow *window) -{ - return qMakePair(QHighDpi::toNativePixels(pointPair.first, window), - QHighDpi::toNativePixels(pointPair.second, window)); -} -#endif } QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 4465a9aeb4..5eca2f413f 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1453,8 +1453,12 @@ void QWindow::setGeometry(const QRect &rect) } } -//######### This logic duplicated three times!!!!! -// equivalent to QPlatformWindow::screenForGeometry, but in platform independent coordinates +/* + This is equivalent to QPlatformWindow::screenForGeometry, but in platform + independent coordinates. The duplication is unfortunate, but there is a + chicken and egg problem here: we cannot convert to native coordinates + before we know which screen we are on. +*/ QScreen *QWindowPrivate::screenForGeometry(const QRect &newGeometry) { Q_Q(QWindow); diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index 27d4bbcfd7..59fe456139 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -103,5 +103,4 @@ int QPaintDevice::metric(PaintDeviceMetric m) const } } - QT_END_NAMESPACE -- cgit v1.2.3