--- src/plugins/platforms/eglfs/api/qeglfsscreen.cpp.old 2020-06-03 19:21:11.674630268 +0200 +++ src/plugins/platforms/eglfs/api/qeglfsscreen.cpp 2020-06-03 19:35:33.065901734 +0200 @@ -51,6 +51,49 @@ QT_BEGIN_NAMESPACE +namespace { + +static inline QSizeF swapForRotation(QSizeF const &sz) { + static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"); + switch (rotation) { + case 0: + case 180: + case -180: + return sz; + case 90: + case -90: { + return QSizeF {sz.height(), sz.width()}; + } + default: + qWarning("Invalid rotation %d specified in QT_QPA_EGLFS_ROTATION", rotation); + break; + } + return sz; +} + +static inline QDpi swapForRotation(QDpi const &dpi) { + static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"); + switch (rotation) { + case 0: + case 180: + case -180: + return dpi; + case 90: + case -90: { + return QDpi {dpi.second, dpi.first}; + } + default: + qWarning("Invalid rotation %d specified in QT_QPA_EGLFS_ROTATION", rotation); + break; + } + return dpi; +} + + + +} + + QEglFSScreen::QEglFSScreen(EGLDisplay dpy) : m_dpy(dpy), m_surface(EGL_NO_SURFACE), @@ -109,12 +152,12 @@ QSizeF QEglFSScreen::physicalSize() const { - return qt_egl_device_integration()->physicalScreenSize(); + return swapForRotation(qt_egl_device_integration()->physicalScreenSize()); } QDpi QEglFSScreen::logicalDpi() const { - return qt_egl_device_integration()->logicalDpi(); + return swapForRotation(qt_egl_device_integration()->logicalDpi()); } qreal QEglFSScreen::pixelDensity() const