diff options
author | Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> | 2012-06-01 12:18:45 -0700 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-05 18:48:40 +0200 |
commit | b5e041d48d49ad684dcc8c922d47cbaa4e53574a (patch) | |
tree | a78c0a2ed32f5ff5090022b4226c597c7aa78ba2 /src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | |
parent | f35470a442286018f91cc4cdc7571a5c99926d99 (diff) |
eglfs refactor: Query screen and format info from hooks
This allows boards to customize what they really work best for
without having to set environment variables.
Change-Id: Ib40c3a870ade568f66e37e621a8abc6b17e39411
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfshooks_stub.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index d0e3e4546d..fbc02d1a01 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -61,6 +61,39 @@ QSize QEglFSHooks::screenSize() const return QSize(); } +int QEglFSHooks::screenDepth() const +{ + static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt(); + return depth == 16 ? 16 : 32; +} + +QImage::Format QEglFSHooks::screenFormat() const +{ + return screenDepth() == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; +} + +QSurfaceFormat QEglFSHooks::defaultSurfaceFormat() const +{ + QSurfaceFormat format; + if (screenDepth() == 16) { + format.setDepthBufferSize(16); + format.setRedBufferSize(5); + format.setGreenBufferSize(6); + format.setBlueBufferSize(5); + } else { + format.setDepthBufferSize(24); + format.setStencilBufferSize(8); + format.setRedBufferSize(8); + format.setGreenBufferSize(8); + format.setBlueBufferSize(8); + } + + static int samples = qgetenv("QT_QPA_EGLFS_MULTISAMPLE").toInt(); + format.setSamples(samples); + + return format; +} + EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size) { Q_UNUSED(size); |