diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-03-08 14:26:33 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-03-10 09:53:07 (GMT) |
commit | 4737daef1c8d7a181117d6482f5b57cfc433e050 (patch) | |
tree | a9b2fbe71b2eee2d0e80ad11fa4e28960c10764e /src/gui/egl | |
parent | 79a83854bcae35c22e02212a775fcbf825c1439d (diff) | |
download | Qt-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/gui/egl')
-rw-r--r-- | src/gui/egl/qegl.cpp | 7 | ||||
-rw-r--r-- | src/gui/egl/qegl_x11.cpp | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 485bfbf..6e0331f 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -392,6 +392,11 @@ bool QEglContext::makeCurrent(EGLSurface surface) return false; } + if (surface == EGL_NO_SURFACE) { + qWarning() << "QEglContext::makeCurrent(): Cannot make invalid surface current"; + return false; + } + // If lazyDoneCurrent() was called on the surface, then we may be able // to assume that it is still current within the thread. if (surface == currentSurface && currentContext(apiType) == this) { @@ -417,7 +422,7 @@ bool QEglContext::makeCurrent(EGLSurface surface) bool ok = eglMakeCurrent(QEgl::display(), surface, surface, ctx); if (!ok) - qWarning() << "QEglContext::makeCurrent():" << QEgl::errorString(); + qWarning() << "QEglContext::makeCurrent(" << surface << "):" << QEgl::errorString(); return ok; } diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 53c4711..91423c8 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -408,7 +408,7 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg EGLSurface surf = eglCreatePixmapSurface(QEgl::display(), config, (EGLNativePixmapType) x11PixmapData->handle(), surfaceAttribs.properties()); - x11PixmapData->gl_surface = (Qt::HANDLE)surf; + x11PixmapData->gl_surface = (void*)surf; QImagePixmapCleanupHooks::enableCleanupHooks(x11PixmapData); return surf; } |