diff options
author | Chia-I Wu <[email protected]> | 2009-09-30 15:34:45 +0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-10-15 12:53:57 -0600 |
commit | 61906631202af855d0742586956ff9f34522a525 (patch) | |
tree | 5b9b906185616887ae47235d7a05de781e3c3627 /src/egl | |
parent | 8bb2485ed0e4764b8ad1f1a7f0bfe1c3f66d71bc (diff) |
egl: Rework error checking in eglGetCurrentSurface.
Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r-- | 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 d86ef9ce562..1512c0a14ea 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); } |