summaryrefslogtreecommitdiff
path: root/src/egl/main/eglcontext.h
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-01-23 22:53:59 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-01-24 20:38:15 +0800
commit5e66d1893234b3002d71985c05253321d4cdedc4 (patch)
tree771179bf6df9a1e0a3c264020148d85d645fd1b0 /src/egl/main/eglcontext.h
parent7be4d6b5f7ee8ccf8a5dfc117b348c2a165d4054 (diff)
egl: Move context functions in egldisplay.[ch] to eglcontext.[ch].
Move functions to where they should be. There should be no real change here.
Diffstat (limited to 'src/egl/main/eglcontext.h')
-rw-r--r--src/egl/main/eglcontext.h63
1 files changed, 63 insertions, 0 deletions
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 */