diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-30 12:38:01 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-30 12:38:01 (GMT) |
commit | a24c7ee4da84d3ac8e52cafda200f07c48d0bc98 (patch) | |
tree | 925b81484c277781dbbe00a248d005f3071466c8 | |
parent | d279e5d3ee808f4faeb5408dc66740b7fffab84f (diff) | |
download | Qt-a24c7ee4da84d3ac8e52cafda200f07c48d0bc98.zip Qt-a24c7ee4da84d3ac8e52cafda200f07c48d0bc98.tar.gz Qt-a24c7ee4da84d3ac8e52cafda200f07c48d0bc98.tar.bz2 |
Add support for using OpenGL for window surfaces to testlite
To use OpenGL for regular widget rendering, pass testlitegl as the
argument to -platform.
QGLWindowSurface works by creating a QGLContext on the top-level
widget. As testlite's GL integration allows this, QGLWindowSurface
can be used without modification.
-rw-r--r-- | src/plugins/platforms/testlite/main.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qtestliteintegration.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qtestliteintegration.h | 5 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp index 29bbcea..5f631f0 100644 --- a/src/plugins/platforms/testlite/main.cpp +++ b/src/plugins/platforms/testlite/main.cpp @@ -55,6 +55,9 @@ QStringList QTestLiteIntegrationPlugin::keys() const { QStringList list; list << "TestLite"; +#ifndef QT_NO_OPENGL + list << "TestLiteGL"; +#endif return list; } @@ -62,6 +65,10 @@ QPlatformIntegration* QTestLiteIntegrationPlugin::create(const QString& system) { if (system.toLower() == "testlite") return new QTestLiteIntegration; +#ifndef QT_NO_OPENGL + if (system.toLower() == "testlitegl") + return new QTestLiteIntegration(true); +#endif return 0; } diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 32562dd..f3c3688 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -53,6 +53,7 @@ #ifndef QT_NO_OPENGL #include <GL/glx.h> #include "qglxintegration.h" +#include <private/qwindowsurface_gl_p.h> #endif QT_BEGIN_NAMESPACE @@ -81,7 +82,10 @@ public: }; -QTestLiteIntegration::QTestLiteIntegration() +QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) +#ifndef QT_NO_OPENGL + : mUseOpenGL(useOpenGL) +#endif { xd = new MyDisplay; @@ -109,6 +113,11 @@ QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const { +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLWindowSurface(widget); +#endif + return new QTestLiteWindowSurface(mPrimaryScreen, widget); } diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 69dad93..8289a5c 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -71,7 +71,7 @@ public: class QTestLiteIntegration : public QPlatformIntegration { public: - QTestLiteIntegration(); + QTestLiteIntegration(bool useOpenGL = false); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; @@ -90,6 +90,9 @@ public: MyDisplay *xd; private: +#ifndef QT_NO_OPENGL + bool mUseOpenGL; +#endif QTestLiteScreen *mPrimaryScreen; QList<QPlatformScreen *> mScreens; }; |