diff options
author | Andy Nichols <andy.nichols@digia.com> | 2013-06-01 17:57:34 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-03 22:24:07 +0200 |
commit | fb7e0e24c4181e9e97d85a3a80c3e2ef5a40770a (patch) | |
tree | 349b696e93881e0c2f934eacf2e25424b9d8ec9c /src/plugins/platforms | |
parent | 51a35f5c021836bf31276749c638addefac12ebb (diff) |
eglfs: Fix bug determining physical screen size
In the situation that the screenSize EGLFS hook had been defined, but
not the physicalScreenSize, the uninitialized contents of
fb_var_screeninfo vinfo would be used to calculate the fall-back
physical screen size. Since this value is undefined, devices like the
Raspberry Pi would end unable to render DPI dependent fonts.
Change-Id: Ic9f67c1c646cc7b328b695b76a84d78577fefcd8
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index 91a97ff977..c334f46c2c 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -99,6 +99,7 @@ QSizeF QEglFSHooks::physicalScreenSize() const struct fb_var_screeninfo vinfo; int w = -1; int h = -1; + QSize screenResolution; if (framebuffer != -1) { if (ioctl(framebuffer, FBIOGET_VSCREENINFO, &vinfo) == -1) { @@ -106,12 +107,15 @@ QSizeF QEglFSHooks::physicalScreenSize() const } else { w = vinfo.width; h = vinfo.height; + screenResolution = QSize(vinfo.xres, vinfo.yres); } + } else { + screenResolution = screenSize(); } const int defaultPhysicalDpi = 100; - size.setWidth(w <= 0 ? vinfo.xres * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w)); - size.setHeight(h <= 0 ? vinfo.yres * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h)); + size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w)); + size.setHeight(h <= 0 ? screenResolution.height() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h)); if (w <= 0 || h <= 0) { qWarning("EGLFS: Unable to query physical screen size, defaulting to %d dpi.\n" |