egl: Rework error checking in eglGetCurrentSurface.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
This commit is contained in:
Chia-I Wu 2009-09-30 15:34:45 +08:00 committed by Brian Paul
parent 8bb2485ed0
commit 6190663120
1 changed files with 20 additions and 2 deletions

View File

@ -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);
}