From 177f2a2f17251c22f57944e9dd100ec8515b891a Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Tue, 4 Jan 2011 10:53:58 +0100 Subject: QMeeGoGraphicsSystemHelper::setSwapBehavior implementation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 993 Reviewed-by: Samuel Rødal --- .../qmeegographicssystemhelper.cpp | 15 +++++++++++++++ .../qmeegographicssystemhelper.h | 18 ++++++++++++++++++ .../qmeegographicssystemhelper.pro | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp index b660eb3..37cc417 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "qmeegoruntime.h" #include "qmeegoswitchevent.h" @@ -153,3 +154,17 @@ void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent) ENSURE_RUNNING_MEEGO; QMeeGoRuntime::setTranslucent(translucent); } + +void QMeeGoGraphicsSystemHelper::setSwapBehavior(SwapMode mode) +{ + ENSURE_RUNNING_MEEGO; + + if (mode == AutomaticSwap) + QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap; + else if (mode == AlwaysFullSwap) + QGLWindowSurface::swapBehavior = QGLWindowSurface::AlwaysFullSwap; + else if (mode == AlwaysPartialSwap) + QGLWindowSurface::swapBehavior = QGLWindowSurface::AlwaysPartialSwap; + else if (mode == KillSwap) + QGLWindowSurface::swapBehavior = QGLWindowSurface::KillSwap; +} diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h index 6df3c22..c8dccc2 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -186,6 +186,24 @@ public: on the top-level widget *before* you show it instead. */ static void setTranslucent(bool translucent); + + //! Used to specify the mode for swapping buffers in double-buffered GL rendering. + enum SwapMode { + AutomaticSwap, /**< Automatically choose netween full and partial updates (25% threshold) */ + AlwaysFullSwap, /**< Always do a full swap even if partial updates support present */ + AlwaysPartialSwap, /**< Always do a partial swap (if support present) no matter what threshold */ + KillSwap /**< Do not perform buffer swapping at all (no picture) */ + }; + + //! Sets the buffer swapping mode. + /*! + This can be only called when running with the meego graphics system. + The KillSwap mode can be specififed to effectively block painting. + + This functionality should be used only by applications counting on a specific behavior. + Most applications should use the default automatic behavior. + */ + static void setSwapBehavior(SwapMode mode); }; #endif diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro index 360847e..7639ad7 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro @@ -3,7 +3,7 @@ TARGET = QtMeeGoGraphicsSystemHelper include(../../src/qbase.pri) -QT += gui +QT += gui opengl INCLUDEPATH += '../../src/plugins/graphicssystems/meego' HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegoswitchevent.h -- cgit v0.12