diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-07-25 14:55:45 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-07-26 12:02:32 +0200 |
commit | e4042435ba15e6da669f541cd43580f85dbeae3f (patch) | |
tree | 527211f3055fb46e09eadb518c5163861020328d /src/plugins/platforms/eglfs/qeglfsscreen.cpp | |
parent | c7c8a38ec313b998d0df76cd15fa360f56d213e2 (diff) |
Get the eglfs plugin compiling.
Change-Id: I5addb1a2593a670d559b9fbf9183f52af410895b
Reviewed-on: http://codereview.qt.nokia.com/2176
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfsscreen.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsscreen.cpp | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 42195364ae..953ae704dc 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -40,9 +40,10 @@ ****************************************************************************/ #include "qeglfsscreen.h" +#include "qeglfswindow.h" -#include "../eglconvenience/qeglconvenience.h" -#include "../eglconvenience/qeglplatformcontext.h" +#include <QtPlatformSupport/private/qeglconvenience_p.h> +#include <QtPlatformSupport/private/qeglplatformcontext_p.h> #ifdef Q_OPENKODE #include <KD/kd.h> @@ -86,6 +87,23 @@ static struct AttrInfo attrs[] = { {-1, 0}}; #endif //QEGL_EXTRA_DEBUG +class QEglFSContext : public QEGLPlatformContext +{ +public: + QEglFSContext(const QSurfaceFormat &format, QPlatformGLContext *share, EGLDisplay display, + EGLint eglClientVersion = 2, EGLenum eglApi = EGL_OPENGL_ES_API) + : QEGLPlatformContext(format, share, display, eglClientVersion, eglApi) + { + } + + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) + { + QEglFSWindow *window = static_cast<QEglFSWindow *>(surface); + QEglFSScreen *screen = static_cast<QEglFSScreen *>(window->screen()); + return screen->surface(); + } +}; + QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) : m_depth(32) , m_format(QImage::Format_Invalid) @@ -136,32 +154,29 @@ void QEglFSScreen::createAndSetPlatformContext() const { void QEglFSScreen::createAndSetPlatformContext() { - QPlatformWindowFormat platformFormat = QPlatformWindowFormat::defaultFormat(); - - platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); + QSurfaceFormat platformFormat; QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH"); if (depthString.toInt() == 16) { - platformFormat.setDepth(16); + platformFormat.setDepthBufferSize(16); platformFormat.setRedBufferSize(5); platformFormat.setGreenBufferSize(6); platformFormat.setBlueBufferSize(5); m_depth = 16; m_format = QImage::Format_RGB16; } else { - platformFormat.setDepth(32); + platformFormat.setDepthBufferSize(32); platformFormat.setRedBufferSize(8); platformFormat.setGreenBufferSize(8); platformFormat.setBlueBufferSize(8); m_depth = 32; m_format = QImage::Format_RGB32; } - if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty()) { - platformFormat.setSampleBuffers(true); - } + if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty()) + platformFormat.setSamples(4); - EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); + EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat); EGLNativeWindowType eglWindow = 0; #ifdef Q_OPENKODE @@ -193,16 +208,7 @@ void QEglFSScreen::createAndSetPlatformContext() qWarning("\n"); #endif - EGLint temp; - EGLint attribList[32]; - - temp = 0; - - attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION; - attribList[temp++] = 2; // GLES version 2 - attribList[temp++] = EGL_NONE; - - QEGLPlatformContext *platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API); + QEGLPlatformContext *platformContext = new QEglFSContext(platformFormat, 0, m_dpy); m_platformContext = platformContext; EGLint w,h; // screen size detection |