summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl_x11egl.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-09-25 00:21:23 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-09-25 00:21:23 (GMT)
commitf3d15516572394b6bcd44a89dd66516fa4eba56e (patch)
treeb97aa3bc1826d21e6fd8b39f657b1e1e63369270 /src/opengl/qgl_x11egl.cpp
parent7421f79f57f475b9e96e53e5cbd9861c428d4ae3 (diff)
downloadQt-f3d15516572394b6bcd44a89dd66516fa4eba56e.zip
Qt-f3d15516572394b6bcd44a89dd66516fa4eba56e.tar.gz
Qt-f3d15516572394b6bcd44a89dd66516fa4eba56e.tar.bz2
Remove the storage of the EGLSurface from QEglContext
Reviewed-by: Sarah Smith
Diffstat (limited to 'src/opengl/qgl_x11egl.cpp')
-rw-r--r--src/opengl/qgl_x11egl.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index c054860..2214775 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -363,12 +363,12 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext,
// Create the EGL surface to draw into.
QGLContextPrivate *ctxpriv = d->glcx->d_func();
- if (!ctxpriv->eglContext->createSurface(this)) {
+ ctxpriv->eglSurface = ctxpriv->eglContext->createSurface(this);
+ if (ctxpriv->eglSurface == EGL_NO_SURFACE) {
delete ctxpriv->eglContext;
ctxpriv->eglContext = 0;
return;
}
- ctxpriv->eglSurface = ctxpriv->eglContext->surface();
d->eglSurfaceWindowId = w; // Remember the window id we created the surface for
@@ -435,9 +435,14 @@ void QGLWidgetPrivate::recreateEglSurface(bool force)
if ( force || (currentId != eglSurfaceWindowId) ) {
// The window id has changed so we need to re-create the EGL surface
- if (!glcx->d_func()->eglContext->recreateSurface(q))
+ QEglContext *ctx = glcx->d_func()->eglContext;
+ EGLSurface surface = glcx->d_func()->eglSurface;
+ if (surface != EGL_NO_SURFACE)
+ ctx->destroySurface(surface); // Will force doneCurrent() if nec.
+ surface = ctx->createSurface(q);
+ if (surface == EGL_NO_SURFACE)
qWarning("Error creating EGL window surface: 0x%x", eglGetError());
- glcx->d_func()->eglSurface = glcx->d_func()->eglContext->surface();
+ glcx->d_func()->eglSurface = surface;
eglSurfaceWindowId = currentId;
}