diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2013-04-04 17:54:56 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-05 16:25:59 +0200 |
commit | a658d26d84d1fa2b45d8e39d45cf93040a384603 (patch) | |
tree | 8cfe3910e9264fbf613280e11fdb57650e65baf8 | |
parent | 9b7c66ac7f0ed3c240ccbabe2b460d7ad4171749 (diff) |
EglFS: allow the hook to override logicalDpi()
Task-number: QTBUG-29674
Change-Id: Id88a8735ceb7f5bcb63344b3b0653486a6caa70d
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsscreen.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsscreen.h | 1 |
4 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h index c4ac7185fb..c8486b9378 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks.h +++ b/src/plugins/platforms/eglfs/qeglfshooks.h @@ -43,6 +43,7 @@ #define QEGLFSHOOKS_H #include <qpa/qplatformintegration.h> +#include <qpa/qplatformscreen.h> #include <QtGui/QSurfaceFormat> #include <QtGui/QImage> #include <EGL/egl.h> @@ -61,6 +62,7 @@ public: virtual EGLNativeDisplayType platformDisplay() const; virtual QSizeF physicalScreenSize() const; virtual QSize screenSize() const; + virtual QDpi logicalDpi() const; virtual int screenDepth() const; virtual QImage::Format screenFormat() const; virtual QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const; diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index 8200fa70b2..5c264834b3 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -178,6 +178,15 @@ QSize QEglFSHooks::screenSize() const return size; } +QDpi QEglFSHooks::logicalDpi() const +{ + QSizeF ps = physicalScreenSize(); + QSize s = screenSize(); + + return QDpi(25.4 * s.width() / ps.width(), + 25.4 * s.height() / ps.height()); +} + int QEglFSHooks::screenDepth() const { static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt(); diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 83f50dd382..e104bd7f2b 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -88,6 +88,12 @@ QSizeF QEglFSScreen::physicalSize() const return QEglFSHooks::hooks()->physicalScreenSize(); } +QDpi QEglFSScreen::logicalDpi() const +{ + return QEglFSHooks::hooks()->logicalDpi(); +} + + QPlatformCursor *QEglFSScreen::cursor() const { return m_cursor; diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h index 8d3c5dbaec..298a67cd3a 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.h +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -64,6 +64,7 @@ public: QImage::Format format() const; QSizeF physicalSize() const; + QDpi logicalDpi() const; QPlatformCursor *cursor() const; |