summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/qeglfsscreen.cpp
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish.1.ramakrishnan@nokia.com>2012-06-06 13:57:09 -0700
committerQt by Nokia <qt-info@nokia.com>2012-06-12 04:29:49 +0200
commite9df01d3db83ec4ba64c99c92495e6dd0e201420 (patch)
tree11ed60d01ae457b676d9be854762c58b9b178da3 /src/plugins/platforms/eglfs/qeglfsscreen.cpp
parent040f30decd24c32f71f14eeaed5fdcd58b2dce3d (diff)
eglfs refactor: move window creation into qeglfswindow
This potentially allows the creation of multiple QWindows. The platform context is now in a seperate file and the integration provides a new instance of the context allowing creation of multiple contexts. Change-Id: If2b6fa29b573d87c0a4cd0a8eff1f044bd1ff9b8 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfsscreen.cpp')
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp77
1 files changed, 0 insertions, 77 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index 4f14efc0a7..07cdbafd0a 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -44,45 +44,10 @@
#include "qeglfswindow.h"
#include "qeglfshooks.h"
-#include <QtPlatformSupport/private/qeglconvenience_p.h>
-#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
-
QT_BEGIN_NAMESPACE
-// #define QEGL_EXTRA_DEBUG
-
-class QEglFSContext : public QEGLPlatformContext
-{
-public:
- QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
- EGLenum eglApi = EGL_OPENGL_ES_API)
- : QEGLPlatformContext(format, share, display, eglApi)
- {
- }
-
- EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface)
- {
- QEglFSWindow *window = static_cast<QEglFSWindow *>(surface);
- QEglFSScreen *screen = static_cast<QEglFSScreen *>(window->screen());
- return screen->surface();
- }
-
- void swapBuffers(QPlatformSurface *surface)
- {
- QEglFSWindow *window = static_cast<QEglFSWindow *>(surface);
- QEglFSScreen *screen = static_cast<QEglFSScreen *>(window->screen());
- if (QEglFSCursor *cursor = static_cast<QEglFSCursor *>(screen->cursor()))
- cursor->paintOnScreen();
-
- QEGLPlatformContext::swapBuffers(surface);
- }
-};
-
QEglFSScreen::QEglFSScreen(EGLDisplay dpy)
: m_dpy(dpy)
- , m_platformContext(0)
- , m_surface(0)
- , m_window(0)
, m_cursor(0)
{
#ifdef QEGL_EXTRA_DEBUG
@@ -101,39 +66,6 @@ QEglFSScreen::QEglFSScreen(EGLDisplay dpy)
QEglFSScreen::~QEglFSScreen()
{
delete m_cursor;
-
- if (m_surface)
- eglDestroySurface(m_dpy, m_surface);
-
- hooks->destroyNativeWindow(m_window);
-}
-
-void QEglFSScreen::createAndSetPlatformContext() const {
- const_cast<QEglFSScreen *>(this)->createAndSetPlatformContext();
-}
-
-void QEglFSScreen::createAndSetPlatformContext()
-{
- QSurfaceFormat platformFormat = hooks->defaultSurfaceFormat();
-
- EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat);
-
- m_window = hooks->createNativeWindow(hooks->screenSize());
-
-#ifdef QEGL_EXTRA_DEBUG
- q_printEglConfig(m_dpy, config);
-#endif
-
- m_surface = eglCreateWindowSurface(m_dpy, config, m_window, NULL);
- if (m_surface == EGL_NO_SURFACE) {
- qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError());
- eglTerminate(m_dpy);
- qFatal("EGL error");
- }
- // qWarning("Created surface %dx%d\n", w, h);
-
- QEGLPlatformContext *platformContext = new QEglFSContext(platformFormat, 0, m_dpy);
- m_platformContext = platformContext;
}
QRect QEglFSScreen::geometry() const
@@ -156,13 +88,4 @@ QPlatformCursor *QEglFSScreen::cursor() const
return m_cursor;
}
-QPlatformOpenGLContext *QEglFSScreen::platformContext() const
-{
- if (!m_platformContext) {
- QEglFSScreen *that = const_cast<QEglFSScreen *>(this);
- that->createAndSetPlatformContext();
- }
- return m_platformContext;
-}
-
QT_END_NAMESPACE