Mesa (master): egl: Rework error checking in eglGetCurrentSurface.

Brian Paul brianp at kemper.freedesktop.org
Thu Oct 15 19:01:25 UTC 2009


Module: Mesa
Branch: master
Commit: 61906631202af855d0742586956ff9f34522a525
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=61906631202af855d0742586956ff9f34522a525

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Wed Sep 30 15:34:45 2009 +0800

egl: Rework error checking in eglGetCurrentSurface.

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>

---

 src/egl/main/eglapi.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index d86ef9c..1512c0a 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -568,8 +568,26 @@ eglGetCurrentContext(void)
 EGLSurface EGLAPIENTRY
 eglGetCurrentSurface(EGLint readdraw)
 {
-   _EGLSurface *s = _eglGetCurrentSurface(readdraw);
-   return _eglGetSurfaceHandle(s);
+   _EGLContext *ctx = _eglGetCurrentContext();
+   _EGLSurface *surf;
+
+   if (!ctx)
+      return EGL_NO_SURFACE;
+
+   switch (readdraw) {
+   case EGL_DRAW:
+      surf = ctx->DrawSurface;
+      break;
+   case EGL_READ:
+      surf = ctx->ReadSurface;
+      break;
+   default:
+      _eglError(EGL_BAD_PARAMETER, __FUNCTION__);
+      surf = NULL;
+      break;
+   }
+
+   return _eglGetSurfaceHandle(surf);
 }
 
 




More information about the mesa-commit mailing list