summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-07-01 13:58:27 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-07-01 12:03:38 +0000
commitb93264a6f1b41db2c8f865e452b687390c6897a8 (patch)
tree993ac128dc9b82506924c48cf4e8597f07ec12b8
parentd6813d00410a79e133ee58d1197feb5dee877974 (diff)
Clean up comments and dead code
Change-Id: Iadaca71328404bd6c526af5095b32e5e35548182 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp22
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h32
-rw-r--r--src/gui/kernel/qwindow.cpp8
-rw-r--r--src/gui/painting/qpaintdevice.cpp1
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 <typename T>
T fromNativePixels(const T &pixelValue, const QWindow *window)
@@ -443,23 +432,6 @@ QVector<T> toNativePixels(const QVector<T> &pointValues, const QWindow *window)
return pixelValues;
}
-#if 0
-// Any QPair<T, U> where T and U has operator/()
-template <typename T, typename U>
-QPair<T, U> fromNativePixels(const QPair<T, U> &pixelPair, const QWindow *window)
-{
- return qMakePair(fromNativePixels(pixelPair.first, window),
- fromNativePixels(pixelPair.second, window));
-}
-
-// Any QPair<T, U> where T and U has operator*()
-template <typename T, typename U>
-QPair<T, U> toNativePixels(const QPair<T, U> &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