mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 13:28:03 +02:00
gl: Export query for EGLContext and EGLDisplay from device
Similar to glx, add query for the EGLContext and EGLDisplay to egl-based cairo devices.
This commit is contained in:
parent
a8f1b456db
commit
524e6fd3e8
2 changed files with 39 additions and 0 deletions
|
|
@ -276,3 +276,36 @@ cairo_gl_surface_create_for_egl (cairo_device_t *device,
|
|||
|
||||
return &surface->base.base;
|
||||
}
|
||||
|
||||
static bool is_egl_device (cairo_device_t *device)
|
||||
{
|
||||
return (device->backend != NULL &&
|
||||
device->backend->type == CAIRO_DEVICE_TYPE_GL);
|
||||
}
|
||||
|
||||
static cairo_egl_context_t *to_egl_context (cairo_device_t *device)
|
||||
{
|
||||
return (cairo_egl_context_t *) device;
|
||||
}
|
||||
|
||||
EGLDisplay
|
||||
cairo_egl_device_get_display (cairo_device_t *device)
|
||||
{
|
||||
if (! is_egl_device (device)) {
|
||||
_cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
|
||||
return EGL_NO_DISPLAY;
|
||||
}
|
||||
|
||||
return to_egl_context (device)->display;
|
||||
}
|
||||
|
||||
cairo_public EGLContext
|
||||
cairo_egl_device_get_context (cairo_device_t *device)
|
||||
{
|
||||
if (! is_egl_device (device)) {
|
||||
_cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
|
||||
return EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
return to_egl_context (device)->context;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue