From 5e66d1893234b3002d71985c05253321d4cdedc4 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 23 Jan 2010 22:53:59 +0800 Subject: egl: Move context functions in egldisplay.[ch] to eglcontext.[ch]. Move functions to where they should be. There should be no real change here. --- src/egl/main/eglcontext.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'src/egl/main/eglcontext.h') diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h index cb9e3f4a89..0dcec92488 100644 --- a/src/egl/main/eglcontext.h +++ b/src/egl/main/eglcontext.h @@ -65,4 +65,67 @@ _eglIsContextBound(_EGLContext *ctx) } +extern EGLContext +_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy); + + +extern void +_eglUnlinkContext(_EGLContext *ctx); + + +#ifndef _EGL_SKIP_HANDLE_CHECK + + +extern EGLBoolean +_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy); + + +#else /* !_EGL_SKIP_HANDLE_CHECK */ + + +static INLINE EGLBoolean +_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy) +{ + _EGLContext *c = (_EGLContext *) ctx; + return (dpy && c && c->Display == dpy); +} + + +#endif /* _EGL_SKIP_HANDLE_CHECK */ + + +/** + * Lookup a handle to find the linked context. + * Return NULL if the handle has no corresponding linked context. + */ +static INLINE _EGLContext * +_eglLookupContext(EGLContext context, _EGLDisplay *dpy) +{ + _EGLContext *ctx = (_EGLContext *) context; + if (!_eglCheckContextHandle(context, dpy)) + ctx = NULL; + return ctx; +} + + +/** + * Return the handle of a linked context, or EGL_NO_CONTEXT. + */ +static INLINE EGLContext +_eglGetContextHandle(_EGLContext *ctx) +{ + return (EGLContext) ((ctx && ctx->Display) ? ctx : EGL_NO_CONTEXT); +} + + +/** + * Return true if the context is linked to a display. + */ +static INLINE EGLBoolean +_eglIsContextLinked(_EGLContext *ctx) +{ + return (EGLBoolean) (_eglGetContextHandle(ctx) != EGL_NO_CONTEXT); +} + + #endif /* EGLCONTEXT_INCLUDED */ -- cgit v1.2.3