diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-04-21 14:07:09 +0300 |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-04-26 11:00:41 +0300 |
commit | 7616da319f0c64bf18900fe17ee3c6dd60496174 (patch) | |
tree | 8253ca98838fd4264d733a1464b3916c6f2cc82d /src/opengl/qwindowsurface_gl.cpp | |
parent | 4e6ae1cae429e7598bed8c24981cb89ad96ef26c (diff) | |
download | qt4-tools-7616da319f0c64bf18900fe17ee3c6dd60496174.tar.gz |
Fix for GL graphcics system orientation which
OpenGL context needs to be recreated on Symbian
when orientation changes. Previously only the EGL
surface was recreated which wasn't enough.
Task-number: QTBUG-18850
Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index ed541cebb9..b056caa54c 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -706,7 +706,6 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } else { glFlush(); } - return; } @@ -856,8 +855,22 @@ void QGLWindowSurface::updateGeometry() { bool hijack(true); QWidgetPrivate *wd = window()->d_func(); - if (wd->extraData() && wd->extraData()->glContext) - hijack = false; // we already have gl context for widget + if (wd->extraData() && wd->extraData()->glContext) { +#ifdef Q_OS_SYMBIAN // Symbian needs to recreate the context when native window size changes + if (d_ptr->size != geometry().size()) { + if (window() != qt_gl_share_widget()) + --(_qt_gl_share_widget()->widgetRefCount); + + delete wd->extraData()->glContext; + wd->extraData()->glContext = 0; + d_ptr->ctx = 0; + } + else +#endif + { + hijack = false; // we already have gl context for widget + } + } if (hijack) hijackWindow(window()); @@ -878,35 +891,6 @@ void QGLWindowSurface::updateGeometry() { d_ptr->size = surfSize; -#ifdef Q_OS_SYMBIAN - if (!hijack) { // Symbian needs to recreate EGL surface when native window size changes - if (ctx->d_func()->eglSurface != EGL_NO_SURFACE) { - eglDestroySurface(ctx->d_func()->eglContext->display(), - ctx->d_func()->eglSurface); - } - - ctx->d_func()->eglSurface = QEgl::createSurface(ctx->device(), - ctx->d_func()->eglContext->config()); - - eglGetError(); // Clear error state. - if (hasPartialUpdateSupport()) { - eglSurfaceAttrib(ctx->d_func()->eglContext->display(), - ctx->d_func()->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - - if (eglGetError() != EGL_SUCCESS) - qWarning("QGLWindowSurface: could not enable preserved swap behaviour"); - } else { - eglSurfaceAttrib(ctx->d_func()->eglContext->display(), - ctx->d_func()->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); - - if (eglGetError() != EGL_SUCCESS) - qWarning("QGLWindowSurface: could not enable destroyed swap behaviour"); - } - } -#endif - if (d_ptr->ctx) { #ifndef QT_OPENGL_ES_2 if (d_ptr->destructive_swap_buffers) |