diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-01-10 14:11:52 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-01-10 14:11:52 (GMT) |
commit | 44afade51254de33a0f31baf39034af0eb73842f (patch) | |
tree | cd9c75a8d37be58a5022a545aa939eff9e196730 /src/opengl | |
parent | 3263f8036128cc4403cf6383324f5390eecee13b (diff) | |
parent | 2bddf15b87a9e27bfdcbc3aec5d79da49f070c15 (diff) | |
download | Qt-44afade51254de33a0f31baf39034af0eb73842f.zip Qt-44afade51254de33a0f31baf39034af0eb73842f.tar.gz Qt-44afade51254de33a0f31baf39034af0eb73842f.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qglfunctions.h | 5 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 20 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl_p.h | 3 |
3 files changed, 24 insertions, 4 deletions
diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h index e06de7f..88f43c0 100644 --- a/src/opengl/qglfunctions.h +++ b/src/opengl/qglfunctions.h @@ -42,6 +42,11 @@ #ifndef QGLFUNCTIONS_H #define QGLFUNCTIONS_H +#ifdef __GLEW_H__ +#warning qglfunctions.h is not compatible with GLEW, GLEW defines will be undefined +#warning To use GLEW with Qt, do not include <QtOpenGL> or <QGLFunctions> after glew.h +#endif + #include <QtOpenGL/qgl.h> QT_BEGIN_HEADER diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 6185ff8..81575e3 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -302,6 +302,7 @@ struct QGLWindowSurfacePrivate }; QGLFormat QGLWindowSurface::surfaceFormat; +QGLWindowSurface::SwapMode QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap; void QGLWindowSurfaceGLPaintDevice::endPaint() { @@ -549,9 +550,10 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & // did_paint is set to true in ::beginPaint. ::beginPaint means that we // at least cleared the background (= painted something). In EGL API it's a - // mistakte to call swapBuffers if nothing was painted. This check protects - // the flush func from being executed if it's for nothing. - if (!d_ptr->did_paint) + // mistake to call swapBuffers if nothing was painted unless + // EGL_BUFFER_PRESERVED is set. This check protects the flush func from + // being executed if it's for nothing. + if (!hasPartialUpdateSupport() && !d_ptr->did_paint) return; QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); @@ -576,6 +578,9 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & const GLenum target = GL_TEXTURE_2D; Q_UNUSED(target); + if (QGLWindowSurface::swapBehavior == QGLWindowSurface::KillSwap) + return; + if (context()) { context()->makeCurrent(); @@ -623,7 +628,14 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } } #endif - bool doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2; + bool doingPartialUpdate = false; + if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AutomaticSwap) + doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2; + else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysFullSwap) + doingPartialUpdate = false; + else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysPartialSwap) + doingPartialUpdate = hasPartialUpdateSupport(); + QGLContext *ctx = reinterpret_cast<QGLContext *>(parent->d_func()->extraData()->glContext); if (widget != window()) { if (initializeOffscreenTexture(window()->size())) diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 22bd5f0..09a6a30 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -112,6 +112,9 @@ public: static QGLFormat surfaceFormat; + enum SwapMode { AutomaticSwap, AlwaysFullSwap, AlwaysPartialSwap, KillSwap }; + static SwapMode swapBehavior; + private slots: void deleted(QObject *object); |