[cairo] [patch] gl: add query display and context for egl-based device
Henry (Yu) Song - SISA
hsong at sisa.samsung.com
Thu Mar 7 08:33:27 PST 2013
>From 383b96bba39767df7b009ecf5181ce37a9998083 Mon Sep 17 00:00:00 2001
From: Henry Song <henry.song at samsung.com>
Date: Thu, 7 Mar 2013 08:28:02 -0800
Subject: [PATCH] gl: add query EGLContext and EGLDisplay from device
Similar to glx, add query for the EGLContext and EGLDisplay to egl-based
cairo device.
---
src/cairo-egl-context.c | 31 +++++++++++++++++++++++++++++++
src/cairo-gl.h | 6 ++++++
2 files changed, 37 insertions(+)
diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
index ba8f60f..88d6e6a 100644
--- a/src/cairo-egl-context.c
+++ b/src/cairo-egl-context.c
@@ -276,3 +276,34 @@ cairo_gl_surface_create_for_egl (cairo_device_t *device,
return &surface->base.base;
}
+
+EGLDisplay
+cairo_egl_device_get_display (cairo_device_t *device)
+{
+ cairo_egl_context_t *ctx;
+
+ if (device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ _cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
+ return EGL_NO_DISPLAY;
+ }
+
+ ctx = (cairo_egl_context_t *) device;
+
+ return ctx->display;
+}
+
+cairo_public EGLContext
+cairo_egl_device_get_context (cairo_device_t *device)
+{
+ cairo_egl_context_t *ctx;
+
+ if (device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ _cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
+ return EGL_NO_CONTEXT;
+ }
+
+ ctx = (cairo_egl_context_t *) device;
+
+ return ctx->context;
+}
+
diff --git a/src/cairo-gl.h b/src/cairo-gl.h
index cec3173..9fd7608 100644
--- a/src/cairo-gl.h
+++ b/src/cairo-gl.h
@@ -138,6 +138,12 @@ cairo_gl_surface_create_for_egl (cairo_device_t *device,
int width,
int height);
+cairo_public EGLDisplay
+cairo_egl_device_get_display (cairo_device_t *device);
+
+cairo_public EGLSurface
+cairo_egl_device_get_context (cairo_device_t *device);
+
#endif
CAIRO_END_DECLS
--
1.7.9.5
More information about the cairo
mailing list