diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-09-25 00:42:58 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-09-25 00:42:58 (GMT) |
commit | 9f814e1efe11ced6d7b64d1fcc52382631f9cb52 (patch) | |
tree | 011c924414ebb7c9bf395b120f94687ccf7c1343 /src/gui | |
parent | f3d15516572394b6bcd44a89dd66516fa4eba56e (diff) | |
download | Qt-9f814e1efe11ced6d7b64d1fcc52382631f9cb52.zip Qt-9f814e1efe11ced6d7b64d1fcc52382631f9cb52.tar.gz Qt-9f814e1efe11ced6d7b64d1fcc52382631f9cb52.tar.bz2 |
Make QEglContext API a little more flexible
Allow higher layers in QtOpenGL and QtOpenVG to set the EGLConfig
and EGLContext manually if they have some other way to determine
what the values should be (e.g. constructing a special config for a
specific platform). Also add a QEglProperties argument to
createContext() to allow fine-tuning of the context parameters.
Reviewed-by: Sarah Smith
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/egl/qegl.cpp | 12 | ||||
-rw-r--r-- | src/gui/egl/qegl_p.h | 8 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index f06c153..840b9d6 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -60,7 +60,6 @@ QEglContext::QEglContext() , ctx(EGL_NO_CONTEXT) , cfg(0) , currentSurface(EGL_NO_SURFACE) - , share(false) , current(false) { } @@ -80,11 +79,6 @@ bool QEglContext::isValid() const return (ctx != EGL_NO_CONTEXT); } -bool QEglContext::isSharing() const -{ - return share; -} - bool QEglContext::isCurrent() const { return current; @@ -159,7 +153,7 @@ bool QEglContext::chooseConfig } // Create the EGLContext. -bool QEglContext::createContext(QEglContext *shareContext) +bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties) { // We need to select the correct API before calling eglCreateContext(). #ifdef EGL_OPENGL_ES_API @@ -173,6 +167,8 @@ bool QEglContext::createContext(QEglContext *shareContext) // Create a new context for the configuration. QEglProperties contextProps; + if (properties) + contextProps = *properties; #if defined(QT_OPENGL_ES_2) if (apiType == QEgl::OpenGL) contextProps.setValue(EGL_CONTEXT_CLIENT_VERSION, 2); @@ -193,7 +189,6 @@ bool QEglContext::createContext(QEglContext *shareContext) return false; } } - share = (shareContext != 0); return true; } @@ -216,7 +211,6 @@ void QEglContext::destroy() dpy = EGL_NO_DISPLAY; ctx = EGL_NO_CONTEXT; cfg = 0; - share = false; } bool QEglContext::makeCurrent(EGLSurface surface) diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index afec29b..dc399da 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -80,7 +80,6 @@ public: ~QEglContext(); bool isValid() const; - bool isSharing() const; bool isCurrent() const; QEgl::API api() const { return apiType; } @@ -88,7 +87,7 @@ public: bool openDisplay(QPaintDevice *device); bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); - bool createContext(QEglContext *shareContext = 0); + bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0); EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0); void destroySurface(EGLSurface surface); @@ -109,8 +108,12 @@ public: static QString errorString(EGLint code); EGLDisplay display() const { return dpy; } + EGLContext context() const { return ctx; } + void setContext(EGLContext context) { ctx = context; } + EGLConfig config() const { return cfg; } + void setConfig(EGLConfig config) { cfg = config; } QEglProperties configProperties(EGLConfig cfg = 0) const; @@ -127,7 +130,6 @@ private: EGLContext ctx; EGLConfig cfg; EGLSurface currentSurface; - bool share; bool current; static EGLDisplay getDisplay(QPaintDevice *device); |