summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-02-16 15:15:04 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-03-02 08:24:23 (GMT)
commit6378d3d0e851f6af3e518ff53351de3253368026 (patch)
tree83d7c7b14d966f63aaf13a9670a6c3028fa14935
parent28b85c76dd0ba4796ec519b890f6fab0fc813061 (diff)
downloadQt-6378d3d0e851f6af3e518ff53351de3253368026.zip
Qt-6378d3d0e851f6af3e518ff53351de3253368026.tar.gz
Qt-6378d3d0e851f6af3e518ff53351de3253368026.tar.bz2
Move chooseConfig and createSurface logic to QEgl functions
We keep the methods in QEglContext, but these are useful helpers which wrap the QEgl version of the functions, which is where the bulk of the logic is (for these functions anyway). Reviewed-By: Aleksandar Sasha Babic
-rw-r--r--src/gui/egl/qegl.cpp24
-rw-r--r--src/gui/egl/qegl_p.h7
-rw-r--r--src/gui/egl/qegl_qws.cpp3
-rw-r--r--src/gui/egl/qegl_symbian.cpp2
-rw-r--r--src/gui/egl/qegl_wince.cpp2
-rw-r--r--src/gui/egl/qegl_x11.cpp2
6 files changed, 28 insertions, 12 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index ef5eb67..6d719ba 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -89,10 +89,10 @@ bool QEglContext::isCurrent() const
}
// Choose a configuration that matches "properties".
-bool QEglContext::chooseConfig
- (const QEglProperties& properties, QEgl::PixelFormatMatch match)
+EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match)
{
- QEglProperties props(properties);
+ QEglProperties props(*properties);
+ EGLConfig cfg = QEGL_NO_CONFIG;
do {
// Get the number of matching configurations for this set of properties.
EGLint matching = 0;
@@ -106,7 +106,7 @@ bool QEglContext::chooseConfig
eglChooseConfig(display(), props.properties(), &cfg, 1, &matching);
if (matching < 1)
continue;
- return true;
+ return cfg;
}
// Fetch all of the matching configurations and find the
@@ -127,7 +127,7 @@ bool QEglContext::chooseConfig
alpha == props.value(EGL_ALPHA_SIZE))) {
cfg = configs[index];
delete [] configs;
- return true;
+ return cfg;
}
}
delete [] configs;
@@ -146,9 +146,21 @@ bool QEglContext::chooseConfig
qWarning() << "Available:";
QEgl::dumpAllConfigs();
}
- return false;
+ return QEGL_NO_CONFIG;
}
+bool QEglContext::chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match)
+{
+ cfg = QEgl::chooseConfig(&properties, match);
+ return cfg != QEGL_NO_CONFIG;
+}
+
+EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties *properties)
+{
+ return QEgl::createSurface(device, cfg, properties);
+}
+
+
// Create the EGLContext.
bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties)
{
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index e48e4a0..a50e4e1 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -93,9 +93,12 @@ typedef NativeDisplayType EGLNativeDisplayType;
QT_END_INCLUDE_NAMESPACE
+#include <QtGui/qpaintdevice.h>
QT_BEGIN_NAMESPACE
+#define QEGL_NO_CONFIG ((EGLConfig)-1)
+
class QEglProperties;
namespace QEgl {
@@ -111,8 +114,8 @@ namespace QEgl {
BestPixelFormat
};
-// EGLConfig chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat);
-// EGLSurface createSurface(QPaintDevice *device, EGLConfig config, const QEglProperties *properties = 0);
+ Q_GUI_EXPORT EGLConfig chooseConfig(const QEglProperties* configAttribs, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat);
+ Q_GUI_EXPORT EGLSurface createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *surfaceAttribs = 0);
Q_GUI_EXPORT void dumpAllConfigs();
diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp
index a40c236..935fe67 100644
--- a/src/gui/egl/qegl_qws.cpp
+++ b/src/gui/egl/qegl_qws.cpp
@@ -59,9 +59,10 @@ QT_BEGIN_NAMESPACE
// We don't have QGLScreen to create EGL surfaces for us,
// so surface creation needs to be done in QtOpenGL or
// QtOpenVG for Qt/Embedded.
-EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties)
+EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
{
Q_UNUSED(device);
+ Q_UNUSED(cfg);
Q_UNUSED(properties);
return EGL_NO_SURFACE;
}
diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp
index 0c91fd8..2276ce0 100644
--- a/src/gui/egl/qegl_symbian.cpp
+++ b/src/gui/egl/qegl_symbian.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
-EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties)
+EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
{
// Create the native drawable for the paint device.
int devType = device->devType();
diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp
index 2f79005..fae491b 100644
--- a/src/gui/egl/qegl_wince.cpp
+++ b/src/gui/egl/qegl_wince.cpp
@@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE
-EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties)
+EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
{
// Create the native drawable for the paint device.
int devType = device->devType();
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 4a813c6..d24727a 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -55,7 +55,7 @@
QT_BEGIN_NAMESPACE
-EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties)
+EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
{
// Create the native drawable for the paint device.
int devType = device->devType();