diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/egl/qegl.cpp | 53 | ||||
-rw-r--r-- | src/gui/egl/qegl_p.h | 11 | ||||
-rw-r--r-- | src/gui/egl/qegl_qws.cpp | 4 | ||||
-rw-r--r-- | src/gui/egl/qegl_symbian.cpp | 11 | ||||
-rw-r--r-- | src/gui/egl/qegl_wince.cpp | 8 | ||||
-rw-r--r-- | src/gui/egl/qegl_x11.cpp | 8 |
6 files changed, 16 insertions, 79 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index a405bbb..f06c153 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -58,7 +58,6 @@ QEglContext::QEglContext() : apiType(QEgl::OpenGL) , dpy(EGL_NO_DISPLAY) , ctx(EGL_NO_CONTEXT) - , surf(EGL_NO_SURFACE) , cfg(0) , currentSurface(EGL_NO_SURFACE) , share(false) @@ -198,30 +197,6 @@ bool QEglContext::createContext(QEglContext *shareContext) return true; } -// Recreate the surface for a paint device because the native id has changed. -bool QEglContext::recreateSurface(QPaintDevice *device) -{ - // Bail out if the surface has not been created for the first time yet. - if (surf == EGL_NO_SURFACE) - return true; - - // Destroy the old surface. - eglDestroySurface(dpy, surf); - surf = EGL_NO_SURFACE; - - // Create a new one. - return createSurface(device); -} - -// Destroy the EGL surface object. -void QEglContext::destroySurface() -{ - if (surf != EGL_NO_SURFACE) { - eglDestroySurface(dpy, surf); - surf = EGL_NO_SURFACE; - } -} - // Destroy an EGL surface object. If it was current on this context // then call doneCurrent() for it first. void QEglContext::destroySurface(EGLSurface surface) @@ -230,8 +205,6 @@ void QEglContext::destroySurface(EGLSurface surface) if (surface == currentSurface) doneCurrent(); eglDestroySurface(dpy, surface); - if (surf == surface) - surf = EGL_NO_SURFACE; } } @@ -242,16 +215,10 @@ void QEglContext::destroy() eglDestroyContext(dpy, ctx); dpy = EGL_NO_DISPLAY; ctx = EGL_NO_CONTEXT; - surf = EGL_NO_SURFACE; cfg = 0; share = false; } -bool QEglContext::makeCurrent() -{ - return makeCurrent(surf); -} - bool QEglContext::makeCurrent(EGLSurface surface) { if (ctx == EGL_NO_CONTEXT) { @@ -316,17 +283,6 @@ bool QEglContext::lazyDoneCurrent() return true; } -bool QEglContext::swapBuffers() -{ - if(ctx == EGL_NO_CONTEXT) - return false; - - bool ok = eglSwapBuffers(dpy, surf); - if (!ok) - qWarning() << "QEglContext::swapBuffers():" << errorString(eglGetError()); - return ok; -} - bool QEglContext::swapBuffers(EGLSurface surface) { if(ctx == EGL_NO_CONTEXT) @@ -368,15 +324,6 @@ void QEglContext::waitClient() #endif } -// Query the actual size of the EGL surface. -QSize QEglContext::surfaceSize() const -{ - int w, h; - eglQuerySurface(dpy, surf, EGL_WIDTH, &w); - eglQuerySurface(dpy, surf, EGL_HEIGHT, &h); - return QSize(w, h); -} - // Query the value of a configuration attribute. bool QEglContext::configAttrib(int name, EGLint *value) const { diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 3903cd0..afec29b 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -89,25 +89,19 @@ public: bool openDisplay(QPaintDevice *device); bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); bool createContext(QEglContext *shareContext = 0); - bool createSurface(QPaintDevice *device, const QEglProperties *properties = 0); - bool recreateSurface(QPaintDevice *device); - void destroySurface(); + EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0); void destroySurface(EGLSurface surface); void destroy(); - bool makeCurrent(); bool makeCurrent(EGLSurface surface); bool doneCurrent(); bool lazyDoneCurrent(); - bool swapBuffers(); bool swapBuffers(EGLSurface surface); void waitNative(); void waitClient(); - QSize surfaceSize() const; - bool configAttrib(int name, EGLint *value) const; static void clearError() { eglGetError(); } @@ -116,8 +110,6 @@ public: EGLDisplay display() const { return dpy; } EGLContext context() const { return ctx; } - EGLSurface surface() const { return surf; } - void setSurface(EGLSurface surface) { surf = surface; } EGLConfig config() const { return cfg; } QEglProperties configProperties(EGLConfig cfg = 0) const; @@ -133,7 +125,6 @@ private: QEgl::API apiType; EGLDisplay dpy; EGLContext ctx; - EGLSurface surf; EGLConfig cfg; EGLSurface currentSurface; bool share; diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp index 2754589..590b666 100644 --- a/src/gui/egl/qegl_qws.cpp +++ b/src/gui/egl/qegl_qws.cpp @@ -57,11 +57,11 @@ 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. -bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) { Q_UNUSED(device); Q_UNUSED(properties); - return false; + return EGL_NO_SURFACE; } EGLDisplay QEglContext::getDisplay(QPaintDevice *device) diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp index fa0b5cb..2101f0b 100644 --- a/src/gui/egl/qegl_symbian.cpp +++ b/src/gui/egl/qegl_symbian.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE -bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) { // Create the native drawable for the paint device. int devType = device->devType(); @@ -67,7 +67,7 @@ bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *prop } if (!ok) { qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); - return false; + return EGL_NO_SURFACE; } // Create the EGL surface to draw into, based on the native drawable. @@ -76,15 +76,14 @@ bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *prop props = properties->properties(); else props = 0; + EGLSurface surf; if (devType == QInternal::Widget) surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, 0); else surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, 0); - if (surf == EGL_NO_SURFACE) { + if (surf == EGL_NO_SURFACE) qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); - return false; - } - return true; + return surf; } EGLDisplay QEglContext::getDisplay(QPaintDevice *device) diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp index e07d748..bf07f85 100644 --- a/src/gui/egl/qegl_wince.cpp +++ b/src/gui/egl/qegl_wince.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE -bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) { // Create the native drawable for the paint device. int devType = device->devType(); @@ -67,7 +67,7 @@ bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *prop } if (!ok) { qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); - return false; + return EGL_NO_SURFACE; } // Create the EGL surface to draw into, based on the native drawable. @@ -76,15 +76,15 @@ bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *prop props = properties->properties(); else props = 0; + EGLSurface surf; if (devType == QInternal::Widget) surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, props); else surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, props); if (surf == EGL_NO_SURFACE) { qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); - return false; } - return true; + return surf; } EGLDisplay QEglContext::getDisplay(QPaintDevice *device) diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 5f34f8e..9d556a8 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) { // Create the native drawable for the paint device. int devType = device->devType(); @@ -72,7 +72,7 @@ bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *prop } if (!ok) { qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); - return false; + return EGL_NO_SURFACE; } // Create the EGL surface to draw into, based on the native drawable. @@ -81,6 +81,7 @@ bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *prop props = properties->properties(); else props = 0; + EGLSurface surf; if (devType == QInternal::Widget) surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, props); else @@ -88,9 +89,8 @@ bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *prop if (surf == EGL_NO_SURFACE) { qWarning() << "QEglContext::createSurface(): Unable to create EGL surface:" << errorString(eglGetError()); - return false; } - return true; + return surf; } EGLDisplay QEglContext::getDisplay(QPaintDevice *device) |