From e9df01d3db83ec4ba64c99c92495e6dd0e201420 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 6 Jun 2012 13:57:09 -0700 Subject: eglfs refactor: move window creation into qeglfswindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Samuel Rødal --- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 77 ---------------------------- 1 file changed, 77 deletions(-) (limited to 'src/plugins/platforms/eglfs/qeglfsscreen.cpp') 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 -#include - 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(surface); - QEglFSScreen *screen = static_cast(window->screen()); - return screen->surface(); - } - - void swapBuffers(QPlatformSurface *surface) - { - QEglFSWindow *window = static_cast(surface); - QEglFSScreen *screen = static_cast(window->screen()); - if (QEglFSCursor *cursor = static_cast(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(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(this); - that->createAndSetPlatformContext(); - } - return m_platformContext; -} - QT_END_NAMESPACE -- cgit v1.2.3