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>
This commit is contained in:
Paul Olav Tvete 2013-04-04 17:54:56 +02:00 committed by The Qt Project
parent 9b7c66ac7f
commit a658d26d84
4 changed files with 18 additions and 0 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -64,6 +64,7 @@ public:
QImage::Format format() const;
QSizeF physicalSize() const;
QDpi logicalDpi() const;
QPlatformCursor *cursor() const;