From a658d26d84d1fa2b45d8e39d45cf93040a384603 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 4 Apr 2013 17:54:56 +0200 Subject: EglFS: allow the hook to override logicalDpi() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-29674 Change-Id: Id88a8735ceb7f5bcb63344b3b0653486a6caa70d Reviewed-by: Samuel Rødal Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/eglfs/qeglfshooks.h | 2 ++ src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 9 +++++++++ src/plugins/platforms/eglfs/qeglfsscreen.cpp | 6 ++++++ src/plugins/platforms/eglfs/qeglfsscreen.h | 1 + 4 files changed, 18 insertions(+) (limited to 'src/plugins/platforms') 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 +#include #include #include #include @@ -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; -- cgit v1.2.3