summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-03-08 14:26:33 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-03-10 09:53:07 (GMT)
commit4737daef1c8d7a181117d6482f5b57cfc433e050 (patch)
treea9b2fbe71b2eee2d0e80ad11fa4e28960c10764e /src/opengl
parent79a83854bcae35c22e02212a775fcbf825c1439d (diff)
downloadQt-4737daef1c8d7a181117d6482f5b57cfc433e050.zip
Qt-4737daef1c8d7a181117d6482f5b57cfc433e050.tar.gz
Qt-4737daef1c8d7a181117d6482f5b57cfc433e050.tar.bz2
Handle EGLSurfaces better, including more error detection
Note: This changes QX11PixmapData::gl_surface to a void* to enable build on 64-bit systems where EGLSurface is a pointer. Reviewed-By: TrustMe
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl_x11.cpp2
-rw-r--r--src/opengl/qgl_x11egl.cpp8
-rw-r--r--src/opengl/qpixmapdata_x11gl_egl.cpp10
3 files changed, 13 insertions, 7 deletions
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index f0b06ef5..4fa1467 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -1753,7 +1753,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con
if (!glxPixmap)
return 0;
- pixmapData->gl_surface = (Qt::HANDLE)glxPixmap;
+ pixmapData->gl_surface = (void*)glxPixmap;
// Make sure the cleanup hook gets called so we can delete the glx pixmap
QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData);
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index fdcc412..81eb35c 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -243,7 +243,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
if (x11PixmapData->gl_surface)
eglDestroySurface(d->eglContext->display(), (EGLSurface)x11PixmapData->gl_surface);
- x11PixmapData->gl_surface = (Qt::HANDLE)QEgl::createSurface(device(), d->eglContext->config());
+ x11PixmapData->gl_surface = (void*)QEgl::createSurface(device(), d->eglContext->config());
}
return true;
@@ -404,8 +404,8 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, cons
hasAlpha ? QEgl::Translucent : QEgl::NoOptions);
QPixmap tmpPixmap(pixmapData); //###
- pixmapData->gl_surface = (Qt::HANDLE)QEgl::createSurface(&tmpPixmap, config);
- if (pixmapData->gl_surface == (Qt::HANDLE)EGL_NO_SURFACE) {
+ pixmapData->gl_surface = (void*)QEgl::createSurface(&tmpPixmap, config);
+ if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE) {
haveTFP = false;
return 0;
}
@@ -423,7 +423,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, cons
if (success == EGL_FALSE) {
qWarning() << "eglBindTexImage() failed:" << QEgl::errorString();
eglDestroySurface(eglContext->display(), (EGLSurface)pixmapData->gl_surface);
- pixmapData->gl_surface = (Qt::HANDLE)EGL_NO_SURFACE;
+ pixmapData->gl_surface = (void*)EGL_NO_SURFACE;
haveTFP = false;
return 0;
}
diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp
index b6c33f2..797fe6b 100644
--- a/src/opengl/qpixmapdata_x11gl_egl.cpp
+++ b/src/opengl/qpixmapdata_x11gl_egl.cpp
@@ -235,8 +235,14 @@ void QX11GLPixmapData::beginPaint()
if ((EGLSurface)gl_surface == EGL_NO_SURFACE) {
QPixmap tmpPixmap(this);
EGLConfig cfg = ctx->d_func()->eglContext->config();
- gl_surface = (Qt::HANDLE)QEgl::createSurface(&tmpPixmap, cfg);
- ctx->d_func()->eglSurface = (EGLSurface)gl_surface;
+
+ EGLSurface surface = QEgl::createSurface(&tmpPixmap, cfg);
+ if (surface == EGL_NO_SURFACE) {
+ qWarning() << "Error creating EGL surface for pixmap:" << QEgl::errorString();
+ return;
+ }
+ gl_surface = (void*)surface;
+ ctx->d_func()->eglSurface = surface;
ctx->d_func()->valid = true;
}
QGLPaintDevice::beginPaint();