diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-12-02 16:00:45 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-12-02 20:27:31 +0000 |
commit | 14e138652d04f43d6da8fb2fee3ed9ba8b8fdfce (patch) | |
tree | c8ad3e6fc35d5e6f48f68aaa06c66e374abab361 /src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp | |
parent | bf0af8b5a24de7e595929a64948a3548936aaaee (diff) |
eglfs: Fix the logical dpi calculation for some devices
KMS and backends using the default logicalDpi() implementation
(EGLDevice for instance) did not correctly check if the physical width
and height are greater than zero. The result is a NaN dpi on systems
where the drivers report a zero size. This in turn breaks font
rendering and various other things.
isValid() is changed to !isEmpty(). This way we check for width and
height > 0 instead of >= 0.
Change-Id: I8cdcf93a116379ae33c65599ad792a3b712518a3
Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp index 064b9f6306..8af48a893b 100644 --- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp @@ -212,11 +212,14 @@ QSize QEGLDeviceIntegration::screenSize() const QDpi QEGLDeviceIntegration::logicalDpi() const { - QSizeF ps = physicalScreenSize(); - QSize s = screenSize(); + const QSizeF ps = physicalScreenSize(); + const QSize s = screenSize(); - return QDpi(25.4 * s.width() / ps.width(), - 25.4 * s.height() / ps.height()); + if (!ps.isEmpty() && !s.isEmpty()) + return QDpi(25.4 * s.width() / ps.width(), + 25.4 * s.height() / ps.height()); + else + return QDpi(100, 100); } qreal QEGLDeviceIntegration::pixelDensity() const |