eglfs: Fix physical screen size regression for some hooks

On boards that provide their own custom ways of querying the screen size
the resolution of widget apps became somewhat incorrect after the recent
eglfs/eglconvenience refactor. This is because the physical size query
helper was not able to access the screenSize() provided by the hooks,
it was instead falling back to the default fb query which in turn returned
the default screen size (e.g. 800x600).

Change-Id: I46d487b61341d69dd9cb76d93198b1f44b64f195
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
Laszlo Agocs 2014-01-24 10:32:08 +01:00 committed by The Qt Project
parent 0c01111a80
commit e02bda2105
3 changed files with 6 additions and 4 deletions

View File

@ -435,7 +435,7 @@ void q_printEglConfig(EGLDisplay display, EGLConfig config)
#if (defined(Q_OS_UNIX) && !defined(Q_OS_QNX)) #if (defined(Q_OS_UNIX) && !defined(Q_OS_QNX))
QSizeF q_physicalScreenSizeFromFb(int framebufferDevice) QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize)
{ {
const int defaultPhysicalDpi = 100; const int defaultPhysicalDpi = 100;
static QSizeF size; static QSizeF size;
@ -465,7 +465,9 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice)
screenResolution = QSize(vinfo.xres, vinfo.yres); screenResolution = QSize(vinfo.xres, vinfo.yres);
} }
} else { } else {
screenResolution = q_screenSizeFromFb(framebufferDevice); // Use the provided screen size, when available, since some platforms may have their own
// specific way to query it. Otherwise try querying it from the framebuffer.
screenResolution = screenSize.isEmpty() ? q_screenSizeFromFb(framebufferDevice) : screenSize;
} }
size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w)); size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w));

View File

@ -57,7 +57,7 @@ bool q_hasEglExtension(EGLDisplay display,const char* extensionName);
void q_printEglConfig(EGLDisplay display, EGLConfig config); void q_printEglConfig(EGLDisplay display, EGLConfig config);
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
QSizeF q_physicalScreenSizeFromFb(int framebufferDevice); QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize = QSize());
QSize q_screenSizeFromFb(int framebufferDevice); QSize q_screenSizeFromFb(int framebufferDevice);
int q_screenDepthFromFb(int framebufferDevice); int q_screenDepthFromFb(int framebufferDevice);
#endif #endif

View File

@ -100,7 +100,7 @@ EGLNativeDisplayType QEglFSHooks::platformDisplay() const
QSizeF QEglFSHooks::physicalScreenSize() const QSizeF QEglFSHooks::physicalScreenSize() const
{ {
return q_physicalScreenSizeFromFb(framebuffer); return q_physicalScreenSizeFromFb(framebuffer, screenSize());
} }
QSize QEglFSHooks::screenSize() const QSize QEglFSHooks::screenSize() const