summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformwindowformat_qpa.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-07-23 07:46:23 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-07-23 11:28:36 (GMT)
commit699d74a9fae0b2d03e5c74bfb9590f6f0809ef4e (patch)
treeb5a5b787558e74497b84dbcd73ff614e7642630f /src/gui/kernel/qplatformwindowformat_qpa.cpp
parentbe08fbc13f7370b6cc0c34660b4d1c16e4fdd3f5 (diff)
downloadQt-699d74a9fae0b2d03e5c74bfb9590f6f0809ef4e.zip
Qt-699d74a9fae0b2d03e5c74bfb9590f6f0809ef4e.tar.gz
Qt-699d74a9fae0b2d03e5c74bfb9590f6f0809ef4e.tar.bz2
Make it possible to have shared contexts to Lighthouse
This adds a getter to QPlatformGLContext for the "default shared context". The setter is protected as it is the plugins responsibillity to create it or not. QPlatformWindowFormat has also gotten a pointer to a QPlatformGLContext for a non default shared context. Only implemented shared contexts in testlite for now.
Diffstat (limited to 'src/gui/kernel/qplatformwindowformat_qpa.cpp')
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp
index bc234ab..9d86948 100644
--- a/src/gui/kernel/qplatformwindowformat_qpa.cpp
+++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp
@@ -50,7 +50,8 @@ public:
: ref(1)
, opts(QPlatformWindowFormat::DoubleBuffer | QPlatformWindowFormat::DepthBuffer
| QPlatformWindowFormat::Rgba | QPlatformWindowFormat::DirectRendering
- | QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions)
+ | QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions
+ | QPlatformWindowFormat::UseDefaultSharedContext)
, depthSize(-1)
, accumSize(-1)
, stencilSize(-1)
@@ -60,9 +61,8 @@ public:
, alphaSize(-1)
, numSamples(-1)
, swapInterval(-1)
- , majorVersion(1)
- , minorVersion(0)
, windowApi(QPlatformWindowFormat::Raster)
+ , sharedContext(0)
{
}
@@ -78,9 +78,8 @@ public:
alphaSize(other->alphaSize),
numSamples(other->numSamples),
swapInterval(other->swapInterval),
- majorVersion(other->majorVersion),
- minorVersion(other->minorVersion),
- windowApi(other->windowApi)
+ windowApi(other->windowApi),
+ sharedContext(other->sharedContext)
{
}
QAtomicInt ref;
@@ -94,9 +93,8 @@ public:
int alphaSize;
int numSamples;
int swapInterval;
- int majorVersion;
- int minorVersion;
QPlatformWindowFormat::WindowApi windowApi;
+ QPlatformGLContext *sharedContext;
};
/*!
@@ -519,6 +517,16 @@ void QPlatformWindowFormat::setSampleBuffers(bool enable)
setOption(enable ? QPlatformWindowFormat::SampleBuffers : QPlatformWindowFormat::NoSampleBuffers);
}
+void QPlatformWindowFormat::setUseDefaultSharedContext(bool enable)
+{
+ if (enable) {
+ setOption(QPlatformWindowFormat::UseDefaultSharedContext);
+ d->sharedContext = 0;
+ } else {
+ setOption(QPlatformWindowFormat::NoDefaultSharedContext);
+ }
+}
+
/*!
Returns the number of samples per pixel when multisampling is
enabled. By default, the highest number of samples that is
@@ -595,6 +603,17 @@ QPlatformWindowFormat::WindowApi QPlatformWindowFormat::windowApi() const
return d->windowApi;
}
+void QPlatformWindowFormat::setSharedContext(QPlatformGLContext *context)
+{
+ setUseDefaultSharedContext(false);
+ d->sharedContext = context;
+}
+
+QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const
+{
+ return d->sharedContext;
+}
+
///*!
// \fn bool QGLFormat::hasOverlay() const
@@ -952,8 +971,6 @@ bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b)
&& a.d->blueSize == b.d->blueSize
&& a.d->numSamples == b.d->numSamples
&& a.d->swapInterval == b.d->swapInterval
- && a.d->majorVersion == b.d->majorVersion
- && a.d->minorVersion == b.d->minorVersion
&& a.d->windowApi == b.d->windowApi);
}