summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-03-29 12:58:18 +0200
committerBenjamin Otte <otte@redhat.com>2010-04-15 18:31:00 +0200
commit46ef05c3d73af2b222602954b986832e77355a12 (patch)
tree56729417a328abfef6a0fd5c2d07caa08fa9e93d
parent712919223d08f8b4c43f828322fdc285560c137f (diff)
glx: Add getters for device's Display and GLXContext
-rw-r--r--src/cairo-gl.h6
-rw-r--r--src/cairo-glx-context.c30
2 files changed, 36 insertions, 0 deletions
diff --git a/src/cairo-gl.h b/src/cairo-gl.h
index 2b73f3f4..4f1912f4 100644
--- a/src/cairo-gl.h
+++ b/src/cairo-gl.h
@@ -66,6 +66,12 @@ cairo_gl_surface_glfinish (cairo_surface_t *surface);
cairo_public cairo_device_t *
cairo_glx_device_create (Display *dpy, GLXContext gl_ctx);
+cairo_public Display *
+cairo_glx_device_get_display (cairo_device_t *device);
+
+cairo_public GLXContext
+cairo_glx_device_get_context (cairo_device_t *device);
+
cairo_public cairo_surface_t *
cairo_gl_surface_create_for_window (cairo_device_t *device,
Window win,
diff --git a/src/cairo-glx-context.c b/src/cairo-glx-context.c
index f519443d..e261cf88 100644
--- a/src/cairo-glx-context.c
+++ b/src/cairo-glx-context.c
@@ -209,6 +209,36 @@ cairo_glx_device_create (Display *dpy, GLXContext gl_ctx)
return &ctx->base.base;
}
+Display *
+cairo_glx_device_get_display (cairo_device_t *device)
+{
+ cairo_glx_context_t *ctx;
+
+ if (device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ _cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
+ return NULL;
+ }
+
+ ctx = (cairo_glx_context_t *) device;
+
+ return ctx->display;
+}
+
+GLXContext
+cairo_glx_device_get_context (cairo_device_t *device)
+{
+ cairo_glx_context_t *ctx;
+
+ if (device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ _cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
+ return NULL;
+ }
+
+ ctx = (cairo_glx_context_t *) device;
+
+ return ctx->context;
+}
+
cairo_surface_t *
cairo_gl_surface_create_for_window (cairo_device_t *device,
Window win,